* [PATCH 1/3] watchdog: ep93xx_wdt: Use devm_ioremap_resource()
@ 2014-02-11 12:41 Jingoo Han
2014-02-11 12:44 ` [PATCH 2/3] watchdog: omap_wdt: " Jingoo Han
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Jingoo Han @ 2014-02-11 12:41 UTC (permalink / raw)
To: 'Wim Van Sebroeck'
Cc: linux-watchdog, 'Guenter Roeck', 'Jingoo Han',
'H Hartley Sweeten'
Use devm_ioremap_resource() in order to make the code simpler,
and remove redundant return value check of platform_get_resource()
because the value is checked by devm_ioremap_resource().
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
drivers/watchdog/ep93xx_wdt.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/drivers/watchdog/ep93xx_wdt.c b/drivers/watchdog/ep93xx_wdt.c
index d1d07f2..5e4f3de 100644
--- a/drivers/watchdog/ep93xx_wdt.c
+++ b/drivers/watchdog/ep93xx_wdt.c
@@ -118,16 +118,9 @@ static int ep93xx_wdt_probe(struct platform_device *pdev)
int err;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENXIO;
-
- if (!devm_request_mem_region(&pdev->dev, res->start,
- resource_size(res), pdev->name))
- return -EBUSY;
-
- mmio_base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
- if (!mmio_base)
- return -ENXIO;
+ mmio_base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(mmio_base))
+ return PTR_ERR(mmio_base);
if (timeout < 1 || timeout > 3600) {
timeout = WDT_TIMEOUT;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/3] watchdog: omap_wdt: Use devm_ioremap_resource()
2014-02-11 12:41 [PATCH 1/3] watchdog: ep93xx_wdt: Use devm_ioremap_resource() Jingoo Han
@ 2014-02-11 12:44 ` Jingoo Han
2014-02-11 20:30 ` Guenter Roeck
` (2 more replies)
2014-02-11 12:45 ` [PATCH 3/3] watchdog: sp805_wdt: " Jingoo Han
` (2 subsequent siblings)
3 siblings, 3 replies; 10+ messages in thread
From: Jingoo Han @ 2014-02-11 12:44 UTC (permalink / raw)
To: 'Wim Van Sebroeck'
Cc: linux-watchdog, 'Guenter Roeck', 'Jingoo Han',
'Aaro Koskinen'
Use devm_ioremap_resource() in order to make the code simpler,
and remove 'struct resource *mem' from 'struct omap_wdt_dev'
and omap_wdt_probe(), resplectively. because the 'mem' variables
are not used anymore. Also the redundant return value check of
platform_get_resource() is removed, because the value is checked
by devm_ioremap_resource().
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
drivers/watchdog/omap_wdt.c | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 09cf013..40269dd 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -58,7 +58,6 @@ struct omap_wdt_dev {
void __iomem *base; /* physical */
struct device *dev;
bool omap_wdt_users;
- struct resource *mem;
int wdt_trgr_pattern;
struct mutex lock; /* to avoid races with PM */
};
@@ -207,7 +206,7 @@ static int omap_wdt_probe(struct platform_device *pdev)
{
struct omap_wd_timer_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct watchdog_device *omap_wdt;
- struct resource *res, *mem;
+ struct resource *res;
struct omap_wdt_dev *wdev;
u32 rs;
int ret;
@@ -216,29 +215,20 @@ static int omap_wdt_probe(struct platform_device *pdev)
if (!omap_wdt)
return -ENOMEM;
- /* reserve static register mappings */
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENOENT;
-
- mem = devm_request_mem_region(&pdev->dev, res->start,
- resource_size(res), pdev->name);
- if (!mem)
- return -EBUSY;
-
wdev = devm_kzalloc(&pdev->dev, sizeof(*wdev), GFP_KERNEL);
if (!wdev)
return -ENOMEM;
wdev->omap_wdt_users = false;
- wdev->mem = mem;
wdev->dev = &pdev->dev;
wdev->wdt_trgr_pattern = 0x1234;
mutex_init(&wdev->lock);
- wdev->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
- if (!wdev->base)
- return -ENOMEM;
+ /* reserve static register mappings */
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ wdev->base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(wdev->base))
+ return PTR_ERR(wdev->base);
omap_wdt->info = &omap_wdt_info;
omap_wdt->ops = &omap_wdt_ops;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/3] watchdog: sp805_wdt: Use devm_ioremap_resource()
2014-02-11 12:41 [PATCH 1/3] watchdog: ep93xx_wdt: Use devm_ioremap_resource() Jingoo Han
2014-02-11 12:44 ` [PATCH 2/3] watchdog: omap_wdt: " Jingoo Han
@ 2014-02-11 12:45 ` Jingoo Han
2014-02-11 20:31 ` Guenter Roeck
2014-02-24 19:55 ` Wim Van Sebroeck
2014-02-11 20:29 ` [PATCH 1/3] watchdog: ep93xx_wdt: " Guenter Roeck
2014-02-24 19:55 ` Wim Van Sebroeck
3 siblings, 2 replies; 10+ messages in thread
From: Jingoo Han @ 2014-02-11 12:45 UTC (permalink / raw)
To: 'Wim Van Sebroeck'
Cc: linux-watchdog, 'Guenter Roeck', 'Jingoo Han',
'Michal Simek', 'Viresh Kumar'
Use devm_ioremap_resource() in order to make the code simpler.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
drivers/watchdog/sp805_wdt.c | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
index 3f786ce..cf35036 100644
--- a/drivers/watchdog/sp805_wdt.c
+++ b/drivers/watchdog/sp805_wdt.c
@@ -209,13 +209,6 @@ sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id)
struct sp805_wdt *wdt;
int ret = 0;
- if (!devm_request_mem_region(&adev->dev, adev->res.start,
- resource_size(&adev->res), "sp805_wdt")) {
- dev_warn(&adev->dev, "Failed to get memory region resource\n");
- ret = -ENOENT;
- goto err;
- }
-
wdt = devm_kzalloc(&adev->dev, sizeof(*wdt), GFP_KERNEL);
if (!wdt) {
dev_warn(&adev->dev, "Kzalloc failed\n");
@@ -223,13 +216,9 @@ sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id)
goto err;
}
- wdt->base = devm_ioremap(&adev->dev, adev->res.start,
- resource_size(&adev->res));
- if (!wdt->base) {
- ret = -ENOMEM;
- dev_warn(&adev->dev, "ioremap fail\n");
- goto err;
- }
+ wdt->base = devm_ioremap_resource(&adev->dev, &adev->res);
+ if (IS_ERR(wdt->base))
+ return PTR_ERR(wdt->base);
wdt->clk = devm_clk_get(&adev->dev, NULL);
if (IS_ERR(wdt->clk)) {
--
1.7.10.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] watchdog: ep93xx_wdt: Use devm_ioremap_resource()
2014-02-11 12:41 [PATCH 1/3] watchdog: ep93xx_wdt: Use devm_ioremap_resource() Jingoo Han
2014-02-11 12:44 ` [PATCH 2/3] watchdog: omap_wdt: " Jingoo Han
2014-02-11 12:45 ` [PATCH 3/3] watchdog: sp805_wdt: " Jingoo Han
@ 2014-02-11 20:29 ` Guenter Roeck
2014-02-24 19:55 ` Wim Van Sebroeck
3 siblings, 0 replies; 10+ messages in thread
From: Guenter Roeck @ 2014-02-11 20:29 UTC (permalink / raw)
To: Jingoo Han
Cc: 'Wim Van Sebroeck', linux-watchdog,
'H Hartley Sweeten'
On Tue, Feb 11, 2014 at 09:41:54PM +0900, Jingoo Han wrote:
> Use devm_ioremap_resource() in order to make the code simpler,
> and remove redundant return value check of platform_get_resource()
> because the value is checked by devm_ioremap_resource().
>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] watchdog: omap_wdt: Use devm_ioremap_resource()
2014-02-11 12:44 ` [PATCH 2/3] watchdog: omap_wdt: " Jingoo Han
@ 2014-02-11 20:30 ` Guenter Roeck
2014-02-11 20:58 ` Aaro Koskinen
2014-02-24 19:55 ` Wim Van Sebroeck
2 siblings, 0 replies; 10+ messages in thread
From: Guenter Roeck @ 2014-02-11 20:30 UTC (permalink / raw)
To: Jingoo Han
Cc: 'Wim Van Sebroeck', linux-watchdog,
'Aaro Koskinen'
On Tue, Feb 11, 2014 at 09:44:12PM +0900, Jingoo Han wrote:
> Use devm_ioremap_resource() in order to make the code simpler,
> and remove 'struct resource *mem' from 'struct omap_wdt_dev'
> and omap_wdt_probe(), resplectively. because the 'mem' variables
> are not used anymore. Also the redundant return value check of
> platform_get_resource() is removed, because the value is checked
> by devm_ioremap_resource().
>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] watchdog: sp805_wdt: Use devm_ioremap_resource()
2014-02-11 12:45 ` [PATCH 3/3] watchdog: sp805_wdt: " Jingoo Han
@ 2014-02-11 20:31 ` Guenter Roeck
2014-02-24 19:55 ` Wim Van Sebroeck
1 sibling, 0 replies; 10+ messages in thread
From: Guenter Roeck @ 2014-02-11 20:31 UTC (permalink / raw)
To: Jingoo Han
Cc: 'Wim Van Sebroeck', linux-watchdog,
'Michal Simek', 'Viresh Kumar'
On Tue, Feb 11, 2014 at 09:45:56PM +0900, Jingoo Han wrote:
> Use devm_ioremap_resource() in order to make the code simpler.
>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] watchdog: omap_wdt: Use devm_ioremap_resource()
2014-02-11 12:44 ` [PATCH 2/3] watchdog: omap_wdt: " Jingoo Han
2014-02-11 20:30 ` Guenter Roeck
@ 2014-02-11 20:58 ` Aaro Koskinen
2014-02-24 19:55 ` Wim Van Sebroeck
2 siblings, 0 replies; 10+ messages in thread
From: Aaro Koskinen @ 2014-02-11 20:58 UTC (permalink / raw)
To: Jingoo Han
Cc: 'Wim Van Sebroeck', linux-watchdog,
'Guenter Roeck'
On Tue, Feb 11, 2014 at 09:44:12PM +0900, Jingoo Han wrote:
> Use devm_ioremap_resource() in order to make the code simpler,
> and remove 'struct resource *mem' from 'struct omap_wdt_dev'
> and omap_wdt_probe(), resplectively. because the 'mem' variables
> are not used anymore. Also the redundant return value check of
> platform_get_resource() is removed, because the value is checked
> by devm_ioremap_resource().
>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Aaro Koskinen <aaro.koskinen@iki.fi>
A.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] watchdog: ep93xx_wdt: Use devm_ioremap_resource()
2014-02-11 12:41 [PATCH 1/3] watchdog: ep93xx_wdt: Use devm_ioremap_resource() Jingoo Han
` (2 preceding siblings ...)
2014-02-11 20:29 ` [PATCH 1/3] watchdog: ep93xx_wdt: " Guenter Roeck
@ 2014-02-24 19:55 ` Wim Van Sebroeck
3 siblings, 0 replies; 10+ messages in thread
From: Wim Van Sebroeck @ 2014-02-24 19:55 UTC (permalink / raw)
To: Jingoo Han
Cc: linux-watchdog, 'Guenter Roeck',
'H Hartley Sweeten'
Hi Jingoo,
> Use devm_ioremap_resource() in order to make the code simpler,
> and remove redundant return value check of platform_get_resource()
> because the value is checked by devm_ioremap_resource().
>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> ---
> drivers/watchdog/ep93xx_wdt.c | 13 +++----------
> 1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/watchdog/ep93xx_wdt.c b/drivers/watchdog/ep93xx_wdt.c
> index d1d07f2..5e4f3de 100644
> --- a/drivers/watchdog/ep93xx_wdt.c
> +++ b/drivers/watchdog/ep93xx_wdt.c
> @@ -118,16 +118,9 @@ static int ep93xx_wdt_probe(struct platform_device *pdev)
> int err;
>
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (!res)
> - return -ENXIO;
> -
> - if (!devm_request_mem_region(&pdev->dev, res->start,
> - resource_size(res), pdev->name))
> - return -EBUSY;
> -
> - mmio_base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
> - if (!mmio_base)
> - return -ENXIO;
> + mmio_base = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(mmio_base))
> + return PTR_ERR(mmio_base);
>
> if (timeout < 1 || timeout > 3600) {
> timeout = WDT_TIMEOUT;
> --
> 1.7.10.4
>
>
This patch has been added to linux-watchdog-next.
Kind regards,
Wim.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] watchdog: omap_wdt: Use devm_ioremap_resource()
2014-02-11 12:44 ` [PATCH 2/3] watchdog: omap_wdt: " Jingoo Han
2014-02-11 20:30 ` Guenter Roeck
2014-02-11 20:58 ` Aaro Koskinen
@ 2014-02-24 19:55 ` Wim Van Sebroeck
2 siblings, 0 replies; 10+ messages in thread
From: Wim Van Sebroeck @ 2014-02-24 19:55 UTC (permalink / raw)
To: Jingoo Han
Cc: linux-watchdog, 'Guenter Roeck', 'Aaro Koskinen'
Hi Jingoo,
> Use devm_ioremap_resource() in order to make the code simpler,
> and remove 'struct resource *mem' from 'struct omap_wdt_dev'
> and omap_wdt_probe(), resplectively. because the 'mem' variables
> are not used anymore. Also the redundant return value check of
> platform_get_resource() is removed, because the value is checked
> by devm_ioremap_resource().
>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> ---
> drivers/watchdog/omap_wdt.c | 22 ++++++----------------
> 1 file changed, 6 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
> index 09cf013..40269dd 100644
> --- a/drivers/watchdog/omap_wdt.c
> +++ b/drivers/watchdog/omap_wdt.c
> @@ -58,7 +58,6 @@ struct omap_wdt_dev {
> void __iomem *base; /* physical */
> struct device *dev;
> bool omap_wdt_users;
> - struct resource *mem;
> int wdt_trgr_pattern;
> struct mutex lock; /* to avoid races with PM */
> };
> @@ -207,7 +206,7 @@ static int omap_wdt_probe(struct platform_device *pdev)
> {
> struct omap_wd_timer_platform_data *pdata = dev_get_platdata(&pdev->dev);
> struct watchdog_device *omap_wdt;
> - struct resource *res, *mem;
> + struct resource *res;
> struct omap_wdt_dev *wdev;
> u32 rs;
> int ret;
> @@ -216,29 +215,20 @@ static int omap_wdt_probe(struct platform_device *pdev)
> if (!omap_wdt)
> return -ENOMEM;
>
> - /* reserve static register mappings */
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (!res)
> - return -ENOENT;
> -
> - mem = devm_request_mem_region(&pdev->dev, res->start,
> - resource_size(res), pdev->name);
> - if (!mem)
> - return -EBUSY;
> -
> wdev = devm_kzalloc(&pdev->dev, sizeof(*wdev), GFP_KERNEL);
> if (!wdev)
> return -ENOMEM;
>
> wdev->omap_wdt_users = false;
> - wdev->mem = mem;
> wdev->dev = &pdev->dev;
> wdev->wdt_trgr_pattern = 0x1234;
> mutex_init(&wdev->lock);
>
> - wdev->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
> - if (!wdev->base)
> - return -ENOMEM;
> + /* reserve static register mappings */
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + wdev->base = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(wdev->base))
> + return PTR_ERR(wdev->base);
>
> omap_wdt->info = &omap_wdt_info;
> omap_wdt->ops = &omap_wdt_ops;
> --
> 1.7.10.4
>
>
This patch has been added to linux-watchdog-next.
Kind regards,
Wim.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] watchdog: sp805_wdt: Use devm_ioremap_resource()
2014-02-11 12:45 ` [PATCH 3/3] watchdog: sp805_wdt: " Jingoo Han
2014-02-11 20:31 ` Guenter Roeck
@ 2014-02-24 19:55 ` Wim Van Sebroeck
1 sibling, 0 replies; 10+ messages in thread
From: Wim Van Sebroeck @ 2014-02-24 19:55 UTC (permalink / raw)
To: Jingoo Han
Cc: linux-watchdog, 'Guenter Roeck', 'Michal Simek',
'Viresh Kumar'
Hi Jingoo,
> Use devm_ioremap_resource() in order to make the code simpler.
>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> ---
> drivers/watchdog/sp805_wdt.c | 17 +++--------------
> 1 file changed, 3 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
> index 3f786ce..cf35036 100644
> --- a/drivers/watchdog/sp805_wdt.c
> +++ b/drivers/watchdog/sp805_wdt.c
> @@ -209,13 +209,6 @@ sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id)
> struct sp805_wdt *wdt;
> int ret = 0;
>
> - if (!devm_request_mem_region(&adev->dev, adev->res.start,
> - resource_size(&adev->res), "sp805_wdt")) {
> - dev_warn(&adev->dev, "Failed to get memory region resource\n");
> - ret = -ENOENT;
> - goto err;
> - }
> -
> wdt = devm_kzalloc(&adev->dev, sizeof(*wdt), GFP_KERNEL);
> if (!wdt) {
> dev_warn(&adev->dev, "Kzalloc failed\n");
> @@ -223,13 +216,9 @@ sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id)
> goto err;
> }
>
> - wdt->base = devm_ioremap(&adev->dev, adev->res.start,
> - resource_size(&adev->res));
> - if (!wdt->base) {
> - ret = -ENOMEM;
> - dev_warn(&adev->dev, "ioremap fail\n");
> - goto err;
> - }
> + wdt->base = devm_ioremap_resource(&adev->dev, &adev->res);
> + if (IS_ERR(wdt->base))
> + return PTR_ERR(wdt->base);
>
> wdt->clk = devm_clk_get(&adev->dev, NULL);
> if (IS_ERR(wdt->clk)) {
> --
> 1.7.10.4
>
>
This patch has been added to linux-watchdog-next.
Kind regards,
Wim.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2014-02-24 19:55 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-11 12:41 [PATCH 1/3] watchdog: ep93xx_wdt: Use devm_ioremap_resource() Jingoo Han
2014-02-11 12:44 ` [PATCH 2/3] watchdog: omap_wdt: " Jingoo Han
2014-02-11 20:30 ` Guenter Roeck
2014-02-11 20:58 ` Aaro Koskinen
2014-02-24 19:55 ` Wim Van Sebroeck
2014-02-11 12:45 ` [PATCH 3/3] watchdog: sp805_wdt: " Jingoo Han
2014-02-11 20:31 ` Guenter Roeck
2014-02-24 19:55 ` Wim Van Sebroeck
2014-02-11 20:29 ` [PATCH 1/3] watchdog: ep93xx_wdt: " Guenter Roeck
2014-02-24 19:55 ` Wim Van Sebroeck
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.