Commit 40968126 authored by Paul Mundt's avatar Paul Mundt

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: default avatarPaul Mundt <lethal@linux-sh.org>
parent 7ee94d97
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Watchdog driver for integrated watchdog in the SuperH processors. * Watchdog driver for integrated watchdog in the SuperH processors.
* *
* Copyright (C) 2001 - 2010 Paul Mundt <lethal@linux-sh.org> * Copyright (C) 2001 - 2012 Paul Mundt <lethal@linux-sh.org>
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/watchdog.h> #include <linux/watchdog.h>
#include <linux/reboot.h>
#include <linux/notifier.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/mm.h> #include <linux/mm.h>
...@@ -293,17 +291,6 @@ static long sh_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -293,17 +291,6 @@ static long sh_wdt_ioctl(struct file *file, unsigned int cmd,
return 0; return 0;
} }
static int sh_wdt_notify_sys(struct notifier_block *this,
unsigned long code, void *unused)
{
struct sh_wdt *wdt = platform_get_drvdata(sh_wdt_dev);
if (code == SYS_DOWN || code == SYS_HALT)
sh_wdt_stop(wdt);
return NOTIFY_DONE;
}
static const struct file_operations sh_wdt_fops = { static const struct file_operations sh_wdt_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.llseek = no_llseek, .llseek = no_llseek,
...@@ -320,10 +307,6 @@ static const struct watchdog_info sh_wdt_info = { ...@@ -320,10 +307,6 @@ static const struct watchdog_info sh_wdt_info = {
.identity = "SH WDT", .identity = "SH WDT",
}; };
static struct notifier_block sh_wdt_notifier = {
.notifier_call = sh_wdt_notify_sys,
};
static struct miscdevice sh_wdt_miscdev = { static struct miscdevice sh_wdt_miscdev = {
.minor = WATCHDOG_MINOR, .minor = WATCHDOG_MINOR,
.name = "watchdog", .name = "watchdog",
...@@ -365,13 +348,6 @@ static int __devinit sh_wdt_probe(struct platform_device *pdev) ...@@ -365,13 +348,6 @@ static int __devinit sh_wdt_probe(struct platform_device *pdev)
goto out_err; goto out_err;
} }
rc = register_reboot_notifier(&sh_wdt_notifier);
if (unlikely(rc)) {
dev_err(&pdev->dev,
"Can't register reboot notifier (err=%d)\n", rc);
goto out_unmap;
}
sh_wdt_miscdev.parent = wdt->dev; sh_wdt_miscdev.parent = wdt->dev;
rc = misc_register(&sh_wdt_miscdev); rc = misc_register(&sh_wdt_miscdev);
...@@ -379,7 +355,7 @@ static int __devinit sh_wdt_probe(struct platform_device *pdev) ...@@ -379,7 +355,7 @@ static int __devinit sh_wdt_probe(struct platform_device *pdev)
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Can't register miscdev on minor=%d (err=%d)\n", "Can't register miscdev on minor=%d (err=%d)\n",
sh_wdt_miscdev.minor, rc); sh_wdt_miscdev.minor, rc);
goto out_unreg; goto out_unmap;
} }
init_timer(&wdt->timer); init_timer(&wdt->timer);
...@@ -394,8 +370,6 @@ static int __devinit sh_wdt_probe(struct platform_device *pdev) ...@@ -394,8 +370,6 @@ static int __devinit sh_wdt_probe(struct platform_device *pdev)
return 0; return 0;
out_unreg:
unregister_reboot_notifier(&sh_wdt_notifier);
out_unmap: out_unmap:
devm_iounmap(&pdev->dev, wdt->base); devm_iounmap(&pdev->dev, wdt->base);
out_err: out_err:
...@@ -417,7 +391,6 @@ static int __devexit sh_wdt_remove(struct platform_device *pdev) ...@@ -417,7 +391,6 @@ static int __devexit sh_wdt_remove(struct platform_device *pdev)
sh_wdt_dev = NULL; sh_wdt_dev = NULL;
unregister_reboot_notifier(&sh_wdt_notifier);
devm_release_mem_region(&pdev->dev, res->start, resource_size(res)); devm_release_mem_region(&pdev->dev, res->start, resource_size(res));
devm_iounmap(&pdev->dev, wdt->base); devm_iounmap(&pdev->dev, wdt->base);
devm_kfree(&pdev->dev, wdt); devm_kfree(&pdev->dev, wdt);
...@@ -425,6 +398,13 @@ static int __devexit sh_wdt_remove(struct platform_device *pdev) ...@@ -425,6 +398,13 @@ static int __devexit sh_wdt_remove(struct platform_device *pdev)
return 0; return 0;
} }
static void sh_wdt_shutdown(struct platform_device *pdev)
{
struct sh_wdt *wdt = platform_get_drvdata(pdev);
sh_wdt_stop(wdt);
}
static struct platform_driver sh_wdt_driver = { static struct platform_driver sh_wdt_driver = {
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
...@@ -433,6 +413,7 @@ static struct platform_driver sh_wdt_driver = { ...@@ -433,6 +413,7 @@ static struct platform_driver sh_wdt_driver = {
.probe = sh_wdt_probe, .probe = sh_wdt_probe,
.remove = __devexit_p(sh_wdt_remove), .remove = __devexit_p(sh_wdt_remove),
.shutdown = sh_wdt_shutdown,
}; };
static int __init sh_wdt_init(void) static int __init sh_wdt_init(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment