diff options
Diffstat (limited to 'drivers/watchdog/sama5d4_wdt.c')
-rw-r--r-- | drivers/watchdog/sama5d4_wdt.c | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/drivers/watchdog/sama5d4_wdt.c b/drivers/watchdog/sama5d4_wdt.c index ea72fa0aa3ec..111695223aae 100644 --- a/drivers/watchdog/sama5d4_wdt.c +++ b/drivers/watchdog/sama5d4_wdt.c @@ -199,6 +199,7 @@ static int sama5d4_wdt_init(struct sama5d4_wdt *wdt) static int sama5d4_wdt_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct watchdog_device *wdd; struct sama5d4_wdt *wdt; void __iomem *regs; @@ -206,7 +207,7 @@ static int sama5d4_wdt_probe(struct platform_device *pdev) u32 timeout; int ret; - wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); + wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); if (!wdt) return -ENOMEM; @@ -226,26 +227,25 @@ static int sama5d4_wdt_probe(struct platform_device *pdev) wdt->reg_base = regs; - irq = irq_of_parse_and_map(pdev->dev.of_node, 0); + irq = irq_of_parse_and_map(dev->of_node, 0); if (!irq) - dev_warn(&pdev->dev, "failed to get IRQ from DT\n"); + dev_warn(dev, "failed to get IRQ from DT\n"); - ret = of_sama5d4_wdt_init(pdev->dev.of_node, wdt); + ret = of_sama5d4_wdt_init(dev->of_node, wdt); if (ret) return ret; if ((wdt->mr & AT91_WDT_WDFIEN) && irq) { - ret = devm_request_irq(&pdev->dev, irq, sama5d4_wdt_irq_handler, + ret = devm_request_irq(dev, irq, sama5d4_wdt_irq_handler, IRQF_SHARED | IRQF_IRQPOLL | IRQF_NO_SUSPEND, pdev->name, pdev); if (ret) { - dev_err(&pdev->dev, - "cannot register interrupt handler\n"); + dev_err(dev, "cannot register interrupt handler\n"); return ret; } } - watchdog_init_timeout(wdd, wdt_timeout, &pdev->dev); + watchdog_init_timeout(wdd, wdt_timeout, dev); timeout = WDT_SEC2TICKS(wdd->timeout); @@ -258,31 +258,21 @@ static int sama5d4_wdt_probe(struct platform_device *pdev) watchdog_set_nowayout(wdd, nowayout); - ret = watchdog_register_device(wdd); + watchdog_stop_on_unregister(wdd); + ret = devm_watchdog_register_device(dev, wdd); if (ret) { - dev_err(&pdev->dev, "failed to register watchdog device\n"); + dev_err(dev, "failed to register watchdog device\n"); return ret; } platform_set_drvdata(pdev, wdt); - dev_info(&pdev->dev, "initialized (timeout = %d sec, nowayout = %d)\n", + dev_info(dev, "initialized (timeout = %d sec, nowayout = %d)\n", wdd->timeout, nowayout); return 0; } -static int sama5d4_wdt_remove(struct platform_device *pdev) -{ - struct sama5d4_wdt *wdt = platform_get_drvdata(pdev); - - sama5d4_wdt_stop(&wdt->wdd); - - watchdog_unregister_device(&wdt->wdd); - - return 0; -} - static const struct of_device_id sama5d4_wdt_of_match[] = { { .compatible = "atmel,sama5d4-wdt", }, { } @@ -310,7 +300,6 @@ static SIMPLE_DEV_PM_OPS(sama5d4_wdt_pm_ops, NULL, static struct platform_driver sama5d4_wdt_driver = { .probe = sama5d4_wdt_probe, - .remove = sama5d4_wdt_remove, .driver = { .name = "sama5d4_wdt", .pm = &sama5d4_wdt_pm_ops, |