diff mbox series

[v1,1/2] mmc: sdhci-omap: Use of_device_get_match_data() helper

Message ID 20220423221623.1074556-2-huobean@gmail.com
State New
Headers show
Series Two changes for eMMC | expand

Commit Message

Bean Huo April 23, 2022, 10:16 p.m. UTC
From: Bean Huo <beanhuo@micron.com>

Only the device data is needed, not the entire struct of_device_id.
Use of_device_get_match_data() instead of open coding of_match_device().

Signed-off-by: Bean Huo <beanhuo@micron.com>
---
 drivers/mmc/host/sdhci-omap.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Comments

Ulf Hansson April 26, 2022, 1:55 p.m. UTC | #1
On Sun, 24 Apr 2022 at 00:16, Bean Huo <huobean@gmail.com> wrote:
>
> From: Bean Huo <beanhuo@micron.com>
>
> Only the device data is needed, not the entire struct of_device_id.
> Use of_device_get_match_data() instead of open coding of_match_device().
>
> Signed-off-by: Bean Huo <beanhuo@micron.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci-omap.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
> index 64e27c2821f9..86e867ffbb10 100644
> --- a/drivers/mmc/host/sdhci-omap.c
> +++ b/drivers/mmc/host/sdhci-omap.c
> @@ -1219,16 +1219,11 @@ static int sdhci_omap_probe(struct platform_device *pdev)
>         struct sdhci_pltfm_host *pltfm_host;
>         struct sdhci_omap_host *omap_host;
>         struct mmc_host *mmc;
> -       const struct of_device_id *match;
> -       struct sdhci_omap_data *data;
> +       const struct sdhci_omap_data *data;
>         const struct soc_device_attribute *soc;
>         struct resource *regs;
>
> -       match = of_match_device(omap_sdhci_match, dev);
> -       if (!match)
> -               return -EINVAL;
> -
> -       data = (struct sdhci_omap_data *)match->data;
> +       data = of_device_get_match_data(&pdev->dev);
>         if (!data) {
>                 dev_err(dev, "no sdhci omap data\n");
>                 return -EINVAL;
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
index 64e27c2821f9..86e867ffbb10 100644
--- a/drivers/mmc/host/sdhci-omap.c
+++ b/drivers/mmc/host/sdhci-omap.c
@@ -1219,16 +1219,11 @@  static int sdhci_omap_probe(struct platform_device *pdev)
 	struct sdhci_pltfm_host *pltfm_host;
 	struct sdhci_omap_host *omap_host;
 	struct mmc_host *mmc;
-	const struct of_device_id *match;
-	struct sdhci_omap_data *data;
+	const struct sdhci_omap_data *data;
 	const struct soc_device_attribute *soc;
 	struct resource *regs;
 
-	match = of_match_device(omap_sdhci_match, dev);
-	if (!match)
-		return -EINVAL;
-
-	data = (struct sdhci_omap_data *)match->data;
+	data = of_device_get_match_data(&pdev->dev);
 	if (!data) {
 		dev_err(dev, "no sdhci omap data\n");
 		return -EINVAL;