Linux MultiMedia Card development
 help / color / mirror / Atom feed
* [PATCH v1 1/2] mmc: sdhci-pltfm: Drop unnecessary error messages in sdhci_pltfm_init()
@ 2023-10-06 10:58 Andy Shevchenko
  2023-10-06 10:58 ` [PATCH v1 2/2] mmc: sdhci-pltfm: Make driver OF independent Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Andy Shevchenko @ 2023-10-06 10:58 UTC (permalink / raw)
  To: Andy Shevchenko, Adrian Hunter, Ulf Hansson, linux-mmc,
	linux-kernel

The devm_platform_ioremap_resource() and platform_get_irq() print
the error messages themselves and our "failed" one brings no value
and just noise. Refactor code to avoid those noisy error messages.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mmc/host/sdhci-pltfm.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index a72e123a585d..4d1a703a5bdb 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -115,26 +115,21 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
 {
 	struct sdhci_host *host;
 	void __iomem *ioaddr;
-	int irq, ret;
+	int irq;
 
 	ioaddr = devm_platform_ioremap_resource(pdev, 0);
-	if (IS_ERR(ioaddr)) {
-		ret = PTR_ERR(ioaddr);
-		goto err;
-	}
+	if (IS_ERR(ioaddr))
+		return ERR_CAST(ioaddr);
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq < 0) {
-		ret = irq;
-		goto err;
-	}
+	if (irq < 0)
+		return ERR_PTR(irq);
 
 	host = sdhci_alloc_host(&pdev->dev,
 		sizeof(struct sdhci_pltfm_host) + priv_size);
-
 	if (IS_ERR(host)) {
-		ret = PTR_ERR(host);
-		goto err;
+		dev_err(&pdev->dev, "%s failed %pe\n", __func__, host);
+		return ERR_CAST(host);
 	}
 
 	host->ioaddr = ioaddr;
@@ -152,9 +147,6 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
 	platform_set_drvdata(pdev, host);
 
 	return host;
-err:
-	dev_err(&pdev->dev, "%s failed %d\n", __func__, ret);
-	return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(sdhci_pltfm_init);
 
-- 
2.40.0.1.gaa8946217a0b


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 2/2] mmc: sdhci-pltfm: Make driver OF independent
  2023-10-06 10:58 [PATCH v1 1/2] mmc: sdhci-pltfm: Drop unnecessary error messages in sdhci_pltfm_init() Andy Shevchenko
@ 2023-10-06 10:58 ` Andy Shevchenko
  2023-10-09 16:58   ` Adrian Hunter
  2023-10-10 14:27   ` Ulf Hansson
  2023-10-09 16:35 ` [PATCH v1 1/2] mmc: sdhci-pltfm: Drop unnecessary error messages in sdhci_pltfm_init() Adrian Hunter
  2023-10-10 14:27 ` Ulf Hansson
  2 siblings, 2 replies; 6+ messages in thread
From: Andy Shevchenko @ 2023-10-06 10:58 UTC (permalink / raw)
  To: Andy Shevchenko, Adrian Hunter, Ulf Hansson, linux-mmc,
	linux-kernel

Since we have device_is_compatible() API, drop OF dependency
in the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mmc/host/sdhci-pltfm.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index 4d1a703a5bdb..62753d72198a 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -19,7 +19,6 @@
 #include <linux/err.h>
 #include <linux/module.h>
 #include <linux/property.h>
-#include <linux/of.h>
 #ifdef CONFIG_PPC
 #include <asm/machdep.h>
 #endif
@@ -56,19 +55,16 @@ static bool sdhci_wp_inverted(struct device *dev)
 
 static void sdhci_get_compatibility(struct platform_device *pdev)
 {
+	struct device *dev = &pdev->dev;
 	struct sdhci_host *host = platform_get_drvdata(pdev);
-	struct device_node *np = pdev->dev.of_node;
 
-	if (!np)
-		return;
-
-	if (of_device_is_compatible(np, "fsl,p2020-rev1-esdhc"))
+	if (device_is_compatible(dev, "fsl,p2020-rev1-esdhc"))
 		host->quirks |= SDHCI_QUIRK_BROKEN_DMA;
 
-	if (of_device_is_compatible(np, "fsl,p2020-esdhc") ||
-	    of_device_is_compatible(np, "fsl,p1010-esdhc") ||
-	    of_device_is_compatible(np, "fsl,t4240-esdhc") ||
-	    of_device_is_compatible(np, "fsl,mpc8536-esdhc"))
+	if (device_is_compatible(dev, "fsl,p2020-esdhc") ||
+	    device_is_compatible(dev, "fsl,p1010-esdhc") ||
+	    device_is_compatible(dev, "fsl,t4240-esdhc") ||
+	    device_is_compatible(dev, "fsl,mpc8536-esdhc"))
 		host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
 }
 
-- 
2.40.0.1.gaa8946217a0b


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/2] mmc: sdhci-pltfm: Drop unnecessary error messages in sdhci_pltfm_init()
  2023-10-06 10:58 [PATCH v1 1/2] mmc: sdhci-pltfm: Drop unnecessary error messages in sdhci_pltfm_init() Andy Shevchenko
  2023-10-06 10:58 ` [PATCH v1 2/2] mmc: sdhci-pltfm: Make driver OF independent Andy Shevchenko
@ 2023-10-09 16:35 ` Adrian Hunter
  2023-10-10 14:27 ` Ulf Hansson
  2 siblings, 0 replies; 6+ messages in thread
From: Adrian Hunter @ 2023-10-09 16:35 UTC (permalink / raw)
  To: Andy Shevchenko, Ulf Hansson, linux-mmc, linux-kernel

On 6/10/23 13:58, Andy Shevchenko wrote:
> The devm_platform_ioremap_resource() and platform_get_irq() print
> the error messages themselves and our "failed" one brings no value
> and just noise. Refactor code to avoid those noisy error messages.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci-pltfm.c | 22 +++++++---------------
>  1 file changed, 7 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> index a72e123a585d..4d1a703a5bdb 100644
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -115,26 +115,21 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
>  {
>  	struct sdhci_host *host;
>  	void __iomem *ioaddr;
> -	int irq, ret;
> +	int irq;
>  
>  	ioaddr = devm_platform_ioremap_resource(pdev, 0);
> -	if (IS_ERR(ioaddr)) {
> -		ret = PTR_ERR(ioaddr);
> -		goto err;
> -	}
> +	if (IS_ERR(ioaddr))
> +		return ERR_CAST(ioaddr);
>  
>  	irq = platform_get_irq(pdev, 0);
> -	if (irq < 0) {
> -		ret = irq;
> -		goto err;
> -	}
> +	if (irq < 0)
> +		return ERR_PTR(irq);
>  
>  	host = sdhci_alloc_host(&pdev->dev,
>  		sizeof(struct sdhci_pltfm_host) + priv_size);
> -
>  	if (IS_ERR(host)) {
> -		ret = PTR_ERR(host);
> -		goto err;
> +		dev_err(&pdev->dev, "%s failed %pe\n", __func__, host);
> +		return ERR_CAST(host);
>  	}
>  
>  	host->ioaddr = ioaddr;
> @@ -152,9 +147,6 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
>  	platform_set_drvdata(pdev, host);
>  
>  	return host;
> -err:
> -	dev_err(&pdev->dev, "%s failed %d\n", __func__, ret);
> -	return ERR_PTR(ret);
>  }
>  EXPORT_SYMBOL_GPL(sdhci_pltfm_init);
>  


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 2/2] mmc: sdhci-pltfm: Make driver OF independent
  2023-10-06 10:58 ` [PATCH v1 2/2] mmc: sdhci-pltfm: Make driver OF independent Andy Shevchenko
@ 2023-10-09 16:58   ` Adrian Hunter
  2023-10-10 14:27   ` Ulf Hansson
  1 sibling, 0 replies; 6+ messages in thread
From: Adrian Hunter @ 2023-10-09 16:58 UTC (permalink / raw)
  To: Andy Shevchenko, Ulf Hansson, linux-mmc, linux-kernel

On 6/10/23 13:58, Andy Shevchenko wrote:
> Since we have device_is_compatible() API, drop OF dependency
> in the driver.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci-pltfm.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> index 4d1a703a5bdb..62753d72198a 100644
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -19,7 +19,6 @@
>  #include <linux/err.h>
>  #include <linux/module.h>
>  #include <linux/property.h>
> -#include <linux/of.h>
>  #ifdef CONFIG_PPC
>  #include <asm/machdep.h>
>  #endif
> @@ -56,19 +55,16 @@ static bool sdhci_wp_inverted(struct device *dev)
>  
>  static void sdhci_get_compatibility(struct platform_device *pdev)
>  {
> +	struct device *dev = &pdev->dev;
>  	struct sdhci_host *host = platform_get_drvdata(pdev);
> -	struct device_node *np = pdev->dev.of_node;
>  
> -	if (!np)
> -		return;
> -
> -	if (of_device_is_compatible(np, "fsl,p2020-rev1-esdhc"))
> +	if (device_is_compatible(dev, "fsl,p2020-rev1-esdhc"))
>  		host->quirks |= SDHCI_QUIRK_BROKEN_DMA;
>  
> -	if (of_device_is_compatible(np, "fsl,p2020-esdhc") ||
> -	    of_device_is_compatible(np, "fsl,p1010-esdhc") ||
> -	    of_device_is_compatible(np, "fsl,t4240-esdhc") ||
> -	    of_device_is_compatible(np, "fsl,mpc8536-esdhc"))
> +	if (device_is_compatible(dev, "fsl,p2020-esdhc") ||
> +	    device_is_compatible(dev, "fsl,p1010-esdhc") ||
> +	    device_is_compatible(dev, "fsl,t4240-esdhc") ||
> +	    device_is_compatible(dev, "fsl,mpc8536-esdhc"))
>  		host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
>  }
>  


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/2] mmc: sdhci-pltfm: Drop unnecessary error messages in sdhci_pltfm_init()
  2023-10-06 10:58 [PATCH v1 1/2] mmc: sdhci-pltfm: Drop unnecessary error messages in sdhci_pltfm_init() Andy Shevchenko
  2023-10-06 10:58 ` [PATCH v1 2/2] mmc: sdhci-pltfm: Make driver OF independent Andy Shevchenko
  2023-10-09 16:35 ` [PATCH v1 1/2] mmc: sdhci-pltfm: Drop unnecessary error messages in sdhci_pltfm_init() Adrian Hunter
@ 2023-10-10 14:27 ` Ulf Hansson
  2 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2023-10-10 14:27 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Adrian Hunter, linux-mmc, linux-kernel

On Fri, 6 Oct 2023 at 12:58, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> The devm_platform_ioremap_resource() and platform_get_irq() print
> the error messages themselves and our "failed" one brings no value
> and just noise. Refactor code to avoid those noisy error messages.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci-pltfm.c | 22 +++++++---------------
>  1 file changed, 7 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> index a72e123a585d..4d1a703a5bdb 100644
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -115,26 +115,21 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
>  {
>         struct sdhci_host *host;
>         void __iomem *ioaddr;
> -       int irq, ret;
> +       int irq;
>
>         ioaddr = devm_platform_ioremap_resource(pdev, 0);
> -       if (IS_ERR(ioaddr)) {
> -               ret = PTR_ERR(ioaddr);
> -               goto err;
> -       }
> +       if (IS_ERR(ioaddr))
> +               return ERR_CAST(ioaddr);
>
>         irq = platform_get_irq(pdev, 0);
> -       if (irq < 0) {
> -               ret = irq;
> -               goto err;
> -       }
> +       if (irq < 0)
> +               return ERR_PTR(irq);
>
>         host = sdhci_alloc_host(&pdev->dev,
>                 sizeof(struct sdhci_pltfm_host) + priv_size);
> -
>         if (IS_ERR(host)) {
> -               ret = PTR_ERR(host);
> -               goto err;
> +               dev_err(&pdev->dev, "%s failed %pe\n", __func__, host);
> +               return ERR_CAST(host);
>         }
>
>         host->ioaddr = ioaddr;
> @@ -152,9 +147,6 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
>         platform_set_drvdata(pdev, host);
>
>         return host;
> -err:
> -       dev_err(&pdev->dev, "%s failed %d\n", __func__, ret);
> -       return ERR_PTR(ret);
>  }
>  EXPORT_SYMBOL_GPL(sdhci_pltfm_init);
>
> --
> 2.40.0.1.gaa8946217a0b
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 2/2] mmc: sdhci-pltfm: Make driver OF independent
  2023-10-06 10:58 ` [PATCH v1 2/2] mmc: sdhci-pltfm: Make driver OF independent Andy Shevchenko
  2023-10-09 16:58   ` Adrian Hunter
@ 2023-10-10 14:27   ` Ulf Hansson
  1 sibling, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2023-10-10 14:27 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Adrian Hunter, linux-mmc, linux-kernel

On Fri, 6 Oct 2023 at 12:58, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Since we have device_is_compatible() API, drop OF dependency
> in the driver.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci-pltfm.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> index 4d1a703a5bdb..62753d72198a 100644
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -19,7 +19,6 @@
>  #include <linux/err.h>
>  #include <linux/module.h>
>  #include <linux/property.h>
> -#include <linux/of.h>
>  #ifdef CONFIG_PPC
>  #include <asm/machdep.h>
>  #endif
> @@ -56,19 +55,16 @@ static bool sdhci_wp_inverted(struct device *dev)
>
>  static void sdhci_get_compatibility(struct platform_device *pdev)
>  {
> +       struct device *dev = &pdev->dev;
>         struct sdhci_host *host = platform_get_drvdata(pdev);
> -       struct device_node *np = pdev->dev.of_node;
>
> -       if (!np)
> -               return;
> -
> -       if (of_device_is_compatible(np, "fsl,p2020-rev1-esdhc"))
> +       if (device_is_compatible(dev, "fsl,p2020-rev1-esdhc"))
>                 host->quirks |= SDHCI_QUIRK_BROKEN_DMA;
>
> -       if (of_device_is_compatible(np, "fsl,p2020-esdhc") ||
> -           of_device_is_compatible(np, "fsl,p1010-esdhc") ||
> -           of_device_is_compatible(np, "fsl,t4240-esdhc") ||
> -           of_device_is_compatible(np, "fsl,mpc8536-esdhc"))
> +       if (device_is_compatible(dev, "fsl,p2020-esdhc") ||
> +           device_is_compatible(dev, "fsl,p1010-esdhc") ||
> +           device_is_compatible(dev, "fsl,t4240-esdhc") ||
> +           device_is_compatible(dev, "fsl,mpc8536-esdhc"))
>                 host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
>  }
>
> --
> 2.40.0.1.gaa8946217a0b
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-10-10 14:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-06 10:58 [PATCH v1 1/2] mmc: sdhci-pltfm: Drop unnecessary error messages in sdhci_pltfm_init() Andy Shevchenko
2023-10-06 10:58 ` [PATCH v1 2/2] mmc: sdhci-pltfm: Make driver OF independent Andy Shevchenko
2023-10-09 16:58   ` Adrian Hunter
2023-10-10 14:27   ` Ulf Hansson
2023-10-09 16:35 ` [PATCH v1 1/2] mmc: sdhci-pltfm: Drop unnecessary error messages in sdhci_pltfm_init() Adrian Hunter
2023-10-10 14:27 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox