public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] clocksource: em_sti: convert to devm_platform_ioremap_resource
@ 2019-12-15 15:17 Yangtao Li
  2019-12-15 15:17 ` [PATCH 2/3] clocksource: timer-ti-dm: " Yangtao Li
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Yangtao Li @ 2019-12-15 15:17 UTC (permalink / raw)
  To: daniel.lezcano, tglx; +Cc: linux-kernel, Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.
BTW, do another small cleanup.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
 drivers/clocksource/em_sti.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/clocksource/em_sti.c b/drivers/clocksource/em_sti.c
index 9039df4f90e2..ab190dffb1ed 100644
--- a/drivers/clocksource/em_sti.c
+++ b/drivers/clocksource/em_sti.c
@@ -279,9 +279,7 @@ static void em_sti_register_clockevent(struct em_sti_priv *p)
 static int em_sti_probe(struct platform_device *pdev)
 {
 	struct em_sti_priv *p;
-	struct resource *res;
-	int irq;
-	int ret;
+	int irq, ret;
 
 	p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
 	if (p == NULL)
@@ -295,8 +293,7 @@ static int em_sti_probe(struct platform_device *pdev)
 		return irq;
 
 	/* map memory, let base point to the STI instance */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	p->base = devm_ioremap_resource(&pdev->dev, res);
+	p->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(p->base))
 		return PTR_ERR(p->base);
 
-- 
2.17.1


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

* [PATCH 2/3] clocksource: timer-ti-dm: convert to devm_platform_ioremap_resource
  2019-12-15 15:17 [PATCH 1/3] clocksource: em_sti: convert to devm_platform_ioremap_resource Yangtao Li
@ 2019-12-15 15:17 ` Yangtao Li
  2019-12-15 15:17 ` [PATCH 3/3] clocksource: timer-ti-dm: switch to platform_get_irq Yangtao Li
  2019-12-16 13:44 ` [PATCH 1/3] clocksource: em_sti: convert to devm_platform_ioremap_resource Daniel Lezcano
  2 siblings, 0 replies; 6+ messages in thread
From: Yangtao Li @ 2019-12-15 15:17 UTC (permalink / raw)
  To: daniel.lezcano, tglx; +Cc: linux-kernel, Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
 drivers/clocksource/timer-ti-dm.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/clocksource/timer-ti-dm.c b/drivers/clocksource/timer-ti-dm.c
index 5394d9dbdfbc..aa2ede266edf 100644
--- a/drivers/clocksource/timer-ti-dm.c
+++ b/drivers/clocksource/timer-ti-dm.c
@@ -780,7 +780,7 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
 {
 	unsigned long flags;
 	struct omap_dm_timer *timer;
-	struct resource *mem, *irq;
+	struct resource *irq;
 	struct device *dev = &pdev->dev;
 	const struct dmtimer_platform_data *pdata;
 	int ret;
@@ -802,18 +802,12 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (unlikely(!mem)) {
-		dev_err(dev, "%s: no memory resource.\n", __func__);
-		return -ENODEV;
-	}
-
 	timer = devm_kzalloc(dev, sizeof(*timer), GFP_KERNEL);
 	if (!timer)
 		return  -ENOMEM;
 
 	timer->fclk = ERR_PTR(-ENODEV);
-	timer->io_base = devm_ioremap_resource(dev, mem);
+	timer->io_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(timer->io_base))
 		return PTR_ERR(timer->io_base);
 
-- 
2.17.1


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

* [PATCH 3/3] clocksource: timer-ti-dm: switch to platform_get_irq
  2019-12-15 15:17 [PATCH 1/3] clocksource: em_sti: convert to devm_platform_ioremap_resource Yangtao Li
  2019-12-15 15:17 ` [PATCH 2/3] clocksource: timer-ti-dm: " Yangtao Li
@ 2019-12-15 15:17 ` Yangtao Li
  2019-12-16 13:44 ` [PATCH 1/3] clocksource: em_sti: convert to devm_platform_ioremap_resource Daniel Lezcano
  2 siblings, 0 replies; 6+ messages in thread
From: Yangtao Li @ 2019-12-15 15:17 UTC (permalink / raw)
  To: daniel.lezcano, tglx; +Cc: linux-kernel, Yangtao Li

platform_get_resource(pdev, IORESOURCE_IRQ) is not recommended for
requesting IRQ's resources, as they can be not ready yet. Using
platform_get_irq() instead is preferred for getting IRQ even if it
was not retrieved earlier.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
 drivers/clocksource/timer-ti-dm.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/clocksource/timer-ti-dm.c b/drivers/clocksource/timer-ti-dm.c
index aa2ede266edf..bd16efb2740b 100644
--- a/drivers/clocksource/timer-ti-dm.c
+++ b/drivers/clocksource/timer-ti-dm.c
@@ -780,7 +780,6 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
 {
 	unsigned long flags;
 	struct omap_dm_timer *timer;
-	struct resource *irq;
 	struct device *dev = &pdev->dev;
 	const struct dmtimer_platform_data *pdata;
 	int ret;
@@ -796,11 +795,9 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (unlikely(!irq)) {
-		dev_err(dev, "%s: no IRQ resource.\n", __func__);
-		return -ENODEV;
-	}
+	timer->irq = platform_get_irq(pdev, 0);
+	if (timer->irq < 0)
+		return timer->irq;
 
 	timer = devm_kzalloc(dev, sizeof(*timer), GFP_KERNEL);
 	if (!timer)
@@ -830,7 +827,6 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
 	if (pdata)
 		timer->errata = pdata->timer_errata;
 
-	timer->irq = irq->start;
 	timer->pdev = pdev;
 
 	pm_runtime_enable(dev);
-- 
2.17.1


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

* Re: [PATCH 1/3] clocksource: em_sti: convert to devm_platform_ioremap_resource
  2019-12-15 15:17 [PATCH 1/3] clocksource: em_sti: convert to devm_platform_ioremap_resource Yangtao Li
  2019-12-15 15:17 ` [PATCH 2/3] clocksource: timer-ti-dm: " Yangtao Li
  2019-12-15 15:17 ` [PATCH 3/3] clocksource: timer-ti-dm: switch to platform_get_irq Yangtao Li
@ 2019-12-16 13:44 ` Daniel Lezcano
  2019-12-16 15:27   ` Frank Lee
  2 siblings, 1 reply; 6+ messages in thread
From: Daniel Lezcano @ 2019-12-16 13:44 UTC (permalink / raw)
  To: Yangtao Li, tglx; +Cc: linux-kernel

On 15/12/2019 16:17, Yangtao Li wrote:
> Use devm_platform_ioremap_resource() to simplify code.

Even if the change is obvious, elaborate a bit the changelog.

> BTW, do another small cleanup.

Keep one change per patch.

> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> ---
>  drivers/clocksource/em_sti.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/clocksource/em_sti.c b/drivers/clocksource/em_sti.c
> index 9039df4f90e2..ab190dffb1ed 100644
> --- a/drivers/clocksource/em_sti.c
> +++ b/drivers/clocksource/em_sti.c
> @@ -279,9 +279,7 @@ static void em_sti_register_clockevent(struct em_sti_priv *p)
>  static int em_sti_probe(struct platform_device *pdev)
>  {
>  	struct em_sti_priv *p;
> -	struct resource *res;
> -	int irq;
> -	int ret;
> +	int irq, ret;
>  
>  	p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
>  	if (p == NULL)
> @@ -295,8 +293,7 @@ static int em_sti_probe(struct platform_device *pdev)
>  		return irq;
>  
>  	/* map memory, let base point to the STI instance */
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	p->base = devm_ioremap_resource(&pdev->dev, res);
> +	p->base = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(p->base))
>  		return PTR_ERR(p->base);
>  
> 


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* Re: [PATCH 1/3] clocksource: em_sti: convert to devm_platform_ioremap_resource
  2019-12-16 13:44 ` [PATCH 1/3] clocksource: em_sti: convert to devm_platform_ioremap_resource Daniel Lezcano
@ 2019-12-16 15:27   ` Frank Lee
  2019-12-16 15:40     ` Daniel Lezcano
  0 siblings, 1 reply; 6+ messages in thread
From: Frank Lee @ 2019-12-16 15:27 UTC (permalink / raw)
  To: Daniel Lezcano; +Cc: tglx, Linux Kernel Mailing List

On Mon, Dec 16, 2019 at 9:44 PM Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>
> On 15/12/2019 16:17, Yangtao Li wrote:
> > Use devm_platform_ioremap_resource() to simplify code.
>
> Even if the change is obvious, elaborate a bit the changelog.
>
> > BTW, do another small cleanup.
>
> Keep one change per patch.

OK... My fault.

Any comments on the other two?

MBR,
Yangtao

>
> > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> > ---
> >  drivers/clocksource/em_sti.c | 7 ++-----
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/clocksource/em_sti.c b/drivers/clocksource/em_sti.c
> > index 9039df4f90e2..ab190dffb1ed 100644
> > --- a/drivers/clocksource/em_sti.c
> > +++ b/drivers/clocksource/em_sti.c
> > @@ -279,9 +279,7 @@ static void em_sti_register_clockevent(struct em_sti_priv *p)
> >  static int em_sti_probe(struct platform_device *pdev)
> >  {
> >       struct em_sti_priv *p;
> > -     struct resource *res;
> > -     int irq;
> > -     int ret;
> > +     int irq, ret;
> >
> >       p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
> >       if (p == NULL)
> > @@ -295,8 +293,7 @@ static int em_sti_probe(struct platform_device *pdev)
> >               return irq;
> >
> >       /* map memory, let base point to the STI instance */
> > -     res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > -     p->base = devm_ioremap_resource(&pdev->dev, res);
> > +     p->base = devm_platform_ioremap_resource(pdev, 0);
> >       if (IS_ERR(p->base))
> >               return PTR_ERR(p->base);
> >
> >
>
>
> --
>  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
>
> Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
> <http://twitter.com/#!/linaroorg> Twitter |
> <http://www.linaro.org/linaro-blog/> Blog
>

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

* Re: [PATCH 1/3] clocksource: em_sti: convert to devm_platform_ioremap_resource
  2019-12-16 15:27   ` Frank Lee
@ 2019-12-16 15:40     ` Daniel Lezcano
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Lezcano @ 2019-12-16 15:40 UTC (permalink / raw)
  To: Frank Lee; +Cc: tglx, Linux Kernel Mailing List

On 16/12/2019 16:27, Frank Lee wrote:
> On Mon, Dec 16, 2019 at 9:44 PM Daniel Lezcano
> <daniel.lezcano@linaro.org> wrote:
>>
>> On 15/12/2019 16:17, Yangtao Li wrote:
>>> Use devm_platform_ioremap_resource() to simplify code.
>>
>> Even if the change is obvious, elaborate a bit the changelog.
>>
>>> BTW, do another small cleanup.
>>
>> Keep one change per patch.
> 
> OK... My fault.
> 
> Any comments on the other two?

They are fine for me.

-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

end of thread, other threads:[~2019-12-16 15:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-15 15:17 [PATCH 1/3] clocksource: em_sti: convert to devm_platform_ioremap_resource Yangtao Li
2019-12-15 15:17 ` [PATCH 2/3] clocksource: timer-ti-dm: " Yangtao Li
2019-12-15 15:17 ` [PATCH 3/3] clocksource: timer-ti-dm: switch to platform_get_irq Yangtao Li
2019-12-16 13:44 ` [PATCH 1/3] clocksource: em_sti: convert to devm_platform_ioremap_resource Daniel Lezcano
2019-12-16 15:27   ` Frank Lee
2019-12-16 15:40     ` Daniel Lezcano

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