aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/shwdt.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2012-05-10 01:21:15 -0400
committerPaul Mundt <lethal@linux-sh.org>2012-05-10 01:21:15 -0400
commit40968126366219d11201257b5006878f939c1c5c (patch)
treefb35012cf4e317033859744fea41a3cdba045249 /drivers/watchdog/shwdt.c
parent7ee94d97aafacf5a019b3578e0eae6daa2e2bcd5 (diff)
watchdog: shwdt: Migrate from reboot notifier to platform shutdown.
It's possible to do the same work via the platform driver shutdown method, so wire that up and dump the reboot notifier. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/watchdog/shwdt.c')
-rw-r--r--drivers/watchdog/shwdt.c43
1 files changed, 12 insertions, 31 deletions
diff --git a/drivers/watchdog/shwdt.c b/drivers/watchdog/shwdt.c
index 93958a7763e6..74a261f36702 100644
--- a/drivers/watchdog/shwdt.c
+++ b/drivers/watchdog/shwdt.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Watchdog driver for integrated watchdog in the SuperH processors. 4 * Watchdog driver for integrated watchdog in the SuperH processors.
5 * 5 *
6 * Copyright (C) 2001 - 2010 Paul Mundt <lethal@linux-sh.org> 6 * Copyright (C) 2001 - 2012 Paul Mundt <lethal@linux-sh.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
@@ -27,8 +27,6 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/miscdevice.h> 28#include <linux/miscdevice.h>
29#include <linux/watchdog.h> 29#include <linux/watchdog.h>
30#include <linux/reboot.h>
31#include <linux/notifier.h>
32#include <linux/ioport.h> 30#include <linux/ioport.h>
33#include <linux/fs.h> 31#include <linux/fs.h>
34#include <linux/mm.h> 32#include <linux/mm.h>
@@ -293,17 +291,6 @@ static long sh_wdt_ioctl(struct file *file, unsigned int cmd,
293 return 0; 291 return 0;
294} 292}
295 293
296static int sh_wdt_notify_sys(struct notifier_block *this,
297 unsigned long code, void *unused)
298{
299 struct sh_wdt *wdt = platform_get_drvdata(sh_wdt_dev);
300
301 if (code == SYS_DOWN || code == SYS_HALT)
302 sh_wdt_stop(wdt);
303
304 return NOTIFY_DONE;
305}
306
307static const struct file_operations sh_wdt_fops = { 294static const struct file_operations sh_wdt_fops = {
308 .owner = THIS_MODULE, 295 .owner = THIS_MODULE,
309 .llseek = no_llseek, 296 .llseek = no_llseek,
@@ -320,10 +307,6 @@ static const struct watchdog_info sh_wdt_info = {
320 .identity = "SH WDT", 307 .identity = "SH WDT",
321}; 308};
322 309
323static struct notifier_block sh_wdt_notifier = {
324 .notifier_call = sh_wdt_notify_sys,
325};
326
327static struct miscdevice sh_wdt_miscdev = { 310static struct miscdevice sh_wdt_miscdev = {
328 .minor = WATCHDOG_MINOR, 311 .minor = WATCHDOG_MINOR,
329 .name = "watchdog", 312 .name = "watchdog",
@@ -365,13 +348,6 @@ static int __devinit sh_wdt_probe(struct platform_device *pdev)
365 goto out_err; 348 goto out_err;
366 } 349 }
367 350
368 rc = register_reboot_notifier(&sh_wdt_notifier);
369 if (unlikely(rc)) {
370 dev_err(&pdev->dev,
371 "Can't register reboot notifier (err=%d)\n", rc);
372 goto out_unmap;
373 }
374
375 sh_wdt_miscdev.parent = wdt->dev; 351 sh_wdt_miscdev.parent = wdt->dev;
376 352
377 rc = misc_register(&sh_wdt_miscdev); 353 rc = misc_register(&sh_wdt_miscdev);
@@ -379,7 +355,7 @@ static int __devinit sh_wdt_probe(struct platform_device *pdev)
379 dev_err(&pdev->dev, 355 dev_err(&pdev->dev,
380 "Can't register miscdev on minor=%d (err=%d)\n", 356 "Can't register miscdev on minor=%d (err=%d)\n",
381 sh_wdt_miscdev.minor, rc); 357 sh_wdt_miscdev.minor, rc);
382 goto out_unreg; 358 goto out_unmap;
383 } 359 }
384 360
385 init_timer(&wdt->timer); 361 init_timer(&wdt->timer);
@@ -394,8 +370,6 @@ static int __devinit sh_wdt_probe(struct platform_device *pdev)
394 370
395 return 0; 371 return 0;
396 372
397out_unreg:
398 unregister_reboot_notifier(&sh_wdt_notifier);
399out_unmap: 373out_unmap:
400 devm_iounmap(&pdev->dev, wdt->base); 374 devm_iounmap(&pdev->dev, wdt->base);
401out_err: 375out_err:
@@ -417,7 +391,6 @@ static int __devexit sh_wdt_remove(struct platform_device *pdev)
417 391
418 sh_wdt_dev = NULL; 392 sh_wdt_dev = NULL;
419 393
420 unregister_reboot_notifier(&sh_wdt_notifier);
421 devm_release_mem_region(&pdev->dev, res->start, resource_size(res)); 394 devm_release_mem_region(&pdev->dev, res->start, resource_size(res));
422 devm_iounmap(&pdev->dev, wdt->base); 395 devm_iounmap(&pdev->dev, wdt->base);
423 devm_kfree(&pdev->dev, wdt); 396 devm_kfree(&pdev->dev, wdt);
@@ -425,14 +398,22 @@ static int __devexit sh_wdt_remove(struct platform_device *pdev)
425 return 0; 398 return 0;
426} 399}
427 400
401static void sh_wdt_shutdown(struct platform_device *pdev)
402{
403 struct sh_wdt *wdt = platform_get_drvdata(pdev);
404
405 sh_wdt_stop(wdt);
406}
407
428static struct platform_driver sh_wdt_driver = { 408static struct platform_driver sh_wdt_driver = {
429 .driver = { 409 .driver = {
430 .name = DRV_NAME, 410 .name = DRV_NAME,
431 .owner = THIS_MODULE, 411 .owner = THIS_MODULE,
432 }, 412 },
433 413
434 .probe = sh_wdt_probe, 414 .probe = sh_wdt_probe,
435 .remove = __devexit_p(sh_wdt_remove), 415 .remove = __devexit_p(sh_wdt_remove),
416 .shutdown = sh_wdt_shutdown,
436}; 417};
437 418
438static int __init sh_wdt_init(void) 419static int __init sh_wdt_init(void)