aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/watchdog/acquirewdt.c
diff options
context:
space:
mode:
authorWim Van Sebroeck <wim@iguana.be>2007-01-10 17:38:56 -0500
committerWim Van Sebroeck <wim@iguana.be>2007-01-10 17:38:56 -0500
commit98c08e98f8e5af1caf106e9ee3d46f3eb1ba4858 (patch)
tree0ee4133bcc6241a5df3da3a48013347ae3cd10c0 /drivers/char/watchdog/acquirewdt.c
parentad5fe323182fd3adab4225c93eae36f3c555a884 (diff)
[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 <wim@iguana.be>
Diffstat (limited to 'drivers/char/watchdog/acquirewdt.c')
-rw-r--r--drivers/char/watchdog/acquirewdt.c44
1 files changed, 8 insertions, 36 deletions
diff --git a/drivers/char/watchdog/acquirewdt.c b/drivers/char/watchdog/acquirewdt.c
index 687b809d49cb..85269c365a10 100644
--- a/drivers/char/watchdog/acquirewdt.c
+++ b/drivers/char/watchdog/acquirewdt.c
@@ -62,8 +62,6 @@
62#include <linux/watchdog.h> /* For the watchdog specific items */ 62#include <linux/watchdog.h> /* For the watchdog specific items */
63#include <linux/fs.h> /* For file operations */ 63#include <linux/fs.h> /* For file operations */
64#include <linux/ioport.h> /* For io-port access */ 64#include <linux/ioport.h> /* For io-port access */
65#include <linux/notifier.h> /* For reboot notifier */
66#include <linux/reboot.h> /* For reboot notifier */
67#include <linux/platform_device.h> /* For platform_driver framework */ 65#include <linux/platform_device.h> /* For platform_driver framework */
68#include <linux/init.h> /* For __init/__exit/... */ 66#include <linux/init.h> /* For __init/__exit/... */
69 67
@@ -222,20 +220,6 @@ static int acq_close(struct inode *inode, struct file *file)
222} 220}
223 221
224/* 222/*
225 * Notifier for system down
226 */
227
228static int acq_notify_sys(struct notifier_block *this, unsigned long code,
229 void *unused)
230{
231 if(code==SYS_DOWN || code==SYS_HALT) {
232 /* Turn the WDT off */
233 acq_stop();
234 }
235 return NOTIFY_DONE;
236}
237
238/*
239 * Kernel Interfaces 223 * Kernel Interfaces
240 */ 224 */
241 225
@@ -255,15 +239,6 @@ static struct miscdevice acq_miscdev = {
255}; 239};
256 240
257/* 241/*
258 * The WDT card needs to learn about soft shutdowns in order to
259 * turn the timebomb registers off.
260 */
261
262static struct notifier_block acq_notifier = {
263 .notifier_call = acq_notify_sys,
264};
265
266/*
267 * Init & exit routines 242 * Init & exit routines
268 */ 243 */
269 244
@@ -287,18 +262,11 @@ static int __devinit acq_probe(struct platform_device *dev)
287 goto unreg_stop; 262 goto unreg_stop;
288 } 263 }
289 264
290 ret = register_reboot_notifier(&acq_notifier);
291 if (ret != 0) {
292 printk (KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
293 ret);
294 goto unreg_regions;
295 }
296
297 ret = misc_register(&acq_miscdev); 265 ret = misc_register(&acq_miscdev);
298 if (ret != 0) { 266 if (ret != 0) {
299 printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", 267 printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
300 WATCHDOG_MINOR, ret); 268 WATCHDOG_MINOR, ret);
301 goto unreg_reboot; 269 goto unreg_regions;
302 } 270 }
303 271
304 printk (KERN_INFO PFX "initialized. (nowayout=%d)\n", 272 printk (KERN_INFO PFX "initialized. (nowayout=%d)\n",
@@ -306,8 +274,6 @@ static int __devinit acq_probe(struct platform_device *dev)
306 274
307 return 0; 275 return 0;
308 276
309unreg_reboot:
310 unregister_reboot_notifier(&acq_notifier);
311unreg_regions: 277unreg_regions:
312 release_region(wdt_start, 1); 278 release_region(wdt_start, 1);
313unreg_stop: 279unreg_stop:
@@ -320,7 +286,6 @@ out:
320static int __devexit acq_remove(struct platform_device *dev) 286static int __devexit acq_remove(struct platform_device *dev)
321{ 287{
322 misc_deregister(&acq_miscdev); 288 misc_deregister(&acq_miscdev);
323 unregister_reboot_notifier(&acq_notifier);
324 release_region(wdt_start,1); 289 release_region(wdt_start,1);
325 if(wdt_stop != wdt_start) 290 if(wdt_stop != wdt_start)
326 release_region(wdt_stop,1); 291 release_region(wdt_stop,1);
@@ -328,9 +293,16 @@ static int __devexit acq_remove(struct platform_device *dev)
328 return 0; 293 return 0;
329} 294}
330 295
296static void acq_shutdown(struct platform_device *dev)
297{
298 /* Turn the WDT off if we have a soft shutdown */
299 acq_stop();
300}
301
331static struct platform_driver acquirewdt_driver = { 302static struct platform_driver acquirewdt_driver = {
332 .probe = acq_probe, 303 .probe = acq_probe,
333 .remove = __devexit_p(acq_remove), 304 .remove = __devexit_p(acq_remove),
305 .shutdown = acq_shutdown,
334 .driver = { 306 .driver = {
335 .owner = THIS_MODULE, 307 .owner = THIS_MODULE,
336 .name = DRV_NAME, 308 .name = DRV_NAME,