clocksource: do some cleanup
v2 cover clocksource: do some cleanup
1. convert to devm_platform_ioremap_resource api
2. switch to platform_get_irq
3. a small fix
v2:
-split changes to two patch
Yangtao Li (4):
clocksource: em_sti: convert to devm_platform_ioremap_resource
clocksource: em_sti: fix variable declaration in em_sti_probe
clocksource: timer-ti-dm: convert to devm_platform_ioremap_resource
clocksource: timer-ti-dm: switch to platform_get_irq
drivers/clocksource/em_sti.c | 7 ++----- drivers/clocksource/timer-ti-dm.c | 18 ++++-------------- 2 files changed, 6 insertions(+), 19 deletions(-)
Signature · 1 line
2.17.1
PATCH v2 1/4 clocksource: em_sti: convert to devm_platform_ioremap_resource
Use devm_platform_ioremap_resource() to simplify code, which wraps 'platform_get_resource' and 'devm_ioremap_resource' in a single helper.
--- drivers/clocksource/em_sti.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/clocksource/em_sti.c +1 -3
@@ -279,7 +279,6 @@ 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;
@@ -295,8 +294,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
[tip: timers/core] clocksource/drivers/em_sti: Convert to devm_platform_ioremap_resource
The following commit has been merged into the timers/core branch of tip:
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 9a97b2fb070d497c683aed9fb86b7ec5245cea86 Gitweb: https://git.kernel.org/tip/9a97b2fb070d497c683aed9fb86b7ec5245cea86 Author: Yangtao Li <[email protected]> AuthorDate: Sat, 21 Dec 2019 17:30:24 Committer: Daniel Lezcano <[email protected]> CommitterDate: Thu, 16 Jan 2020 19:06:57 +01:00
clocksource/drivers/em_sti: Convert to devm_platform_ioremap_resource
Use devm_platform_ioremap_resource() to simplify code, which wraps 'platform_get_resource' and 'devm_ioremap_resource' in a single helper.
--- drivers/clocksource/em_sti.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/clocksource/em_sti.c +1 -3
@@ -279,7 +279,6 @@ 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;
@@ -295,8 +294,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);
PATCH v2 2/4 clocksource: em_sti: fix variable declaration in em_sti_probe
In reply to Yangtao Li'irq' and 'ret' are variables of the same type and there is no need to use two lines.
--- drivers/clocksource/em_sti.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/clocksource/em_sti.c +1 -2
@@ -279,8 +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; -int irq; -int ret; +int irq, ret; p =devm_kzalloc (&pdev->dev,sizeof (*p),GFP_KERNEL );if (p ==NULL )
Signature · 1 line
2.17.1
[tip: timers/core] clocksource/drivers/em_sti: Fix variable declaration in em_sti_probe
The following commit has been merged into the timers/core branch of tip:
The following commit has been merged into the timers/core branch of tip:
Commit-ID: ba25322edd600300e55cd58eb7fbdf9cbdc5a82d Gitweb: https://git.kernel.org/tip/ba25322edd600300e55cd58eb7fbdf9cbdc5a82d Author: Yangtao Li <[email protected]> AuthorDate: Sat, 21 Dec 2019 17:30:25 Committer: Daniel Lezcano <[email protected]> CommitterDate: Thu, 16 Jan 2020 19:06:57 +01:00
clocksource/drivers/em_sti: Fix variable declaration in em_sti_probe
'irq' and 'ret' are variables of the same type and there is no need to use two lines.
--- drivers/clocksource/em_sti.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/clocksource/em_sti.c +1 -2
@@ -279,8 +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; -int irq; -int ret; +int irq, ret; p =devm_kzalloc (&pdev->dev,sizeof (*p),GFP_KERNEL );if (p ==NULL )
PATCH v2 3/4 clocksource: timer-ti-dm: convert to devm_platform_ioremap_resource
In reply to Yangtao LiUse devm_platform_ioremap_resource() to simplify code, which wraps 'platform_get_resource' and 'devm_ioremap_resource' in a single helper.
--- 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
[tip: timers/core] clocksource/drivers/timer-ti-dm: Convert to devm_platform_ioremap_resource
The following commit has been merged into the timers/core branch of tip:
The following commit has been merged into the timers/core branch of tip:
Commit-ID: cdab83f9d0fb13926f6633f20c3327545fd6f70f Gitweb: https://git.kernel.org/tip/cdab83f9d0fb13926f6633f20c3327545fd6f70f Author: Yangtao Li <[email protected]> AuthorDate: Sat, 21 Dec 2019 17:30:26 Committer: Daniel Lezcano <[email protected]> CommitterDate: Thu, 16 Jan 2020 19:06:57 +01:00
clocksource/drivers/timer-ti-dm: Convert to devm_platform_ioremap_resource
Use devm_platform_ioremap_resource() to simplify code, which wraps 'platform_get_resource' and 'devm_ioremap_resource' in a single helper.
--- 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);
PATCH v2 4/4 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
[tip: timers/core] clocksource/drivers/timer-ti-dm: Switch to platform_get_irq
The following commit has been merged into the timers/core branch of tip:
The following commit has been merged into the timers/core branch of tip:
Commit-ID: bc83caddf17bd592cc19887e252c4ba416484d79 Gitweb: https://git.kernel.org/tip/bc83caddf17bd592cc19887e252c4ba416484d79 Author: Yangtao Li <[email protected]> AuthorDate: Sat, 21 Dec 2019 17:30:27 Committer: Daniel Lezcano <[email protected]> CommitterDate: Thu, 16 Jan 2020 19:06:57 +01:00
clocksource/drivers/timer-ti-dm: Switch to platform_get_irq
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.
--- 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);
Daniel Lezcano
AppliedQuoted 13 lines · Yangtao Li
1. convert to
devm_platform_ioremap_resourceapi
2. switch toplatform_get_irq
3. a small fixv2:
-split changes to two patchYangtao Li (4):
clocksource:em_sti: convert todevm_platform_ioremap_resource
clocksource:em_sti: fix variable declaration inem_sti_probe
clocksource: timer-ti-dm: convert todevm_platform_ioremap_resource
clocksource: timer-ti-dm: switch toplatform_get_irq
Quoted 3 lines
drivers/clocksource/em_sti.c | 7 ++----- drivers/clocksource/timer-ti-dm.c | 18 ++++-------------- 2 files changed, 6 insertions(+), 19 deletions(-)
Applied, thanks.
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