diff options
Diffstat (limited to 'drivers/watchdog/it8712f_wdt.c')
-rw-r--r-- | drivers/watchdog/it8712f_wdt.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/drivers/watchdog/it8712f_wdt.c b/drivers/watchdog/it8712f_wdt.c index 8d2d8502d3e8..f4cce6d66a55 100644 --- a/drivers/watchdog/it8712f_wdt.c +++ b/drivers/watchdog/it8712f_wdt.c | |||
@@ -20,6 +20,8 @@ | |||
20 | * software is provided AS-IS with no warranties. | 20 | * software is provided AS-IS with no warranties. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
24 | |||
23 | #include <linux/module.h> | 25 | #include <linux/module.h> |
24 | #include <linux/moduleparam.h> | 26 | #include <linux/moduleparam.h> |
25 | #include <linux/init.h> | 27 | #include <linux/init.h> |
@@ -33,6 +35,7 @@ | |||
33 | #include <linux/io.h> | 35 | #include <linux/io.h> |
34 | #include <linux/ioport.h> | 36 | #include <linux/ioport.h> |
35 | 37 | ||
38 | #define DEBUG | ||
36 | #define NAME "it8712f_wdt" | 39 | #define NAME "it8712f_wdt" |
37 | 40 | ||
38 | MODULE_AUTHOR("Jorge Boncompte - DTI2 <jorge@dti2.net>"); | 41 | MODULE_AUTHOR("Jorge Boncompte - DTI2 <jorge@dti2.net>"); |
@@ -45,8 +48,8 @@ static int margin = 60; /* in seconds */ | |||
45 | module_param(margin, int, 0); | 48 | module_param(margin, int, 0); |
46 | MODULE_PARM_DESC(margin, "Watchdog margin in seconds"); | 49 | MODULE_PARM_DESC(margin, "Watchdog margin in seconds"); |
47 | 50 | ||
48 | static int nowayout = WATCHDOG_NOWAYOUT; | 51 | static bool nowayout = WATCHDOG_NOWAYOUT; |
49 | module_param(nowayout, int, 0); | 52 | module_param(nowayout, bool, 0); |
50 | MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close"); | 53 | MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close"); |
51 | 54 | ||
52 | static unsigned long wdt_open; | 55 | static unsigned long wdt_open; |
@@ -158,10 +161,10 @@ static void it8712f_wdt_update_margin(void) | |||
158 | */ | 161 | */ |
159 | if (units <= max_units) { | 162 | if (units <= max_units) { |
160 | config |= WDT_UNIT_SEC; /* else UNIT is MINUTES */ | 163 | config |= WDT_UNIT_SEC; /* else UNIT is MINUTES */ |
161 | printk(KERN_INFO NAME ": timer margin %d seconds\n", units); | 164 | pr_info("timer margin %d seconds\n", units); |
162 | } else { | 165 | } else { |
163 | units /= 60; | 166 | units /= 60; |
164 | printk(KERN_INFO NAME ": timer margin %d minutes\n", units); | 167 | pr_info("timer margin %d minutes\n", units); |
165 | } | 168 | } |
166 | superio_outb(config, WDT_CONFIG); | 169 | superio_outb(config, WDT_CONFIG); |
167 | 170 | ||
@@ -184,7 +187,7 @@ static int it8712f_wdt_enable(void) | |||
184 | if (ret) | 187 | if (ret) |
185 | return ret; | 188 | return ret; |
186 | 189 | ||
187 | printk(KERN_DEBUG NAME ": enabling watchdog timer\n"); | 190 | pr_debug("enabling watchdog timer\n"); |
188 | superio_select(LDN_GPIO); | 191 | superio_select(LDN_GPIO); |
189 | 192 | ||
190 | superio_outb(wdt_control_reg, WDT_CONTROL); | 193 | superio_outb(wdt_control_reg, WDT_CONTROL); |
@@ -204,7 +207,7 @@ static int it8712f_wdt_disable(void) | |||
204 | if (ret) | 207 | if (ret) |
205 | return ret; | 208 | return ret; |
206 | 209 | ||
207 | printk(KERN_DEBUG NAME ": disabling watchdog timer\n"); | 210 | pr_debug("disabling watchdog timer\n"); |
208 | superio_select(LDN_GPIO); | 211 | superio_select(LDN_GPIO); |
209 | 212 | ||
210 | superio_outb(0, WDT_CONFIG); | 213 | superio_outb(0, WDT_CONFIG); |
@@ -331,12 +334,10 @@ static int it8712f_wdt_open(struct inode *inode, struct file *file) | |||
331 | static int it8712f_wdt_release(struct inode *inode, struct file *file) | 334 | static int it8712f_wdt_release(struct inode *inode, struct file *file) |
332 | { | 335 | { |
333 | if (expect_close != 42) { | 336 | if (expect_close != 42) { |
334 | printk(KERN_WARNING NAME | 337 | pr_warn("watchdog device closed unexpectedly, will not disable the watchdog timer\n"); |
335 | ": watchdog device closed unexpectedly, will not" | ||
336 | " disable the watchdog timer\n"); | ||
337 | } else if (!nowayout) { | 338 | } else if (!nowayout) { |
338 | if (it8712f_wdt_disable()) | 339 | if (it8712f_wdt_disable()) |
339 | printk(KERN_WARNING NAME "Watchdog disable failed\n"); | 340 | pr_warn("Watchdog disable failed\n"); |
340 | } | 341 | } |
341 | expect_close = 0; | 342 | expect_close = 0; |
342 | clear_bit(0, &wdt_open); | 343 | clear_bit(0, &wdt_open); |
@@ -374,13 +375,13 @@ static int __init it8712f_wdt_find(unsigned short *address) | |||
374 | superio_select(LDN_GAME); | 375 | superio_select(LDN_GAME); |
375 | superio_outb(1, ACT_REG); | 376 | superio_outb(1, ACT_REG); |
376 | if (!(superio_inb(ACT_REG) & 0x01)) { | 377 | if (!(superio_inb(ACT_REG) & 0x01)) { |
377 | printk(KERN_ERR NAME ": Device not activated, skipping\n"); | 378 | pr_err("Device not activated, skipping\n"); |
378 | goto exit; | 379 | goto exit; |
379 | } | 380 | } |
380 | 381 | ||
381 | *address = superio_inw(BASE_REG); | 382 | *address = superio_inw(BASE_REG); |
382 | if (*address == 0) { | 383 | if (*address == 0) { |
383 | printk(KERN_ERR NAME ": Base address not set, skipping\n"); | 384 | pr_err("Base address not set, skipping\n"); |
384 | goto exit; | 385 | goto exit; |
385 | } | 386 | } |
386 | 387 | ||
@@ -394,8 +395,7 @@ static int __init it8712f_wdt_find(unsigned short *address) | |||
394 | if (margin > (max_units * 60)) | 395 | if (margin > (max_units * 60)) |
395 | margin = (max_units * 60); | 396 | margin = (max_units * 60); |
396 | 397 | ||
397 | printk(KERN_INFO NAME ": Found IT%04xF chip revision %d - " | 398 | pr_info("Found IT%04xF chip revision %d - using DogFood address 0x%x\n", |
398 | "using DogFood address 0x%x\n", | ||
399 | chip_type, revision, *address); | 399 | chip_type, revision, *address); |
400 | 400 | ||
401 | exit: | 401 | exit: |
@@ -411,27 +411,26 @@ static int __init it8712f_wdt_init(void) | |||
411 | return -ENODEV; | 411 | return -ENODEV; |
412 | 412 | ||
413 | if (!request_region(address, 1, "IT8712F Watchdog")) { | 413 | if (!request_region(address, 1, "IT8712F Watchdog")) { |
414 | printk(KERN_WARNING NAME ": watchdog I/O region busy\n"); | 414 | pr_warn("watchdog I/O region busy\n"); |
415 | return -EBUSY; | 415 | return -EBUSY; |
416 | } | 416 | } |
417 | 417 | ||
418 | err = it8712f_wdt_disable(); | 418 | err = it8712f_wdt_disable(); |
419 | if (err) { | 419 | if (err) { |
420 | printk(KERN_ERR NAME ": unable to disable watchdog timer.\n"); | 420 | pr_err("unable to disable watchdog timer\n"); |
421 | goto out; | 421 | goto out; |
422 | } | 422 | } |
423 | 423 | ||
424 | err = register_reboot_notifier(&it8712f_wdt_notifier); | 424 | err = register_reboot_notifier(&it8712f_wdt_notifier); |
425 | if (err) { | 425 | if (err) { |
426 | printk(KERN_ERR NAME ": unable to register reboot notifier\n"); | 426 | pr_err("unable to register reboot notifier\n"); |
427 | goto out; | 427 | goto out; |
428 | } | 428 | } |
429 | 429 | ||
430 | err = misc_register(&it8712f_wdt_miscdev); | 430 | err = misc_register(&it8712f_wdt_miscdev); |
431 | if (err) { | 431 | if (err) { |
432 | printk(KERN_ERR NAME | 432 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
433 | ": cannot register miscdev on minor=%d (err=%d)\n", | 433 | WATCHDOG_MINOR, err); |
434 | WATCHDOG_MINOR, err); | ||
435 | goto reboot_out; | 434 | goto reboot_out; |
436 | } | 435 | } |
437 | 436 | ||