mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mmc: cavium-octeon: Use devm_platform_ioremap_resource() in octeon_mmc_probe()
@ 2019-09-18 12:28 Markus Elfring
  2019-10-03 10:01 ` Ulf Hansson
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2019-09-18 12:28 UTC (permalink / raw)
  To: linux-mmc, David Daney, Jan Glauber, Steven J. Hill, Ulf Hansson
  Cc: LKML, kernel-janitors, Bartosz Golaszewski, Himanshu Jha

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 18 Sep 2019 14:20:34 +0200

Simplify this function implementation by using a known wrapper function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/mmc/host/cavium-octeon.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/cavium-octeon.c b/drivers/mmc/host/cavium-octeon.c
index 22aded1065ae..916746c6c2c7 100644
--- a/drivers/mmc/host/cavium-octeon.c
+++ b/drivers/mmc/host/cavium-octeon.c
@@ -148,7 +148,6 @@ static int octeon_mmc_probe(struct platform_device *pdev)
 {
 	struct device_node *cn, *node = pdev->dev.of_node;
 	struct cvm_mmc_host *host;
-	struct resource	*res;
 	void __iomem *base;
 	int mmc_irq[9];
 	int i, ret = 0;
@@ -205,23 +204,13 @@ static int octeon_mmc_probe(struct platform_device *pdev)

 	host->last_slot = -1;

-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(&pdev->dev, "Platform resource[0] is missing\n");
-		return -ENXIO;
-	}
-	base = devm_ioremap_resource(&pdev->dev, res);
+	base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(base))
 		return PTR_ERR(base);
 	host->base = (void __iomem *)base;
 	host->reg_off = 0;

-	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	if (!res) {
-		dev_err(&pdev->dev, "Platform resource[1] is missing\n");
-		return -EINVAL;
-	}
-	base = devm_ioremap_resource(&pdev->dev, res);
+	base = devm_platform_ioremap_resource(pdev, 1);
 	if (IS_ERR(base))
 		return PTR_ERR(base);
 	host->dma_base = (void __iomem *)base;
--
2.23.0


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

* Re: [PATCH] mmc: cavium-octeon: Use devm_platform_ioremap_resource() in octeon_mmc_probe()
  2019-09-18 12:28 [PATCH] mmc: cavium-octeon: Use devm_platform_ioremap_resource() in octeon_mmc_probe() Markus Elfring
@ 2019-10-03 10:01 ` Ulf Hansson
  0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2019-10-03 10:01 UTC (permalink / raw)
  To: Markus Elfring
  Cc: linux-mmc, David Daney, Jan Glauber, Steven J. Hill, LKML,
	kernel-janitors, Bartosz Golaszewski, Himanshu Jha

On Wed, 18 Sep 2019 at 14:28, Markus Elfring <Markus.Elfring@web.de> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 18 Sep 2019 14:20:34 +0200
>
> Simplify this function implementation by using a known wrapper function.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/cavium-octeon.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/mmc/host/cavium-octeon.c b/drivers/mmc/host/cavium-octeon.c
> index 22aded1065ae..916746c6c2c7 100644
> --- a/drivers/mmc/host/cavium-octeon.c
> +++ b/drivers/mmc/host/cavium-octeon.c
> @@ -148,7 +148,6 @@ static int octeon_mmc_probe(struct platform_device *pdev)
>  {
>         struct device_node *cn, *node = pdev->dev.of_node;
>         struct cvm_mmc_host *host;
> -       struct resource *res;
>         void __iomem *base;
>         int mmc_irq[9];
>         int i, ret = 0;
> @@ -205,23 +204,13 @@ static int octeon_mmc_probe(struct platform_device *pdev)
>
>         host->last_slot = -1;
>
> -       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -       if (!res) {
> -               dev_err(&pdev->dev, "Platform resource[0] is missing\n");
> -               return -ENXIO;
> -       }
> -       base = devm_ioremap_resource(&pdev->dev, res);
> +       base = devm_platform_ioremap_resource(pdev, 0);
>         if (IS_ERR(base))
>                 return PTR_ERR(base);
>         host->base = (void __iomem *)base;
>         host->reg_off = 0;
>
> -       res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> -       if (!res) {
> -               dev_err(&pdev->dev, "Platform resource[1] is missing\n");
> -               return -EINVAL;
> -       }
> -       base = devm_ioremap_resource(&pdev->dev, res);
> +       base = devm_platform_ioremap_resource(pdev, 1);
>         if (IS_ERR(base))
>                 return PTR_ERR(base);
>         host->dma_base = (void __iomem *)base;
> --
> 2.23.0
>

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

end of thread, other threads:[~2019-10-03 10:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-18 12:28 [PATCH] mmc: cavium-octeon: Use devm_platform_ioremap_resource() in octeon_mmc_probe() Markus Elfring
2019-10-03 10:01 ` Ulf Hansson

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

all inboxes | Powered by JetHome®