summaryrefslogtreecommitdiff
path: root/drivers/watchdog/nuc900_wdt.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-13 13:42:54 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-13 13:42:54 -0700
commit833e68340d108d88f4cb79b7d7223f6859d362ca (patch)
tree89f960431365ce2d47178c0620634b66979497fa /drivers/watchdog/nuc900_wdt.c
parentc55244137306b626bc64023fd7160985443205a7 (diff)
parentcce78da76601b64305c050f602767bf58cebcf5d (diff)
Merge git://www.linux-watchdog.org/linux-watchdog
Pull watchdog updates from Wim Van Sebroeck: - lots of devm_ conversions and cleanup - platform_set_drvdata cleanups - s3c2410: dev_err/dev_info + dev_pm_ops - watchdog_core: don't try to stop device if not running fix - wdrtas: use print_hex_dump - xilinx cleanups - orion_wdt fixes - softdog cleanup - hpwdt: check on UEFI bits - deletion of mpcore_wdt driver - addition of broadcom BCM2835 watchdog timer driver - addition of MEN A21 watcdog devices * git://www.linux-watchdog.org/linux-watchdog: (38 commits) watchdog: hpwdt: Add check for UEFI bits watchdog: softdog: remove replaceable ping operation watchdog: New watchdog driver for MEN A21 watchdogs Watchdog: fix clearing of the watchdog interrupt Watchdog: allow orion_wdt to be built for Dove watchdog: Add Broadcom BCM2835 watchdog timer driver watchdog: delete mpcore_wdt driver watchdog: xilinx: Setup the origin compatible string watchdog: xilinx: Fix driver header watchdog: wdrtas: don't use custom version of print_hex_dump watchdog: core: don't try to stop device if not running watchdog: jz4740: Pass device to clk_get watchdog: twl4030: Remove redundant platform_set_drvdata() watchdog: mpcore: Remove redundant platform_set_drvdata() watchdog: da9055: use platform_{get,set}_drvdata() watchdog: da9052: use platform_{get,set}_drvdata() watchdog: cpwd: use platform_{get,set}_drvdata() watchdog: s3c2410_wdt: convert s3c2410wdt to dev_pm_ops watchdog: s3c2410_wdt: use dev_err()/dev_info() instead of pr_err()/pr_info() watchdog: wm831x: use platform_{get,set}_drvdata() ...
Diffstat (limited to 'drivers/watchdog/nuc900_wdt.c')
-rw-r--r--drivers/watchdog/nuc900_wdt.c50
1 files changed, 11 insertions, 39 deletions
diff --git a/drivers/watchdog/nuc900_wdt.c b/drivers/watchdog/nuc900_wdt.c
index 04c45a102992..e2b6d2cf5c9d 100644
--- a/drivers/watchdog/nuc900_wdt.c
+++ b/drivers/watchdog/nuc900_wdt.c
@@ -61,7 +61,6 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started "
"(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
struct nuc900_wdt {
- struct resource *res;
struct clk *wdt_clock;
struct platform_device *pdev;
void __iomem *wdt_base;
@@ -244,9 +243,11 @@ static struct miscdevice nuc900wdt_miscdev = {
static int nuc900wdt_probe(struct platform_device *pdev)
{
+ struct resource *res;
int ret = 0;
- nuc900_wdt = kzalloc(sizeof(struct nuc900_wdt), GFP_KERNEL);
+ nuc900_wdt = devm_kzalloc(&pdev->dev, sizeof(*nuc900_wdt),
+ GFP_KERNEL);
if (!nuc900_wdt)
return -ENOMEM;
@@ -254,33 +255,20 @@ static int nuc900wdt_probe(struct platform_device *pdev)
spin_lock_init(&nuc900_wdt->wdt_lock);
- nuc900_wdt->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (nuc900_wdt->res == NULL) {
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (res == NULL) {
dev_err(&pdev->dev, "no memory resource specified\n");
- ret = -ENOENT;
- goto err_get;
+ return -ENOENT;
}
- if (!request_mem_region(nuc900_wdt->res->start,
- resource_size(nuc900_wdt->res), pdev->name)) {
- dev_err(&pdev->dev, "failed to get memory region\n");
- ret = -ENOENT;
- goto err_get;
- }
-
- nuc900_wdt->wdt_base = ioremap(nuc900_wdt->res->start,
- resource_size(nuc900_wdt->res));
- if (nuc900_wdt->wdt_base == NULL) {
- dev_err(&pdev->dev, "failed to ioremap() region\n");
- ret = -EINVAL;
- goto err_req;
- }
+ nuc900_wdt->wdt_base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(nuc900_wdt->wdt_base))
+ return PTR_ERR(nuc900_wdt->wdt_base);
- nuc900_wdt->wdt_clock = clk_get(&pdev->dev, NULL);
+ nuc900_wdt->wdt_clock = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(nuc900_wdt->wdt_clock)) {
dev_err(&pdev->dev, "failed to find watchdog clock source\n");
- ret = PTR_ERR(nuc900_wdt->wdt_clock);
- goto err_map;
+ return PTR_ERR(nuc900_wdt->wdt_clock);
}
clk_enable(nuc900_wdt->wdt_clock);
@@ -298,14 +286,6 @@ static int nuc900wdt_probe(struct platform_device *pdev)
err_clk:
clk_disable(nuc900_wdt->wdt_clock);
- clk_put(nuc900_wdt->wdt_clock);
-err_map:
- iounmap(nuc900_wdt->wdt_base);
-err_req:
- release_mem_region(nuc900_wdt->res->start,
- resource_size(nuc900_wdt->res));
-err_get:
- kfree(nuc900_wdt);
return ret;
}
@@ -314,14 +294,6 @@ static int nuc900wdt_remove(struct platform_device *pdev)
misc_deregister(&nuc900wdt_miscdev);
clk_disable(nuc900_wdt->wdt_clock);
- clk_put(nuc900_wdt->wdt_clock);
-
- iounmap(nuc900_wdt->wdt_base);
-
- release_mem_region(nuc900_wdt->res->start,
- resource_size(nuc900_wdt->res));
-
- kfree(nuc900_wdt);
return 0;
}