aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorWim Van Sebroeck <wim@iguana.be>2007-01-27 16:54:18 -0500
committerWim Van Sebroeck <wim@iguana.be>2007-01-27 16:54:18 -0500
commit35fcf53870eaa6cc966604a6e36df1c2c1577540 (patch)
tree35c55211c9f7b0488e0438798988bb207621e5fd /drivers
parent745ac1ea6e06125cc1326adbec34d756b25678c6 (diff)
[WATCHDOG] ib700wdt.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')
-rw-r--r--drivers/char/watchdog/ib700wdt.c42
1 files changed, 7 insertions, 35 deletions
diff --git a/drivers/char/watchdog/ib700wdt.c b/drivers/char/watchdog/ib700wdt.c
index b74e15159c02..c3a60f52ccb9 100644
--- a/drivers/char/watchdog/ib700wdt.c
+++ b/drivers/char/watchdog/ib700wdt.c
@@ -36,9 +36,7 @@
36#include <linux/miscdevice.h> 36#include <linux/miscdevice.h>
37#include <linux/watchdog.h> 37#include <linux/watchdog.h>
38#include <linux/ioport.h> 38#include <linux/ioport.h>
39#include <linux/notifier.h>
40#include <linux/fs.h> 39#include <linux/fs.h>
41#include <linux/reboot.h>
42#include <linux/init.h> 40#include <linux/init.h>
43#include <linux/spinlock.h> 41#include <linux/spinlock.h>
44#include <linux/moduleparam.h> 42#include <linux/moduleparam.h>
@@ -284,21 +282,6 @@ ibwdt_close(struct inode *inode, struct file *file)
284} 282}
285 283
286/* 284/*
287 * Notifier for system down
288 */
289
290static int
291ibwdt_notify_sys(struct notifier_block *this, unsigned long code,
292 void *unused)
293{
294 if (code == SYS_DOWN || code == SYS_HALT) {
295 /* Turn the WDT off */
296 ibwdt_disable();
297 }
298 return NOTIFY_DONE;
299}
300
301/*
302 * Kernel Interfaces 285 * Kernel Interfaces
303 */ 286 */
304 287
@@ -318,15 +301,6 @@ static struct miscdevice ibwdt_miscdev = {
318}; 301};
319 302
320/* 303/*
321 * The WDT needs to learn about soft shutdowns in order to
322 * turn the timebomb registers off.
323 */
324
325static struct notifier_block ibwdt_notifier = {
326 .notifier_call = ibwdt_notify_sys,
327};
328
329/*
330 * Init & exit routines 304 * Init & exit routines
331 */ 305 */
332 306
@@ -350,12 +324,6 @@ static int __devinit ibwdt_probe(struct platform_device *dev)
350 goto out_nostartreg; 324 goto out_nostartreg;
351 } 325 }
352 326
353 res = register_reboot_notifier(&ibwdt_notifier);
354 if (res) {
355 printk (KERN_ERR PFX "Failed to register reboot notifier.\n");
356 goto out_noreboot;
357 }
358
359 res = misc_register(&ibwdt_miscdev); 327 res = misc_register(&ibwdt_miscdev);
360 if (res) { 328 if (res) {
361 printk (KERN_ERR PFX "failed to register misc device\n"); 329 printk (KERN_ERR PFX "failed to register misc device\n");
@@ -364,8 +332,6 @@ static int __devinit ibwdt_probe(struct platform_device *dev)
364 return 0; 332 return 0;
365 333
366out_nomisc: 334out_nomisc:
367 unregister_reboot_notifier(&ibwdt_notifier);
368out_noreboot:
369 release_region(WDT_START, 1); 335 release_region(WDT_START, 1);
370out_nostartreg: 336out_nostartreg:
371#if WDT_START != WDT_STOP 337#if WDT_START != WDT_STOP
@@ -378,7 +344,6 @@ out_nostopreg:
378static int __devexit ibwdt_remove(struct platform_device *dev) 344static int __devexit ibwdt_remove(struct platform_device *dev)
379{ 345{
380 misc_deregister(&ibwdt_miscdev); 346 misc_deregister(&ibwdt_miscdev);
381 unregister_reboot_notifier(&ibwdt_notifier);
382 release_region(WDT_START,1); 347 release_region(WDT_START,1);
383#if WDT_START != WDT_STOP 348#if WDT_START != WDT_STOP
384 release_region(WDT_STOP,1); 349 release_region(WDT_STOP,1);
@@ -386,9 +351,16 @@ static int __devexit ibwdt_remove(struct platform_device *dev)
386 return 0; 351 return 0;
387} 352}
388 353
354static void ibwdt_shutdown(struct platform_device *dev)
355{
356 /* Turn the WDT off if we have a soft shutdown */
357 ibwdt_disable();
358}
359
389static struct platform_driver ibwdt_driver = { 360static struct platform_driver ibwdt_driver = {
390 .probe = ibwdt_probe, 361 .probe = ibwdt_probe,
391 .remove = __devexit_p(ibwdt_remove), 362 .remove = __devexit_p(ibwdt_remove),
363 .shutdown = ibwdt_shutdown,
392 .driver = { 364 .driver = {
393 .owner = THIS_MODULE, 365 .owner = THIS_MODULE,
394 .name = DRV_NAME, 366 .name = DRV_NAME,