clocksource: em_sti: convert to devm_platform_ioremap_resource
PATCH 1/3 clocksource: em_sti: convert to devm_platform_ioremap_resource
Use devm_platform_ioremap_resource() to simplify code. BTW, do another small cleanup.
--- drivers/clocksource/em_sti.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/clocksource/em_sti.c +2 -5
@@ -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);
Signature · 1 line
2.17.1
PATCH 2/3 clocksource: timer-ti-dm: convert to devm_platform_ioremap_resource
Use devm_platform_ioremap_resource() to simplify code.
--- drivers/clocksource/timer-ti-dm.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/clocksource/timer-ti-dm.c +2 -8
@@ -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);
Signature · 1 line
2.17.1
PATCH 3/3 clocksource: timer-ti-dm: switch to platform_get_irq
In reply to Yangtao Liplatform_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.
--- drivers/clocksource/timer-ti-dm.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/clocksource/timer-ti-dm.c +3 -7
@@ -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);
Signature · 1 line
2.17.1
Quoted 1 line · Yangtao Li
Use
devm_platform_ioremap_resource()to simplify code.
Even if the change is obvious, elaborate a bit the changelog.
Quoted 1 line
BTW, do another small cleanup.
Keep one change per patch.
Quoted 31 lines
Signed-off-by Yangtao Li <[email protected]>--- drivers/clocksource/em_sti.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/clocksource/em_sti.c +2
-5@@ -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);
Signature · 5 lines
<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
Quoted 9 lines · Daniel Lezcano
Quoted 1 line · Yangtao Li
Use
devm_platform_ioremap_resource()to simplify code.Even if the change is obvious, elaborate a bit the changelog.
Quoted 1 line
BTW, do another small cleanup.
Keep one change per patch.
OK... My fault.
Any comments on the other two?
MBR,
Yangtao
Quoted 41 lines
Quoted 23 lines
Signed-off-by Yangtao Li <[email protected]>--- drivers/clocksource/em_sti.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/clocksource/em_sti.c +1
-3@@ -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 )drivers/clocksource/em_sti.c static int em_sti_probe(struct platform_device *pdev) · line 299
Quoted 9 lines
drivers/clocksource/em_sti.c +1
-2@@ -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 SoCsFollow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Quoted 8 lines · Frank Lee
Quoted 6 lines · Daniel Lezcano
Quoted 1 line · Yangtao Li
Use
devm_platform_ioremap_resource()to simplify code.Even if the change is obvious, elaborate a bit the changelog.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
BTW, do another small cleanup.
Keep one change per patch.
OK... My fault.
Any comments on the other two?
They are fine for me.
Signature · 5 lines
<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