aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/softdog.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-02-15 18:06:19 -0500
committerWim Van Sebroeck <wim@iguana.be>2012-03-27 13:59:26 -0400
commit27c766aaacb265d625dc634bf7903f7f9fd0c697 (patch)
tree06b399d21dec006bc0a3e1c6685b076753e19b94 /drivers/watchdog/softdog.c
parent7cbc353540c31ffaf65ad44d89b955be0f1d04dc (diff)
watchdog: Use pr_<fmt> and pr_<level>
Use the current logging styles. Make sure all output has a prefix. Add missing newlines. Remove now unnecessary PFX, NAME, and miscellaneous other #defines. Coalesce formats. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog/softdog.c')
-rw-r--r--drivers/watchdog/softdog.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c
index bf16ffb4d21e..a1adc8c87832 100644
--- a/drivers/watchdog/softdog.c
+++ b/drivers/watchdog/softdog.c
@@ -36,6 +36,8 @@
36 * Added Matt Domsch's nowayout module option. 36 * Added Matt Domsch's nowayout module option.
37 */ 37 */
38 38
39#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
40
39#include <linux/module.h> 41#include <linux/module.h>
40#include <linux/moduleparam.h> 42#include <linux/moduleparam.h>
41#include <linux/types.h> 43#include <linux/types.h>
@@ -50,8 +52,6 @@
50#include <linux/uaccess.h> 52#include <linux/uaccess.h>
51#include <linux/kernel.h> 53#include <linux/kernel.h>
52 54
53#define PFX "SoftDog: "
54
55#define TIMER_MARGIN 60 /* Default is 60 seconds */ 55#define TIMER_MARGIN 60 /* Default is 60 seconds */
56static int soft_margin = TIMER_MARGIN; /* in seconds */ 56static int soft_margin = TIMER_MARGIN; /* in seconds */
57module_param(soft_margin, int, 0); 57module_param(soft_margin, int, 0);
@@ -103,14 +103,14 @@ static void watchdog_fire(unsigned long data)
103 module_put(THIS_MODULE); 103 module_put(THIS_MODULE);
104 104
105 if (soft_noboot) 105 if (soft_noboot)
106 printk(KERN_CRIT PFX "Triggered - Reboot ignored.\n"); 106 pr_crit("Triggered - Reboot ignored\n");
107 else if (soft_panic) { 107 else if (soft_panic) {
108 printk(KERN_CRIT PFX "Initiating panic.\n"); 108 pr_crit("Initiating panic\n");
109 panic("Software Watchdog Timer expired."); 109 panic("Software Watchdog Timer expired");
110 } else { 110 } else {
111 printk(KERN_CRIT PFX "Initiating system reboot.\n"); 111 pr_crit("Initiating system reboot\n");
112 emergency_restart(); 112 emergency_restart();
113 printk(KERN_CRIT PFX "Reboot didn't ?????\n"); 113 pr_crit("Reboot didn't ?????\n");
114 } 114 }
115} 115}
116 116
@@ -166,8 +166,7 @@ static int softdog_release(struct inode *inode, struct file *file)
166 softdog_stop(); 166 softdog_stop();
167 module_put(THIS_MODULE); 167 module_put(THIS_MODULE);
168 } else { 168 } else {
169 printk(KERN_CRIT PFX 169 pr_crit("Unexpected close, not stopping watchdog!\n");
170 "Unexpected close, not stopping watchdog!\n");
171 set_bit(0, &orphan_timer); 170 set_bit(0, &orphan_timer);
172 softdog_keepalive(); 171 softdog_keepalive();
173 } 172 }
@@ -275,10 +274,6 @@ static struct notifier_block softdog_notifier = {
275 .notifier_call = softdog_notify_sys, 274 .notifier_call = softdog_notify_sys,
276}; 275};
277 276
278static char banner[] __initdata = KERN_INFO "Software Watchdog Timer: 0.07 "
279 "initialized. soft_noboot=%d soft_margin=%d sec soft_panic=%d "
280 "(nowayout= %d)\n";
281
282static int __init watchdog_init(void) 277static int __init watchdog_init(void)
283{ 278{
284 int ret; 279 int ret;
@@ -287,28 +282,26 @@ static int __init watchdog_init(void)
287 if not reset to the default */ 282 if not reset to the default */
288 if (softdog_set_heartbeat(soft_margin)) { 283 if (softdog_set_heartbeat(soft_margin)) {
289 softdog_set_heartbeat(TIMER_MARGIN); 284 softdog_set_heartbeat(TIMER_MARGIN);
290 printk(KERN_INFO PFX 285 pr_info("soft_margin must be 0 < soft_margin < 65536, using %d\n",
291 "soft_margin must be 0 < soft_margin < 65536, using %d\n",
292 TIMER_MARGIN); 286 TIMER_MARGIN);
293 } 287 }
294 288
295 ret = register_reboot_notifier(&softdog_notifier); 289 ret = register_reboot_notifier(&softdog_notifier);
296 if (ret) { 290 if (ret) {
297 printk(KERN_ERR PFX 291 pr_err("cannot register reboot notifier (err=%d)\n", ret);
298 "cannot register reboot notifier (err=%d)\n", ret);
299 return ret; 292 return ret;
300 } 293 }
301 294
302 ret = misc_register(&softdog_miscdev); 295 ret = misc_register(&softdog_miscdev);
303 if (ret) { 296 if (ret) {
304 printk(KERN_ERR PFX 297 pr_err("cannot register miscdev on minor=%d (err=%d)\n",
305 "cannot register miscdev on minor=%d (err=%d)\n", 298 WATCHDOG_MINOR, ret);
306 WATCHDOG_MINOR, ret);
307 unregister_reboot_notifier(&softdog_notifier); 299 unregister_reboot_notifier(&softdog_notifier);
308 return ret; 300 return ret;
309 } 301 }
310 302
311 printk(banner, soft_noboot, soft_margin, soft_panic, nowayout); 303 pr_info("Software Watchdog Timer: 0.07 initialized. soft_noboot=%d soft_margin=%d sec soft_panic=%d (nowayout= %d)\n",
304 soft_noboot, soft_margin, soft_panic, nowayout);
312 305
313 return 0; 306 return 0;
314} 307}