All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] iio: adc: at91-sama5d2_adc: Use devm_platform_get_and_ioremap_resource()
@ 2020-09-18  8:28 ` Wang ShaoBo
  0 siblings, 0 replies; 4+ messages in thread
From: Wang ShaoBo @ 2020-09-18  8:28 UTC (permalink / raw)
  Cc: cj.chengjian, huawei.libin, Jonathan.Cameron, eugen.hristev,
	linux-iio, 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/iio/adc/at91-sama5d2_adc.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
index de9583d6cddd..ad7d9819f83c 100644
--- a/drivers/iio/adc/at91-sama5d2_adc.c
+++ b/drivers/iio/adc/at91-sama5d2_adc.c
@@ -1764,17 +1764,13 @@ static int at91_adc_probe(struct platform_device *pdev)
 	mutex_init(&st->lock);
 	INIT_WORK(&st->touch_st.workq, at91_adc_workq_handler);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		return -EINVAL;
+	st->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
+	if (IS_ERR(st->base))
+		return PTR_ERR(st->base);
 
 	/* if we plan to use DMA, we need the physical address of the regs */
 	st->dma_st.phys_addr = res->start;
 
-	st->base = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(st->base))
-		return PTR_ERR(st->base);
-
 	st->irq = platform_get_irq(pdev, 0);
 	if (st->irq <= 0) {
 		if (!st->irq)
-- 
2.17.1


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

* [PATCH -next] iio: adc: at91-sama5d2_adc: Use devm_platform_get_and_ioremap_resource()
@ 2020-09-18  8:28 ` Wang ShaoBo
  0 siblings, 0 replies; 4+ messages in thread
From: Wang ShaoBo @ 2020-09-18  8:28 UTC (permalink / raw)
  Cc: cj.chengjian, linux-iio, linux-kernel, huawei.libin,
	Jonathan.Cameron, eugen.hristev, 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/iio/adc/at91-sama5d2_adc.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
index de9583d6cddd..ad7d9819f83c 100644
--- a/drivers/iio/adc/at91-sama5d2_adc.c
+++ b/drivers/iio/adc/at91-sama5d2_adc.c
@@ -1764,17 +1764,13 @@ static int at91_adc_probe(struct platform_device *pdev)
 	mutex_init(&st->lock);
 	INIT_WORK(&st->touch_st.workq, at91_adc_workq_handler);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		return -EINVAL;
+	st->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
+	if (IS_ERR(st->base))
+		return PTR_ERR(st->base);
 
 	/* if we plan to use DMA, we need the physical address of the regs */
 	st->dma_st.phys_addr = res->start;
 
-	st->base = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(st->base))
-		return PTR_ERR(st->base);
-
 	st->irq = platform_get_irq(pdev, 0);
 	if (st->irq <= 0) {
 		if (!st->irq)
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH -next] iio: adc: at91-sama5d2_adc: Use devm_platform_get_and_ioremap_resource()
  2020-09-18  8:28 ` Wang ShaoBo
@ 2020-09-23 20:52   ` Jonathan Cameron
  -1 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2020-09-23 20:52 UTC (permalink / raw)
  To: Wang ShaoBo
  Cc: cj.chengjian, huawei.libin, Jonathan.Cameron, eugen.hristev,
	linux-iio, linux-kernel, linux-arm-kernel

On Fri, 18 Sep 2020 16:28:37 +0800
Wang ShaoBo <bobo.shaobowang@huawei.com> 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>

Hi,

Thanks.  As far as I can see this boilerplate removal with no
side effects, so applied to the togreg branch of iio.git and pushed out
as testing for the autobuilders to poke at it.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/at91-sama5d2_adc.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
> index de9583d6cddd..ad7d9819f83c 100644
> --- a/drivers/iio/adc/at91-sama5d2_adc.c
> +++ b/drivers/iio/adc/at91-sama5d2_adc.c
> @@ -1764,17 +1764,13 @@ static int at91_adc_probe(struct platform_device *pdev)
>  	mutex_init(&st->lock);
>  	INIT_WORK(&st->touch_st.workq, at91_adc_workq_handler);
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res)
> -		return -EINVAL;
> +	st->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
> +	if (IS_ERR(st->base))
> +		return PTR_ERR(st->base);
>  
>  	/* if we plan to use DMA, we need the physical address of the regs */
>  	st->dma_st.phys_addr = res->start;
>  
> -	st->base = devm_ioremap_resource(&pdev->dev, res);
> -	if (IS_ERR(st->base))
> -		return PTR_ERR(st->base);
> -
>  	st->irq = platform_get_irq(pdev, 0);
>  	if (st->irq <= 0) {
>  		if (!st->irq)


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

* Re: [PATCH -next] iio: adc: at91-sama5d2_adc: Use devm_platform_get_and_ioremap_resource()
@ 2020-09-23 20:52   ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2020-09-23 20:52 UTC (permalink / raw)
  To: Wang ShaoBo
  Cc: cj.chengjian, linux-iio, linux-kernel, huawei.libin,
	Jonathan.Cameron, eugen.hristev, linux-arm-kernel

On Fri, 18 Sep 2020 16:28:37 +0800
Wang ShaoBo <bobo.shaobowang@huawei.com> 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>

Hi,

Thanks.  As far as I can see this boilerplate removal with no
side effects, so applied to the togreg branch of iio.git and pushed out
as testing for the autobuilders to poke at it.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/at91-sama5d2_adc.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
> index de9583d6cddd..ad7d9819f83c 100644
> --- a/drivers/iio/adc/at91-sama5d2_adc.c
> +++ b/drivers/iio/adc/at91-sama5d2_adc.c
> @@ -1764,17 +1764,13 @@ static int at91_adc_probe(struct platform_device *pdev)
>  	mutex_init(&st->lock);
>  	INIT_WORK(&st->touch_st.workq, at91_adc_workq_handler);
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res)
> -		return -EINVAL;
> +	st->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
> +	if (IS_ERR(st->base))
> +		return PTR_ERR(st->base);
>  
>  	/* if we plan to use DMA, we need the physical address of the regs */
>  	st->dma_st.phys_addr = res->start;
>  
> -	st->base = devm_ioremap_resource(&pdev->dev, res);
> -	if (IS_ERR(st->base))
> -		return PTR_ERR(st->base);
> -
>  	st->irq = platform_get_irq(pdev, 0);
>  	if (st->irq <= 0) {
>  		if (!st->irq)


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-09-23 20:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18  8:28 [PATCH -next] iio: adc: at91-sama5d2_adc: Use devm_platform_get_and_ioremap_resource() Wang ShaoBo
2020-09-18  8:28 ` Wang ShaoBo
2020-09-23 20:52 ` Jonathan Cameron
2020-09-23 20:52   ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.