From 98c08e98f8e5af1caf106e9ee3d46f3eb1ba4858 Mon Sep 17 00:00:00 2001 From: Wim Van Sebroeck Date: Wed, 10 Jan 2007 23:38:56 +0100 Subject: [PATCH] [WATCHDOG] acquirewdt.c - convert to platform_device part 2 Convert the reboot_notifier into the platform_device's shutdown method Signed-off-by: Wim Van Sebroeck --- drivers/char/watchdog/acquirewdt.c | 44 ++++++------------------------ 1 file changed, 8 insertions(+), 36 deletions(-) diff --git a/drivers/char/watchdog/acquirewdt.c b/drivers/char/watchdog/acquirewdt.c index 687b809d49..85269c365a 100644 --- a/drivers/char/watchdog/acquirewdt.c +++ b/drivers/char/watchdog/acquirewdt.c @@ -62,8 +62,6 @@ #include /* For the watchdog specific items */ #include /* For file operations */ #include /* For io-port access */ -#include /* For reboot notifier */ -#include /* For reboot notifier */ #include /* For platform_driver framework */ #include /* For __init/__exit/... */ @@ -221,20 +219,6 @@ static int acq_close(struct inode *inode, struct file *file) return 0; } -/* - * Notifier for system down - */ - -static int acq_notify_sys(struct notifier_block *this, unsigned long code, - void *unused) -{ - if(code==SYS_DOWN || code==SYS_HALT) { - /* Turn the WDT off */ - acq_stop(); - } - return NOTIFY_DONE; -} - /* * Kernel Interfaces */ @@ -254,15 +238,6 @@ static struct miscdevice acq_miscdev = { .fops = &acq_fops, }; -/* - * The WDT card needs to learn about soft shutdowns in order to - * turn the timebomb registers off. - */ - -static struct notifier_block acq_notifier = { - .notifier_call = acq_notify_sys, -}; - /* * Init & exit routines */ @@ -287,18 +262,11 @@ static int __devinit acq_probe(struct platform_device *dev) goto unreg_stop; } - ret = register_reboot_notifier(&acq_notifier); - if (ret != 0) { - printk (KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", - ret); - goto unreg_regions; - } - ret = misc_register(&acq_miscdev); if (ret != 0) { printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", WATCHDOG_MINOR, ret); - goto unreg_reboot; + goto unreg_regions; } printk (KERN_INFO PFX "initialized. (nowayout=%d)\n", @@ -306,8 +274,6 @@ static int __devinit acq_probe(struct platform_device *dev) return 0; -unreg_reboot: - unregister_reboot_notifier(&acq_notifier); unreg_regions: release_region(wdt_start, 1); unreg_stop: @@ -320,7 +286,6 @@ out: static int __devexit acq_remove(struct platform_device *dev) { misc_deregister(&acq_miscdev); - unregister_reboot_notifier(&acq_notifier); release_region(wdt_start,1); if(wdt_stop != wdt_start) release_region(wdt_stop,1); @@ -328,9 +293,16 @@ static int __devexit acq_remove(struct platform_device *dev) return 0; } +static void acq_shutdown(struct platform_device *dev) +{ + /* Turn the WDT off if we have a soft shutdown */ + acq_stop(); +} + static struct platform_driver acquirewdt_driver = { .probe = acq_probe, .remove = __devexit_p(acq_remove), + .shutdown = acq_shutdown, .driver = { .owner = THIS_MODULE, .name = DRV_NAME, -- 2.39.5