Linux-i2c Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH -next] i2c: at91: Use devm_platform_get_and_ioremap_resource()
@ 2020-09-18  8:21 Wang ShaoBo
  2020-10-10 10:11 ` Codrin.Ciubotariu
  0 siblings, 1 reply; 2+ messages in thread
From: Wang ShaoBo @ 2020-09-18  8:21 UTC (permalink / raw)
  Cc: cj.chengjian, huawei.libin, wsa, codrin.ciubotariu, linux-i2c,
	linux-kernel, linux-arm-kernel

Make use of devm_platform_get_and_ioremap_resource() provided by
driver core platform instead of duplicated analogue.

Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>
---
 drivers/i2c/busses/i2c-at91-core.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/i2c/busses/i2c-at91-core.c b/drivers/i2c/busses/i2c-at91-core.c
index e14edd236108..5b7781302852 100644
--- a/drivers/i2c/busses/i2c-at91-core.c
+++ b/drivers/i2c/busses/i2c-at91-core.c
@@ -207,19 +207,16 @@ static int at91_twi_probe(struct platform_device *pdev)
 
 	dev->dev = &pdev->dev;
 
-	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!mem)
-		return -ENODEV;
+	dev->base = devm_platform_get_and_ioremap_resource(pdev, 0, &mem);
+	if (IS_ERR(dev->base))
+		return PTR_ERR(dev->base);
+
 	phy_addr = mem->start;
 
 	dev->pdata = at91_twi_get_driver_data(pdev);
 	if (!dev->pdata)
 		return -ENODEV;
 
-	dev->base = devm_ioremap_resource(&pdev->dev, mem);
-	if (IS_ERR(dev->base))
-		return PTR_ERR(dev->base);
-
 	dev->irq = platform_get_irq(pdev, 0);
 	if (dev->irq < 0)
 		return dev->irq;
-- 
2.17.1


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

* Re: [PATCH -next] i2c: at91: Use devm_platform_get_and_ioremap_resource()
  2020-09-18  8:21 [PATCH -next] i2c: at91: Use devm_platform_get_and_ioremap_resource() Wang ShaoBo
@ 2020-10-10 10:11 ` Codrin.Ciubotariu
  0 siblings, 0 replies; 2+ messages in thread
From: Codrin.Ciubotariu @ 2020-10-10 10:11 UTC (permalink / raw)
  To: bobo.shaobowang
  Cc: cj.chengjian, huawei.libin, wsa, linux-i2c, linux-kernel,
	linux-arm-kernel

On 18.09.2020 11:21, Wang ShaoBo wrote:
> Make use of devm_platform_get_and_ioremap_resource() provided by
> driver core platform instead of duplicated analogue.
> 
> Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>

Reviewed-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>

Thanks!

> ---
>   drivers/i2c/busses/i2c-at91-core.c | 11 ++++-------
>   1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-at91-core.c b/drivers/i2c/busses/i2c-at91-core.c
> index e14edd236108..5b7781302852 100644
> --- a/drivers/i2c/busses/i2c-at91-core.c
> +++ b/drivers/i2c/busses/i2c-at91-core.c
> @@ -207,19 +207,16 @@ static int at91_twi_probe(struct platform_device *pdev)
> 
>          dev->dev = &pdev->dev;
> 
> -       mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -       if (!mem)
> -               return -ENODEV;
> +       dev->base = devm_platform_get_and_ioremap_resource(pdev, 0, &mem);
> +       if (IS_ERR(dev->base))
> +               return PTR_ERR(dev->base);
> +
>          phy_addr = mem->start;
> 
>          dev->pdata = at91_twi_get_driver_data(pdev);
>          if (!dev->pdata)
>                  return -ENODEV;
> 
> -       dev->base = devm_ioremap_resource(&pdev->dev, mem);
> -       if (IS_ERR(dev->base))
> -               return PTR_ERR(dev->base);
> -
>          dev->irq = platform_get_irq(pdev, 0);
>          if (dev->irq < 0)
>                  return dev->irq;
> --
> 2.17.1
> 


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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18  8:21 [PATCH -next] i2c: at91: Use devm_platform_get_and_ioremap_resource() Wang ShaoBo
2020-10-10 10:11 ` Codrin.Ciubotariu

Linux-i2c Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-i2c/0 linux-i2c/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-i2c linux-i2c/ https://lore.kernel.org/linux-i2c \
		linux-i2c@vger.kernel.org
	public-inbox-index linux-i2c

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-i2c


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git