Patch from Dimitry Andric <[EMAIL PROTECTED]> Change to using platfrom driver's .shutdown method instead of an reboot notifier
Signed-off-by: Dimitry Andric <[EMAIL PROTECTED]> Signed-off-by: Ben Dooks <[EMAIL PROTECTED]> diff -urN -X ../dontdiff linux-2.6.11-mm2-bjd1/drivers/char/watchdog/s3c2410_wdt.c linux-2.6.11-mm2-bjd2/drivers/char/watchdog/s3c2410_wdt.c --- linux-2.6.11-mm2-bjd1/drivers/char/watchdog/s3c2410_wdt.c 2005-03-12 11:11:08.000000000 +0000 +++ linux-2.6.11-mm2-bjd2/drivers/char/watchdog/s3c2410_wdt.c 2005-03-12 11:23:18.000000000 +0000 @@ -27,6 +27,7 @@ * Fixed tmr_count / wdt_count confusion * Added configurable debug * 25-Jan-2005 DA Added suspend/resume support + * Replaced reboot notifier with .shutdown method */ #include <linux/module.h> @@ -37,8 +38,6 @@ #include <linux/miscdevice.h> #include <linux/watchdog.h> #include <linux/fs.h> -#include <linux/notifier.h> -#include <linux/reboot.h> #include <linux/init.h> #include <linux/device.h> #include <linux/interrupt.h> @@ -323,20 +322,6 @@ } } -/* - * Notifier for system down - */ - -static int s3c2410wdt_notify_sys(struct notifier_block *this, unsigned long code, - void *unused) -{ - if(code==SYS_DOWN || code==SYS_HALT) { - /* Turn the WDT off */ - s3c2410wdt_stop(); - } - return NOTIFY_DONE; -} - /* kernel interface */ static struct file_operations s3c2410wdt_fops = { @@ -354,10 +339,6 @@ .fops = &s3c2410wdt_fops, }; -static struct notifier_block s3c2410wdt_notifier = { - .notifier_call = s3c2410wdt_notify_sys, -}; - /* interrupt handler code */ static irqreturn_t s3c2410wdt_irq(int irqno, void *param, @@ -438,18 +419,10 @@ } } - ret = register_reboot_notifier(&s3c2410wdt_notifier); - if (ret) { - printk (KERN_ERR PFX "cannot register reboot notifier (%d)\n", - ret); - return ret; - } - ret = misc_register(&s3c2410wdt_miscdev); if (ret) { printk (KERN_ERR PFX "cannot register miscdev on minor=%d (%d)\n", WATCHDOG_MINOR, ret); - unregister_reboot_notifier(&s3c2410wdt_notifier); return ret; } @@ -485,6 +458,11 @@ return 0; } +static void s3c2410wdt_shutdown(struct device *dev) +{ + s3c2410wdt_stop(); +} + #ifdef CONFIG_PM static unsigned long wtcon_save; @@ -531,6 +509,7 @@ .bus = &platform_bus_type, .probe = s3c2410wdt_probe, .remove = s3c2410wdt_remove, + .shutdown = s3c2410wdt_shutdown, .suspend = s3c2410wdt_suspend, .resume = s3c2410wdt_resume, }; @@ -547,7 +526,6 @@ static void __exit watchdog_exit(void) { driver_unregister(&s3c2410wdt_driver); - unregister_reboot_notifier(&s3c2410wdt_notifier); } module_init(watchdog_init);
diff -urN -X ../dontdiff linux-2.6.11-mm2-bjd1/drivers/char/watchdog/s3c2410_wdt.c linux-2.6.11-mm2-bjd2/drivers/char/watchdog/s3c2410_wdt.c --- linux-2.6.11-mm2-bjd1/drivers/char/watchdog/s3c2410_wdt.c 2005-03-12 11:11:08.000000000 +0000 +++ linux-2.6.11-mm2-bjd2/drivers/char/watchdog/s3c2410_wdt.c 2005-03-12 11:23:18.000000000 +0000 @@ -27,6 +27,7 @@ * Fixed tmr_count / wdt_count confusion * Added configurable debug * 25-Jan-2005 DA Added suspend/resume support + * Replaced reboot notifier with .shutdown method */ #include <linux/module.h> @@ -37,8 +38,6 @@ #include <linux/miscdevice.h> #include <linux/watchdog.h> #include <linux/fs.h> -#include <linux/notifier.h> -#include <linux/reboot.h> #include <linux/init.h> #include <linux/device.h> #include <linux/interrupt.h> @@ -323,20 +322,6 @@ } } -/* - * Notifier for system down - */ - -static int s3c2410wdt_notify_sys(struct notifier_block *this, unsigned long code, - void *unused) -{ - if(code==SYS_DOWN || code==SYS_HALT) { - /* Turn the WDT off */ - s3c2410wdt_stop(); - } - return NOTIFY_DONE; -} - /* kernel interface */ static struct file_operations s3c2410wdt_fops = { @@ -354,10 +339,6 @@ .fops = &s3c2410wdt_fops, }; -static struct notifier_block s3c2410wdt_notifier = { - .notifier_call = s3c2410wdt_notify_sys, -}; - /* interrupt handler code */ static irqreturn_t s3c2410wdt_irq(int irqno, void *param, @@ -438,18 +419,10 @@ } } - ret = register_reboot_notifier(&s3c2410wdt_notifier); - if (ret) { - printk (KERN_ERR PFX "cannot register reboot notifier (%d)\n", - ret); - return ret; - } - ret = misc_register(&s3c2410wdt_miscdev); if (ret) { printk (KERN_ERR PFX "cannot register miscdev on minor=%d (%d)\n", WATCHDOG_MINOR, ret); - unregister_reboot_notifier(&s3c2410wdt_notifier); return ret; } @@ -485,6 +458,11 @@ return 0; } +static void s3c2410wdt_shutdown(struct device *dev) +{ + s3c2410wdt_stop(); +} + #ifdef CONFIG_PM static unsigned long wtcon_save; @@ -531,6 +509,7 @@ .bus = &platform_bus_type, .probe = s3c2410wdt_probe, .remove = s3c2410wdt_remove, + .shutdown = s3c2410wdt_shutdown, .suspend = s3c2410wdt_suspend, .resume = s3c2410wdt_resume, }; @@ -547,7 +526,6 @@ static void __exit watchdog_exit(void) { driver_unregister(&s3c2410wdt_driver); - unregister_reboot_notifier(&s3c2410wdt_notifier); } module_init(watchdog_init);