aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/sbc60xxwdt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/watchdog/sbc60xxwdt.c')
-rw-r--r--drivers/watchdog/sbc60xxwdt.c42
1 files changed, 17 insertions, 25 deletions
diff --git a/drivers/watchdog/sbc60xxwdt.c b/drivers/watchdog/sbc60xxwdt.c
index 626d0e8e56c3..63632ec87c7e 100644
--- a/drivers/watchdog/sbc60xxwdt.c
+++ b/drivers/watchdog/sbc60xxwdt.c
@@ -48,6 +48,8 @@
48 * 48 *
49 */ 49 */
50 50
51#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
52
51#include <linux/module.h> 53#include <linux/module.h>
52#include <linux/moduleparam.h> 54#include <linux/moduleparam.h>
53#include <linux/types.h> 55#include <linux/types.h>
@@ -63,7 +65,6 @@
63#include <linux/io.h> 65#include <linux/io.h>
64#include <linux/uaccess.h> 66#include <linux/uaccess.h>
65 67
66#include <asm/system.h>
67 68
68#define OUR_NAME "sbc60xxwdt" 69#define OUR_NAME "sbc60xxwdt"
69#define PFX OUR_NAME ": " 70#define PFX OUR_NAME ": "
@@ -105,8 +106,8 @@ MODULE_PARM_DESC(timeout,
105 "Watchdog timeout in seconds. (1<=timeout<=3600, default=" 106 "Watchdog timeout in seconds. (1<=timeout<=3600, default="
106 __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); 107 __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
107 108
108static int nowayout = WATCHDOG_NOWAYOUT; 109static bool nowayout = WATCHDOG_NOWAYOUT;
109module_param(nowayout, int, 0); 110module_param(nowayout, bool, 0);
110MODULE_PARM_DESC(nowayout, 111MODULE_PARM_DESC(nowayout,
111 "Watchdog cannot be stopped once started (default=" 112 "Watchdog cannot be stopped once started (default="
112 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); 113 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
@@ -132,8 +133,7 @@ static void wdt_timer_ping(unsigned long data)
132 /* Re-set the timer interval */ 133 /* Re-set the timer interval */
133 mod_timer(&timer, jiffies + WDT_INTERVAL); 134 mod_timer(&timer, jiffies + WDT_INTERVAL);
134 } else 135 } else
135 printk(KERN_WARNING PFX 136 pr_warn("Heartbeat lost! Will not ping the watchdog\n");
136 "Heartbeat lost! Will not ping the watchdog\n");
137} 137}
138 138
139/* 139/*
@@ -146,7 +146,7 @@ static void wdt_startup(void)
146 146
147 /* Start the timer */ 147 /* Start the timer */
148 mod_timer(&timer, jiffies + WDT_INTERVAL); 148 mod_timer(&timer, jiffies + WDT_INTERVAL);
149 printk(KERN_INFO PFX "Watchdog timer is now enabled.\n"); 149 pr_info("Watchdog timer is now enabled\n");
150} 150}
151 151
152static void wdt_turnoff(void) 152static void wdt_turnoff(void)
@@ -154,7 +154,7 @@ static void wdt_turnoff(void)
154 /* Stop the timer */ 154 /* Stop the timer */
155 del_timer(&timer); 155 del_timer(&timer);
156 inb_p(wdt_stop); 156 inb_p(wdt_stop);
157 printk(KERN_INFO PFX "Watchdog timer is now disabled...\n"); 157 pr_info("Watchdog timer is now disabled...\n");
158} 158}
159 159
160static void wdt_keepalive(void) 160static void wdt_keepalive(void)
@@ -217,8 +217,7 @@ static int fop_close(struct inode *inode, struct file *file)
217 wdt_turnoff(); 217 wdt_turnoff();
218 else { 218 else {
219 del_timer(&timer); 219 del_timer(&timer);
220 printk(KERN_CRIT PFX 220 pr_crit("device file closed unexpectedly. Will not stop the WDT!\n");
221 "device file closed unexpectedly. Will not stop the WDT!\n");
222 } 221 }
223 clear_bit(0, &wdt_is_open); 222 clear_bit(0, &wdt_is_open);
224 wdt_expect_close = 0; 223 wdt_expect_close = 0;
@@ -335,14 +334,12 @@ static int __init sbc60xxwdt_init(void)
335 334
336 if (timeout < 1 || timeout > 3600) { /* arbitrary upper limit */ 335 if (timeout < 1 || timeout > 3600) { /* arbitrary upper limit */
337 timeout = WATCHDOG_TIMEOUT; 336 timeout = WATCHDOG_TIMEOUT;
338 printk(KERN_INFO PFX 337 pr_info("timeout value must be 1 <= x <= 3600, using %d\n",
339 "timeout value must be 1 <= x <= 3600, using %d\n", 338 timeout);
340 timeout);
341 } 339 }
342 340
343 if (!request_region(wdt_start, 1, "SBC 60XX WDT")) { 341 if (!request_region(wdt_start, 1, "SBC 60XX WDT")) {
344 printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", 342 pr_err("I/O address 0x%04x already in use\n", wdt_start);
345 wdt_start);
346 rc = -EIO; 343 rc = -EIO;
347 goto err_out; 344 goto err_out;
348 } 345 }
@@ -350,9 +347,7 @@ static int __init sbc60xxwdt_init(void)
350 /* We cannot reserve 0x45 - the kernel already has! */ 347 /* We cannot reserve 0x45 - the kernel already has! */
351 if (wdt_stop != 0x45 && wdt_stop != wdt_start) { 348 if (wdt_stop != 0x45 && wdt_stop != wdt_start) {
352 if (!request_region(wdt_stop, 1, "SBC 60XX WDT")) { 349 if (!request_region(wdt_stop, 1, "SBC 60XX WDT")) {
353 printk(KERN_ERR PFX 350 pr_err("I/O address 0x%04x already in use\n", wdt_stop);
354 "I/O address 0x%04x already in use\n",
355 wdt_stop);
356 rc = -EIO; 351 rc = -EIO;
357 goto err_out_region1; 352 goto err_out_region1;
358 } 353 }
@@ -360,21 +355,18 @@ static int __init sbc60xxwdt_init(void)
360 355
361 rc = register_reboot_notifier(&wdt_notifier); 356 rc = register_reboot_notifier(&wdt_notifier);
362 if (rc) { 357 if (rc) {
363 printk(KERN_ERR PFX 358 pr_err("cannot register reboot notifier (err=%d)\n", rc);
364 "cannot register reboot notifier (err=%d)\n", rc);
365 goto err_out_region2; 359 goto err_out_region2;
366 } 360 }
367 361
368 rc = misc_register(&wdt_miscdev); 362 rc = misc_register(&wdt_miscdev);
369 if (rc) { 363 if (rc) {
370 printk(KERN_ERR PFX 364 pr_err("cannot register miscdev on minor=%d (err=%d)\n",
371 "cannot register miscdev on minor=%d (err=%d)\n", 365 wdt_miscdev.minor, rc);
372 wdt_miscdev.minor, rc);
373 goto err_out_reboot; 366 goto err_out_reboot;
374 } 367 }
375 printk(KERN_INFO PFX 368 pr_info("WDT driver for 60XX single board computer initialised. timeout=%d sec (nowayout=%d)\n",
376 "WDT driver for 60XX single board computer initialised. " 369 timeout, nowayout);
377 "timeout=%d sec (nowayout=%d)\n", timeout, nowayout);
378 370
379 return 0; 371 return 0;
380 372