diff options
Diffstat (limited to 'drivers/watchdog/eurotechwdt.c')
-rw-r--r-- | drivers/watchdog/eurotechwdt.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/drivers/watchdog/eurotechwdt.c b/drivers/watchdog/eurotechwdt.c index 3946c51099c0..cd31b8a2a729 100644 --- a/drivers/watchdog/eurotechwdt.c +++ b/drivers/watchdog/eurotechwdt.c | |||
@@ -45,6 +45,8 @@ | |||
45 | * of the on-board SUPER I/O device SMSC FDC 37B782. | 45 | * of the on-board SUPER I/O device SMSC FDC 37B782. |
46 | */ | 46 | */ |
47 | 47 | ||
48 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
49 | |||
48 | #include <linux/interrupt.h> | 50 | #include <linux/interrupt.h> |
49 | #include <linux/module.h> | 51 | #include <linux/module.h> |
50 | #include <linux/moduleparam.h> | 52 | #include <linux/moduleparam.h> |
@@ -59,7 +61,6 @@ | |||
59 | #include <linux/io.h> | 61 | #include <linux/io.h> |
60 | #include <linux/uaccess.h> | 62 | #include <linux/uaccess.h> |
61 | 63 | ||
62 | #include <asm/system.h> | ||
63 | 64 | ||
64 | static unsigned long eurwdt_is_open; | 65 | static unsigned long eurwdt_is_open; |
65 | static int eurwdt_timeout; | 66 | static int eurwdt_timeout; |
@@ -76,8 +77,8 @@ static char *ev = "int"; | |||
76 | 77 | ||
77 | #define WDT_TIMEOUT 60 /* 1 minute */ | 78 | #define WDT_TIMEOUT 60 /* 1 minute */ |
78 | 79 | ||
79 | static int nowayout = WATCHDOG_NOWAYOUT; | 80 | static bool nowayout = WATCHDOG_NOWAYOUT; |
80 | module_param(nowayout, int, 0); | 81 | module_param(nowayout, bool, 0); |
81 | MODULE_PARM_DESC(nowayout, | 82 | MODULE_PARM_DESC(nowayout, |
82 | "Watchdog cannot be stopped once started (default=" | 83 | "Watchdog cannot be stopped once started (default=" |
83 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 84 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -144,11 +145,11 @@ static void eurwdt_activate_timer(void) | |||
144 | 145 | ||
145 | /* Setting interrupt line */ | 146 | /* Setting interrupt line */ |
146 | if (irq == 2 || irq > 15 || irq < 0) { | 147 | if (irq == 2 || irq > 15 || irq < 0) { |
147 | printk(KERN_ERR ": invalid irq number\n"); | 148 | pr_err("invalid irq number\n"); |
148 | irq = 0; /* if invalid we disable interrupt */ | 149 | irq = 0; /* if invalid we disable interrupt */ |
149 | } | 150 | } |
150 | if (irq == 0) | 151 | if (irq == 0) |
151 | printk(KERN_INFO ": interrupt disabled\n"); | 152 | pr_info("interrupt disabled\n"); |
152 | 153 | ||
153 | eurwdt_write_reg(WDT_TIMER_CFG, irq << 4); | 154 | eurwdt_write_reg(WDT_TIMER_CFG, irq << 4); |
154 | 155 | ||
@@ -163,12 +164,12 @@ static void eurwdt_activate_timer(void) | |||
163 | 164 | ||
164 | static irqreturn_t eurwdt_interrupt(int irq, void *dev_id) | 165 | static irqreturn_t eurwdt_interrupt(int irq, void *dev_id) |
165 | { | 166 | { |
166 | printk(KERN_CRIT "timeout WDT timeout\n"); | 167 | pr_crit("timeout WDT timeout\n"); |
167 | 168 | ||
168 | #ifdef ONLY_TESTING | 169 | #ifdef ONLY_TESTING |
169 | printk(KERN_CRIT "Would Reboot.\n"); | 170 | pr_crit("Would Reboot\n"); |
170 | #else | 171 | #else |
171 | printk(KERN_CRIT "Initiating system reboot.\n"); | 172 | pr_crit("Initiating system reboot\n"); |
172 | emergency_restart(); | 173 | emergency_restart(); |
173 | #endif | 174 | #endif |
174 | return IRQ_HANDLED; | 175 | return IRQ_HANDLED; |
@@ -335,8 +336,7 @@ static int eurwdt_release(struct inode *inode, struct file *file) | |||
335 | if (eur_expect_close == 42) | 336 | if (eur_expect_close == 42) |
336 | eurwdt_disable_timer(); | 337 | eurwdt_disable_timer(); |
337 | else { | 338 | else { |
338 | printk(KERN_CRIT | 339 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
339 | "eurwdt: Unexpected close, not stopping watchdog!\n"); | ||
340 | eurwdt_ping(); | 340 | eurwdt_ping(); |
341 | } | 341 | } |
342 | clear_bit(0, &eurwdt_is_open); | 342 | clear_bit(0, &eurwdt_is_open); |
@@ -429,35 +429,32 @@ static int __init eurwdt_init(void) | |||
429 | 429 | ||
430 | ret = request_irq(irq, eurwdt_interrupt, 0, "eurwdt", NULL); | 430 | ret = request_irq(irq, eurwdt_interrupt, 0, "eurwdt", NULL); |
431 | if (ret) { | 431 | if (ret) { |
432 | printk(KERN_ERR "eurwdt: IRQ %d is not free.\n", irq); | 432 | pr_err("IRQ %d is not free\n", irq); |
433 | goto out; | 433 | goto out; |
434 | } | 434 | } |
435 | 435 | ||
436 | if (!request_region(io, 2, "eurwdt")) { | 436 | if (!request_region(io, 2, "eurwdt")) { |
437 | printk(KERN_ERR "eurwdt: IO %X is not free.\n", io); | 437 | pr_err("IO %X is not free\n", io); |
438 | ret = -EBUSY; | 438 | ret = -EBUSY; |
439 | goto outirq; | 439 | goto outirq; |
440 | } | 440 | } |
441 | 441 | ||
442 | ret = register_reboot_notifier(&eurwdt_notifier); | 442 | ret = register_reboot_notifier(&eurwdt_notifier); |
443 | if (ret) { | 443 | if (ret) { |
444 | printk(KERN_ERR | 444 | pr_err("can't register reboot notifier (err=%d)\n", ret); |
445 | "eurwdt: can't register reboot notifier (err=%d)\n", ret); | ||
446 | goto outreg; | 445 | goto outreg; |
447 | } | 446 | } |
448 | 447 | ||
449 | ret = misc_register(&eurwdt_miscdev); | 448 | ret = misc_register(&eurwdt_miscdev); |
450 | if (ret) { | 449 | if (ret) { |
451 | printk(KERN_ERR "eurwdt: can't misc_register on minor=%d\n", | 450 | pr_err("can't misc_register on minor=%d\n", WATCHDOG_MINOR); |
452 | WATCHDOG_MINOR); | ||
453 | goto outreboot; | 451 | goto outreboot; |
454 | } | 452 | } |
455 | 453 | ||
456 | eurwdt_unlock_chip(); | 454 | eurwdt_unlock_chip(); |
457 | 455 | ||
458 | ret = 0; | 456 | ret = 0; |
459 | printk(KERN_INFO "Eurotech WDT driver 0.01 at %X (Interrupt %d)" | 457 | pr_info("Eurotech WDT driver 0.01 at %X (Interrupt %d) - timeout event: %s\n", |
460 | " - timeout event: %s\n", | ||
461 | io, irq, (!strcmp("int", ev) ? "int" : "reboot")); | 458 | io, irq, (!strcmp("int", ev) ? "int" : "reboot")); |
462 | 459 | ||
463 | out: | 460 | out: |