Commit b0e7cd75 authored by Wim Van Sebroeck's avatar Wim Van Sebroeck

[WATCHDOG] advantechwdt.c patch2

some small clean-ups (use PFX + report default timeout as it's value in the MODULE_PARM_DESC)
parent 6039f269
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include <asm/system.h> #include <asm/system.h>
#define WATCHDOG_NAME "Advantech WDT" #define WATCHDOG_NAME "Advantech WDT"
#define PFX WATCHDOG_NAME ": "
#define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */
static unsigned long advwdt_is_open; static unsigned long advwdt_is_open;
...@@ -70,7 +71,7 @@ MODULE_PARM_DESC(wdt_start, "Advantech WDT 'start' io port (default 0x443)"); ...@@ -70,7 +71,7 @@ MODULE_PARM_DESC(wdt_start, "Advantech WDT 'start' io port (default 0x443)");
static int timeout = WATCHDOG_TIMEOUT; /* in seconds */ static int timeout = WATCHDOG_TIMEOUT; /* in seconds */
module_param(timeout, int, 0); module_param(timeout, int, 0);
MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=63, default=60."); MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=63, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ".");
#ifdef CONFIG_WATCHDOG_NOWAYOUT #ifdef CONFIG_WATCHDOG_NOWAYOUT
static int nowayout = 1; static int nowayout = 1;
...@@ -206,7 +207,7 @@ advwdt_close(struct inode *inode, struct file *file) ...@@ -206,7 +207,7 @@ advwdt_close(struct inode *inode, struct file *file)
if (adv_expect_close == 42) { if (adv_expect_close == 42) {
advwdt_disable(); advwdt_disable();
} else { } else {
printk(KERN_CRIT WATCHDOG_NAME ": Unexpected close, not stopping watchdog!\n"); printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
advwdt_ping(); advwdt_ping();
} }
clear_bit(0, &advwdt_is_open); clear_bit(0, &advwdt_is_open);
...@@ -268,13 +269,13 @@ advwdt_init(void) ...@@ -268,13 +269,13 @@ advwdt_init(void)
if (timeout < 1 || timeout > 63) { if (timeout < 1 || timeout > 63) {
timeout = WATCHDOG_TIMEOUT; timeout = WATCHDOG_TIMEOUT;
printk (KERN_INFO WATCHDOG_NAME ": timeout value must be 1<=x<=63, using %d\n", printk (KERN_INFO PFX "timeout value must be 1<=x<=63, using %d\n",
timeout); timeout);
} }
if (wdt_stop != wdt_start) { if (wdt_stop != wdt_start) {
if (!request_region(wdt_stop, 1, WATCHDOG_NAME)) { if (!request_region(wdt_stop, 1, WATCHDOG_NAME)) {
printk (KERN_ERR WATCHDOG_NAME ": I/O address 0x%04x already in use\n", printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
wdt_stop); wdt_stop);
ret = -EIO; ret = -EIO;
goto out; goto out;
...@@ -282,7 +283,7 @@ advwdt_init(void) ...@@ -282,7 +283,7 @@ advwdt_init(void)
} }
if (!request_region(wdt_start, 1, WATCHDOG_NAME)) { if (!request_region(wdt_start, 1, WATCHDOG_NAME)) {
printk (KERN_ERR WATCHDOG_NAME ": I/O address 0x%04x already in use\n", printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
wdt_start); wdt_start);
ret = -EIO; ret = -EIO;
goto unreg_stop; goto unreg_stop;
...@@ -290,19 +291,19 @@ advwdt_init(void) ...@@ -290,19 +291,19 @@ advwdt_init(void)
ret = register_reboot_notifier(&advwdt_notifier); ret = register_reboot_notifier(&advwdt_notifier);
if (ret != 0) { if (ret != 0) {
printk (KERN_ERR WATCHDOG_NAME ": cannot register reboot notifier (err=%d)\n", printk (KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
ret); ret);
goto unreg_regions; goto unreg_regions;
} }
ret = misc_register(&advwdt_miscdev); ret = misc_register(&advwdt_miscdev);
if (ret != 0) { if (ret != 0) {
printk (KERN_ERR WATCHDOG_NAME ": cannot register miscdev on minor=%d (err=%d)\n", printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
WATCHDOG_MINOR, ret); WATCHDOG_MINOR, ret);
goto unreg_reboot; goto unreg_reboot;
} }
printk (KERN_INFO WATCHDOG_NAME ": initialized. timeout=%d sec (nowayout=%d)\n", printk (KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n",
timeout, nowayout); timeout, nowayout);
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment