diff options
Diffstat (limited to 'drivers/watchdog/pnx833x_wdt.c')
-rw-r--r-- | drivers/watchdog/pnx833x_wdt.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/drivers/watchdog/pnx833x_wdt.c b/drivers/watchdog/pnx833x_wdt.c index a7b5ad2a98bd..1b62a7dfcc95 100644 --- a/drivers/watchdog/pnx833x_wdt.c +++ b/drivers/watchdog/pnx833x_wdt.c | |||
@@ -17,6 +17,8 @@ | |||
17 | * based on softdog.c by Alan Cox <alan@redhat.com> | 17 | * based on softdog.c by Alan Cox <alan@redhat.com> |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
21 | |||
20 | #include <linux/module.h> | 22 | #include <linux/module.h> |
21 | #include <linux/moduleparam.h> | 23 | #include <linux/moduleparam.h> |
22 | #include <linux/types.h> | 24 | #include <linux/types.h> |
@@ -30,7 +32,6 @@ | |||
30 | #include <linux/init.h> | 32 | #include <linux/init.h> |
31 | #include <asm/mach-pnx833x/pnx833x.h> | 33 | #include <asm/mach-pnx833x/pnx833x.h> |
32 | 34 | ||
33 | #define PFX "pnx833x: " | ||
34 | #define WATCHDOG_TIMEOUT 30 /* 30 sec Maximum timeout */ | 35 | #define WATCHDOG_TIMEOUT 30 /* 30 sec Maximum timeout */ |
35 | #define WATCHDOG_COUNT_FREQUENCY 68000000U /* Watchdog counts at 68MHZ. */ | 36 | #define WATCHDOG_COUNT_FREQUENCY 68000000U /* Watchdog counts at 68MHZ. */ |
36 | #define PNX_WATCHDOG_TIMEOUT (WATCHDOG_TIMEOUT * WATCHDOG_COUNT_FREQUENCY) | 37 | #define PNX_WATCHDOG_TIMEOUT (WATCHDOG_TIMEOUT * WATCHDOG_COUNT_FREQUENCY) |
@@ -54,8 +55,8 @@ module_param(pnx833x_wdt_timeout, int, 0); | |||
54 | MODULE_PARM_DESC(timeout, "Watchdog timeout in Mhz. (68Mhz clock), default=" | 55 | MODULE_PARM_DESC(timeout, "Watchdog timeout in Mhz. (68Mhz clock), default=" |
55 | __MODULE_STRING(PNX_TIMEOUT_VALUE) "(30 seconds)."); | 56 | __MODULE_STRING(PNX_TIMEOUT_VALUE) "(30 seconds)."); |
56 | 57 | ||
57 | static int nowayout = WATCHDOG_NOWAYOUT; | 58 | static bool nowayout = WATCHDOG_NOWAYOUT; |
58 | module_param(nowayout, int, 0); | 59 | module_param(nowayout, bool, 0); |
59 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | 60 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" |
60 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 61 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
61 | 62 | ||
@@ -76,7 +77,7 @@ static void pnx833x_wdt_start(void) | |||
76 | PNX833X_REG(PNX833X_CONFIG + | 77 | PNX833X_REG(PNX833X_CONFIG + |
77 | PNX833X_CONFIG_CPU_COUNTERS_CONTROL) |= 0x1; | 78 | PNX833X_CONFIG_CPU_COUNTERS_CONTROL) |= 0x1; |
78 | 79 | ||
79 | printk(KERN_INFO PFX "Started watchdog timer.\n"); | 80 | pr_info("Started watchdog timer\n"); |
80 | } | 81 | } |
81 | 82 | ||
82 | static void pnx833x_wdt_stop(void) | 83 | static void pnx833x_wdt_stop(void) |
@@ -87,7 +88,7 @@ static void pnx833x_wdt_stop(void) | |||
87 | PNX833X_REG(PNX833X_CONFIG + | 88 | PNX833X_REG(PNX833X_CONFIG + |
88 | PNX833X_CONFIG_CPU_COUNTERS_CONTROL) &= 0xFFFFFFFE; | 89 | PNX833X_CONFIG_CPU_COUNTERS_CONTROL) &= 0xFFFFFFFE; |
89 | 90 | ||
90 | printk(KERN_INFO PFX "Stopped watchdog timer.\n"); | 91 | pr_info("Stopped watchdog timer\n"); |
91 | } | 92 | } |
92 | 93 | ||
93 | static void pnx833x_wdt_ping(void) | 94 | static void pnx833x_wdt_ping(void) |
@@ -113,7 +114,7 @@ static int pnx833x_wdt_open(struct inode *inode, struct file *file) | |||
113 | 114 | ||
114 | pnx833x_wdt_ping(); | 115 | pnx833x_wdt_ping(); |
115 | 116 | ||
116 | printk(KERN_INFO "Started watchdog timer.\n"); | 117 | pr_info("Started watchdog timer\n"); |
117 | 118 | ||
118 | return nonseekable_open(inode, file); | 119 | return nonseekable_open(inode, file); |
119 | } | 120 | } |
@@ -232,9 +233,6 @@ static struct notifier_block pnx833x_wdt_notifier = { | |||
232 | .notifier_call = pnx833x_wdt_notify_sys, | 233 | .notifier_call = pnx833x_wdt_notify_sys, |
233 | }; | 234 | }; |
234 | 235 | ||
235 | static char banner[] __initdata = | ||
236 | KERN_INFO PFX "Hardware Watchdog Timer for PNX833x: Version 0.1\n"; | ||
237 | |||
238 | static int __init watchdog_init(void) | 236 | static int __init watchdog_init(void) |
239 | { | 237 | { |
240 | int ret, cause; | 238 | int ret, cause; |
@@ -243,27 +241,25 @@ static int __init watchdog_init(void) | |||
243 | cause = PNX833X_REG(PNX833X_RESET); | 241 | cause = PNX833X_REG(PNX833X_RESET); |
244 | /*If bit 31 is set then watchdog was cause of reset.*/ | 242 | /*If bit 31 is set then watchdog was cause of reset.*/ |
245 | if (cause & 0x80000000) { | 243 | if (cause & 0x80000000) { |
246 | printk(KERN_INFO PFX "The system was previously reset due to " | 244 | pr_info("The system was previously reset due to the watchdog firing - please investigate...\n"); |
247 | "the watchdog firing - please investigate...\n"); | ||
248 | } | 245 | } |
249 | 246 | ||
250 | ret = register_reboot_notifier(&pnx833x_wdt_notifier); | 247 | ret = register_reboot_notifier(&pnx833x_wdt_notifier); |
251 | if (ret) { | 248 | if (ret) { |
252 | printk(KERN_ERR PFX | 249 | pr_err("cannot register reboot notifier (err=%d)\n", ret); |
253 | "cannot register reboot notifier (err=%d)\n", ret); | ||
254 | return ret; | 250 | return ret; |
255 | } | 251 | } |
256 | 252 | ||
257 | ret = misc_register(&pnx833x_wdt_miscdev); | 253 | ret = misc_register(&pnx833x_wdt_miscdev); |
258 | if (ret) { | 254 | if (ret) { |
259 | printk(KERN_ERR PFX | 255 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
260 | "cannot register miscdev on minor=%d (err=%d)\n", | 256 | WATCHDOG_MINOR, ret); |
261 | WATCHDOG_MINOR, ret); | ||
262 | unregister_reboot_notifier(&pnx833x_wdt_notifier); | 257 | unregister_reboot_notifier(&pnx833x_wdt_notifier); |
263 | return ret; | 258 | return ret; |
264 | } | 259 | } |
265 | 260 | ||
266 | printk(banner); | 261 | pr_info("Hardware Watchdog Timer for PNX833x: Version 0.1\n"); |
262 | |||
267 | if (start_enabled) | 263 | if (start_enabled) |
268 | pnx833x_wdt_start(); | 264 | pnx833x_wdt_start(); |
269 | 265 | ||