aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/w83697hf_wdt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/watchdog/w83697hf_wdt.c')
-rw-r--r--drivers/watchdog/w83697hf_wdt.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/drivers/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c
index af08972de506..23074184c214 100644
--- a/drivers/watchdog/w83697hf_wdt.c
+++ b/drivers/watchdog/w83697hf_wdt.c
@@ -25,6 +25,8 @@
25 * "AS-IS" and at no charge. 25 * "AS-IS" and at no charge.
26 */ 26 */
27 27
28#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
29
28#include <linux/module.h> 30#include <linux/module.h>
29#include <linux/moduleparam.h> 31#include <linux/moduleparam.h>
30#include <linux/types.h> 32#include <linux/types.h>
@@ -42,7 +44,6 @@
42#include <asm/system.h> 44#include <asm/system.h>
43 45
44#define WATCHDOG_NAME "w83697hf/hg WDT" 46#define WATCHDOG_NAME "w83697hf/hg WDT"
45#define PFX WATCHDOG_NAME ": "
46#define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ 47#define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */
47#define WATCHDOG_EARLY_DISABLE 1 /* Disable until userland kicks in */ 48#define WATCHDOG_EARLY_DISABLE 1 /* Disable until userland kicks in */
48 49
@@ -309,8 +310,7 @@ static int wdt_close(struct inode *inode, struct file *file)
309 if (expect_close == 42) 310 if (expect_close == 42)
310 wdt_disable(); 311 wdt_disable();
311 else { 312 else {
312 printk(KERN_CRIT PFX 313 pr_crit("Unexpected close, not stopping watchdog!\n");
313 "Unexpected close, not stopping watchdog!\n");
314 wdt_ping(); 314 wdt_ping();
315 } 315 }
316 expect_close = 0; 316 expect_close = 0;
@@ -362,24 +362,21 @@ static struct notifier_block wdt_notifier = {
362static int w83697hf_check_wdt(void) 362static int w83697hf_check_wdt(void)
363{ 363{
364 if (!request_region(wdt_io, 2, WATCHDOG_NAME)) { 364 if (!request_region(wdt_io, 2, WATCHDOG_NAME)) {
365 printk(KERN_ERR PFX 365 pr_err("I/O address 0x%x already in use\n", wdt_io);
366 "I/O address 0x%x already in use\n", wdt_io);
367 return -EIO; 366 return -EIO;
368 } 367 }
369 368
370 printk(KERN_DEBUG PFX 369 pr_debug("Looking for watchdog at address 0x%x\n", wdt_io);
371 "Looking for watchdog at address 0x%x\n", wdt_io);
372 w83697hf_unlock(); 370 w83697hf_unlock();
373 if (w83697hf_get_reg(0x20) == 0x60) { 371 if (w83697hf_get_reg(0x20) == 0x60) {
374 printk(KERN_INFO PFX 372 pr_info("watchdog found at address 0x%x\n", wdt_io);
375 "watchdog found at address 0x%x\n", wdt_io);
376 w83697hf_lock(); 373 w83697hf_lock();
377 return 0; 374 return 0;
378 } 375 }
379 /* Reprotect in case it was a compatible device */ 376 /* Reprotect in case it was a compatible device */
380 w83697hf_lock(); 377 w83697hf_lock();
381 378
382 printk(KERN_INFO PFX "watchdog not found at address 0x%x\n", wdt_io); 379 pr_info("watchdog not found at address 0x%x\n", wdt_io);
383 release_region(wdt_io, 2); 380 release_region(wdt_io, 2);
384 return -EIO; 381 return -EIO;
385} 382}
@@ -390,7 +387,7 @@ static int __init wdt_init(void)
390{ 387{
391 int ret, i, found = 0; 388 int ret, i, found = 0;
392 389
393 printk(KERN_INFO PFX "WDT driver for W83697HF/HG initializing\n"); 390 pr_info("WDT driver for W83697HF/HG initializing\n");
394 391
395 if (wdt_io == 0) { 392 if (wdt_io == 0) {
396 /* we will autodetect the W83697HF/HG watchdog */ 393 /* we will autodetect the W83697HF/HG watchdog */
@@ -405,7 +402,7 @@ static int __init wdt_init(void)
405 } 402 }
406 403
407 if (!found) { 404 if (!found) {
408 printk(KERN_ERR PFX "No W83697HF/HG could be found\n"); 405 pr_err("No W83697HF/HG could be found\n");
409 ret = -EIO; 406 ret = -EIO;
410 goto out; 407 goto out;
411 } 408 }
@@ -413,34 +410,30 @@ static int __init wdt_init(void)
413 w83697hf_init(); 410 w83697hf_init();
414 if (early_disable) { 411 if (early_disable) {
415 if (wdt_running()) 412 if (wdt_running())
416 printk(KERN_WARNING PFX "Stopping previously enabled " 413 pr_warn("Stopping previously enabled watchdog until userland kicks in\n");
417 "watchdog until userland kicks in\n");
418 wdt_disable(); 414 wdt_disable();
419 } 415 }
420 416
421 if (wdt_set_heartbeat(timeout)) { 417 if (wdt_set_heartbeat(timeout)) {
422 wdt_set_heartbeat(WATCHDOG_TIMEOUT); 418 wdt_set_heartbeat(WATCHDOG_TIMEOUT);
423 printk(KERN_INFO PFX 419 pr_info("timeout value must be 1 <= timeout <= 255, using %d\n",
424 "timeout value must be 1 <= timeout <= 255, using %d\n", 420 WATCHDOG_TIMEOUT);
425 WATCHDOG_TIMEOUT);
426 } 421 }
427 422
428 ret = register_reboot_notifier(&wdt_notifier); 423 ret = register_reboot_notifier(&wdt_notifier);
429 if (ret != 0) { 424 if (ret != 0) {
430 printk(KERN_ERR PFX 425 pr_err("cannot register reboot notifier (err=%d)\n", ret);
431 "cannot register reboot notifier (err=%d)\n", ret);
432 goto unreg_regions; 426 goto unreg_regions;
433 } 427 }
434 428
435 ret = misc_register(&wdt_miscdev); 429 ret = misc_register(&wdt_miscdev);
436 if (ret != 0) { 430 if (ret != 0) {
437 printk(KERN_ERR PFX 431 pr_err("cannot register miscdev on minor=%d (err=%d)\n",
438 "cannot register miscdev on minor=%d (err=%d)\n", 432 WATCHDOG_MINOR, ret);
439 WATCHDOG_MINOR, ret);
440 goto unreg_reboot; 433 goto unreg_reboot;
441 } 434 }
442 435
443 printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n", 436 pr_info("initialized. timeout=%d sec (nowayout=%d)\n",
444 timeout, nowayout); 437 timeout, nowayout);
445 438
446out: 439out: