[WATCHDOG] change reboot_notifier to platform-shutdown method.

Platform device drivers can use the .shutdown method to handle soft
shutdown's instead of reboot_notifier's.

Signed-off-by: Wim Van Sebroeck <wim@iguana.be>

+21 -56
+15 -37
drivers/watchdog/bfin_wdt.c
··· 19 #include <linux/miscdevice.h> 20 #include <linux/watchdog.h> 21 #include <linux/fs.h> 22 - #include <linux/notifier.h> 23 - #include <linux/reboot.h> 24 #include <linux/init.h> 25 #include <linux/interrupt.h> 26 #include <linux/uaccess.h> ··· 307 } 308 } 309 310 - /** 311 - * bfin_wdt_notify_sys - Notifier Handler 312 - * @this: notifier block 313 - * @code: notifier event 314 - * @unused: unused 315 - * 316 - * Handles specific events, such as turning off the watchdog during a 317 - * shutdown event. 318 - */ 319 - static int bfin_wdt_notify_sys(struct notifier_block *this, 320 - unsigned long code, void *unused) 321 - { 322 - stampit(); 323 - 324 - if (code == SYS_DOWN || code == SYS_HALT) 325 - bfin_wdt_stop(); 326 - 327 - return NOTIFY_DONE; 328 - } 329 - 330 #ifdef CONFIG_PM 331 static int state_before_suspend; 332 ··· 373 WDIOF_MAGICCLOSE, 374 }; 375 376 - static struct notifier_block bfin_wdt_notifier = { 377 - .notifier_call = bfin_wdt_notify_sys, 378 - }; 379 - 380 /** 381 * bfin_wdt_probe - Initialize module 382 * 383 - * Registers the misc device and notifier handler. Actual device 384 * initialization is handled by bfin_wdt_open(). 385 */ 386 static int __devinit bfin_wdt_probe(struct platform_device *pdev) 387 { 388 int ret; 389 390 - ret = register_reboot_notifier(&bfin_wdt_notifier); 391 - if (ret) { 392 - pr_devinit(KERN_ERR PFX 393 - "cannot register reboot notifier (err=%d)\n", ret); 394 - return ret; 395 - } 396 - 397 ret = misc_register(&bfin_wdt_miscdev); 398 if (ret) { 399 pr_devinit(KERN_ERR PFX 400 "cannot register miscdev on minor=%d (err=%d)\n", 401 WATCHDOG_MINOR, ret); 402 - unregister_reboot_notifier(&bfin_wdt_notifier); 403 return ret; 404 } 405 ··· 400 /** 401 * bfin_wdt_remove - Initialize module 402 * 403 - * Unregisters the misc device and notifier handler. Actual device 404 * deinitialization is handled by bfin_wdt_close(). 405 */ 406 static int __devexit bfin_wdt_remove(struct platform_device *pdev) 407 { 408 misc_deregister(&bfin_wdt_miscdev); 409 - unregister_reboot_notifier(&bfin_wdt_notifier); 410 return 0; 411 } 412 413 static struct platform_device *bfin_wdt_device; ··· 426 static struct platform_driver bfin_wdt_driver = { 427 .probe = bfin_wdt_probe, 428 .remove = __devexit_p(bfin_wdt_remove), 429 .suspend = bfin_wdt_suspend, 430 .resume = bfin_wdt_resume, 431 .driver = {
··· 19 #include <linux/miscdevice.h> 20 #include <linux/watchdog.h> 21 #include <linux/fs.h> 22 #include <linux/init.h> 23 #include <linux/interrupt.h> 24 #include <linux/uaccess.h> ··· 309 } 310 } 311 312 #ifdef CONFIG_PM 313 static int state_before_suspend; 314 ··· 395 WDIOF_MAGICCLOSE, 396 }; 397 398 /** 399 * bfin_wdt_probe - Initialize module 400 * 401 + * Registers the misc device. Actual device 402 * initialization is handled by bfin_wdt_open(). 403 */ 404 static int __devinit bfin_wdt_probe(struct platform_device *pdev) 405 { 406 int ret; 407 408 ret = misc_register(&bfin_wdt_miscdev); 409 if (ret) { 410 pr_devinit(KERN_ERR PFX 411 "cannot register miscdev on minor=%d (err=%d)\n", 412 WATCHDOG_MINOR, ret); 413 return ret; 414 } 415 ··· 434 /** 435 * bfin_wdt_remove - Initialize module 436 * 437 + * Unregisters the misc device. Actual device 438 * deinitialization is handled by bfin_wdt_close(). 439 */ 440 static int __devexit bfin_wdt_remove(struct platform_device *pdev) 441 { 442 misc_deregister(&bfin_wdt_miscdev); 443 return 0; 444 + } 445 + 446 + /** 447 + * bfin_wdt_shutdown - Soft Shutdown Handler 448 + * 449 + * Handles the soft shutdown event. 450 + */ 451 + static void bfin_wdt_shutdown(struct platform_device *pdev) 452 + { 453 + stampit(); 454 + 455 + bfin_wdt_stop(); 456 } 457 458 static struct platform_device *bfin_wdt_device; ··· 449 static struct platform_driver bfin_wdt_driver = { 450 .probe = bfin_wdt_probe, 451 .remove = __devexit_p(bfin_wdt_remove), 452 + .shutdown = bfin_wdt_shutdown, 453 .suspend = bfin_wdt_suspend, 454 .resume = bfin_wdt_resume, 455 .driver = {
+6 -19
drivers/watchdog/txx9wdt.c
··· 13 #include <linux/miscdevice.h> 14 #include <linux/watchdog.h> 15 #include <linux/fs.h> 16 - #include <linux/reboot.h> 17 #include <linux/init.h> 18 #include <linux/uaccess.h> 19 #include <linux/platform_device.h> ··· 165 } 166 } 167 168 - static int txx9wdt_notify_sys(struct notifier_block *this, unsigned long code, 169 - void *unused) 170 - { 171 - if (code == SYS_DOWN || code == SYS_HALT) 172 - txx9wdt_stop(); 173 - return NOTIFY_DONE; 174 - } 175 - 176 static const struct file_operations txx9wdt_fops = { 177 .owner = THIS_MODULE, 178 .llseek = no_llseek, ··· 178 .minor = WATCHDOG_MINOR, 179 .name = "watchdog", 180 .fops = &txx9wdt_fops, 181 - }; 182 - 183 - static struct notifier_block txx9wdt_notifier = { 184 - .notifier_call = txx9wdt_notify_sys, 185 }; 186 187 static int __init txx9wdt_probe(struct platform_device *dev) ··· 208 if (!txx9wdt_reg) 209 goto exit_busy; 210 211 - ret = register_reboot_notifier(&txx9wdt_notifier); 212 - if (ret) 213 - goto exit; 214 - 215 ret = misc_register(&txx9wdt_miscdev); 216 if (ret) { 217 - unregister_reboot_notifier(&txx9wdt_notifier); 218 goto exit; 219 } 220 ··· 231 static int __exit txx9wdt_remove(struct platform_device *dev) 232 { 233 misc_deregister(&txx9wdt_miscdev); 234 - unregister_reboot_notifier(&txx9wdt_notifier); 235 clk_disable(txx9_imclk); 236 clk_put(txx9_imclk); 237 return 0; 238 } 239 240 static struct platform_driver txx9wdt_driver = { 241 .remove = __exit_p(txx9wdt_remove), 242 .driver = { 243 .name = "txx9wdt", 244 .owner = THIS_MODULE,
··· 13 #include <linux/miscdevice.h> 14 #include <linux/watchdog.h> 15 #include <linux/fs.h> 16 #include <linux/init.h> 17 #include <linux/uaccess.h> 18 #include <linux/platform_device.h> ··· 166 } 167 } 168 169 static const struct file_operations txx9wdt_fops = { 170 .owner = THIS_MODULE, 171 .llseek = no_llseek, ··· 187 .minor = WATCHDOG_MINOR, 188 .name = "watchdog", 189 .fops = &txx9wdt_fops, 190 }; 191 192 static int __init txx9wdt_probe(struct platform_device *dev) ··· 221 if (!txx9wdt_reg) 222 goto exit_busy; 223 224 ret = misc_register(&txx9wdt_miscdev); 225 if (ret) { 226 goto exit; 227 } 228 ··· 249 static int __exit txx9wdt_remove(struct platform_device *dev) 250 { 251 misc_deregister(&txx9wdt_miscdev); 252 clk_disable(txx9_imclk); 253 clk_put(txx9_imclk); 254 return 0; 255 } 256 257 + static void txx9wdt_shutdown(struct platform_device *dev) 258 + { 259 + txx9wdt_stop(); 260 + } 261 + 262 static struct platform_driver txx9wdt_driver = { 263 .remove = __exit_p(txx9wdt_remove), 264 + .shutdown = txx9wdt_shutdown, 265 .driver = { 266 .name = "txx9wdt", 267 .owner = THIS_MODULE,