diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-28 16:03:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-28 16:03:26 -0400 |
commit | 750f77064a290beb162352077b52c61b04bcae0e (patch) | |
tree | 736a8dd043dc4cda298762a80e7c1fbf1bb87742 /drivers/watchdog/pc87413_wdt.c | |
parent | 89e5d6f0d979f6e7dc2bbb1ebd9e239217e2e952 (diff) | |
parent | b92c803ec61de59e6e4ab9b2748d8e633cec3f08 (diff) |
Merge git://www.linux-watchdog.org/linux-watchdog
Pull watchdog updates from Wim Van Sebroeck:
- Removal of the Documentation/watchdog/00-INDEX file
- Fix boot status reporting for imx2_wdt
- clean-up sp805_wdt, pnx4008_wdt and mpcore_wdt
- convert printk in watchdog drivers to pr_ functions
- change nowayout module parameter to bool for every watchdog device
- conversion of jz4740_wdt, pnx4008_wdt, max63xx_wdt, softdog,
ep93xx_wdt, coh901327 and txx9wdt to new watchdog API
- Add support for the WDIOC_GETTIMELEFT ioctl call to the new watchdog
API
- Change the new watchdog API so that the driver updates the timeout
value
- two fixes for the xen_wdt driver
Fix up conflicts in ep93xx driver due to the same patches being merged
through separate branches.
* git://www.linux-watchdog.org/linux-watchdog: (33 commits)
watchdog: txx9wdt: fix timeout
watchdog: Convert txx9wdt driver to watchdog framework
watchdog: coh901327_wdt.c: fix timeout
watchdog: coh901327: convert to use watchdog core
watchdog: Add support for WDIOC_GETTIMELEFT IOCTL in watchdog core
watchdog: ep93xx_wdt: timeout is an unsigned int value.
watchdog: ep93xx_wdt: Fix timeout after conversion to watchdog core
watchdog: Convert ep93xx driver to watchdog core
watchdog: sp805: Use devm routines
watchdog: sp805: replace readl/writel with lighter _relaxed variants
watchdog: sp805: Fix documentation style comment
watchdog: mpcore_wdt: Allow platform_get_irq() to fail
watchdog: mpcore_wdt: Use devm routines
watchdog: mpcore_wdt: Rename dev to pdev for pointing to struct platform_device
watchdog: xen: don't clear is_active when xen_wdt_stop() failed
watchdog: xen: don't unconditionally enable the watchdog during resume
watchdog: fix compiler error for missing parenthesis
watchdog: ep93xx_wdt.c: fix platform probe
watchdog: ep93xx: Convert the watchdog driver into a platform device.
watchdog: fix set_timeout operations
...
Diffstat (limited to 'drivers/watchdog/pc87413_wdt.c')
-rw-r--r-- | drivers/watchdog/pc87413_wdt.c | 57 |
1 files changed, 26 insertions, 31 deletions
diff --git a/drivers/watchdog/pc87413_wdt.c b/drivers/watchdog/pc87413_wdt.c index e78d89986768..d5bf112e0077 100644 --- a/drivers/watchdog/pc87413_wdt.c +++ b/drivers/watchdog/pc87413_wdt.c | |||
@@ -18,6 +18,8 @@ | |||
18 | * Release 1.1 | 18 | * Release 1.1 |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
22 | |||
21 | #include <linux/module.h> | 23 | #include <linux/module.h> |
22 | #include <linux/types.h> | 24 | #include <linux/types.h> |
23 | #include <linux/miscdevice.h> | 25 | #include <linux/miscdevice.h> |
@@ -42,7 +44,6 @@ | |||
42 | 44 | ||
43 | #define VERSION "1.1" | 45 | #define VERSION "1.1" |
44 | #define MODNAME "pc87413 WDT" | 46 | #define MODNAME "pc87413 WDT" |
45 | #define PFX MODNAME ": " | ||
46 | #define DPFX MODNAME " - DEBUG: " | 47 | #define DPFX MODNAME " - DEBUG: " |
47 | 48 | ||
48 | #define WDT_INDEX_IO_PORT (io+0) /* I/O port base (index register) */ | 49 | #define WDT_INDEX_IO_PORT (io+0) /* I/O port base (index register) */ |
@@ -65,7 +66,7 @@ static char expect_close; /* is the close expected? */ | |||
65 | 66 | ||
66 | static DEFINE_SPINLOCK(io_lock); /* to guard us from io races */ | 67 | static DEFINE_SPINLOCK(io_lock); /* to guard us from io races */ |
67 | 68 | ||
68 | static int nowayout = WATCHDOG_NOWAYOUT; | 69 | static bool nowayout = WATCHDOG_NOWAYOUT; |
69 | 70 | ||
70 | /* -- Low level function ----------------------------------------*/ | 71 | /* -- Low level function ----------------------------------------*/ |
71 | 72 | ||
@@ -87,7 +88,7 @@ static inline void pc87413_select_wdt_out(void) | |||
87 | outb_p(cr_data, WDT_DATA_IO_PORT); | 88 | outb_p(cr_data, WDT_DATA_IO_PORT); |
88 | 89 | ||
89 | #ifdef DEBUG | 90 | #ifdef DEBUG |
90 | printk(KERN_INFO DPFX | 91 | pr_info(DPFX |
91 | "Select multiple pin,pin55,as WDT output: Bit7 to 1: %d\n", | 92 | "Select multiple pin,pin55,as WDT output: Bit7 to 1: %d\n", |
92 | cr_data); | 93 | cr_data); |
93 | #endif | 94 | #endif |
@@ -111,7 +112,7 @@ static inline void pc87413_enable_swc(void) | |||
111 | outb_p(cr_data, WDT_DATA_IO_PORT); /* Index0x30_bit0P1 */ | 112 | outb_p(cr_data, WDT_DATA_IO_PORT); /* Index0x30_bit0P1 */ |
112 | 113 | ||
113 | #ifdef DEBUG | 114 | #ifdef DEBUG |
114 | printk(KERN_INFO DPFX "pc87413 - Enable SWC functions\n"); | 115 | pr_info(DPFX "pc87413 - Enable SWC functions\n"); |
115 | #endif | 116 | #endif |
116 | } | 117 | } |
117 | 118 | ||
@@ -132,7 +133,7 @@ static void pc87413_get_swc_base_addr(void) | |||
132 | 133 | ||
133 | swc_base_addr = (addr_h << 8) + addr_l; | 134 | swc_base_addr = (addr_h << 8) + addr_l; |
134 | #ifdef DEBUG | 135 | #ifdef DEBUG |
135 | printk(KERN_INFO DPFX | 136 | pr_info(DPFX |
136 | "Read SWC I/O Base Address: low %d, high %d, res %d\n", | 137 | "Read SWC I/O Base Address: low %d, high %d, res %d\n", |
137 | addr_l, addr_h, swc_base_addr); | 138 | addr_l, addr_h, swc_base_addr); |
138 | #endif | 139 | #endif |
@@ -145,7 +146,7 @@ static inline void pc87413_swc_bank3(void) | |||
145 | /* Step 4: Select Bank3 of SWC */ | 146 | /* Step 4: Select Bank3 of SWC */ |
146 | outb_p(inb(swc_base_addr + 0x0f) | 0x03, swc_base_addr + 0x0f); | 147 | outb_p(inb(swc_base_addr + 0x0f) | 0x03, swc_base_addr + 0x0f); |
147 | #ifdef DEBUG | 148 | #ifdef DEBUG |
148 | printk(KERN_INFO DPFX "Select Bank3 of SWC\n"); | 149 | pr_info(DPFX "Select Bank3 of SWC\n"); |
149 | #endif | 150 | #endif |
150 | } | 151 | } |
151 | 152 | ||
@@ -156,7 +157,7 @@ static inline void pc87413_programm_wdto(char pc87413_time) | |||
156 | /* Step 5: Programm WDTO, Twd. */ | 157 | /* Step 5: Programm WDTO, Twd. */ |
157 | outb_p(pc87413_time, swc_base_addr + WDTO); | 158 | outb_p(pc87413_time, swc_base_addr + WDTO); |
158 | #ifdef DEBUG | 159 | #ifdef DEBUG |
159 | printk(KERN_INFO DPFX "Set WDTO to %d minutes\n", pc87413_time); | 160 | pr_info(DPFX "Set WDTO to %d minutes\n", pc87413_time); |
160 | #endif | 161 | #endif |
161 | } | 162 | } |
162 | 163 | ||
@@ -167,7 +168,7 @@ static inline void pc87413_enable_wden(void) | |||
167 | /* Step 6: Enable WDEN */ | 168 | /* Step 6: Enable WDEN */ |
168 | outb_p(inb(swc_base_addr + WDCTL) | 0x01, swc_base_addr + WDCTL); | 169 | outb_p(inb(swc_base_addr + WDCTL) | 0x01, swc_base_addr + WDCTL); |
169 | #ifdef DEBUG | 170 | #ifdef DEBUG |
170 | printk(KERN_INFO DPFX "Enable WDEN\n"); | 171 | pr_info(DPFX "Enable WDEN\n"); |
171 | #endif | 172 | #endif |
172 | } | 173 | } |
173 | 174 | ||
@@ -177,7 +178,7 @@ static inline void pc87413_enable_sw_wd_tren(void) | |||
177 | /* Enable SW_WD_TREN */ | 178 | /* Enable SW_WD_TREN */ |
178 | outb_p(inb(swc_base_addr + WDCFG) | 0x80, swc_base_addr + WDCFG); | 179 | outb_p(inb(swc_base_addr + WDCFG) | 0x80, swc_base_addr + WDCFG); |
179 | #ifdef DEBUG | 180 | #ifdef DEBUG |
180 | printk(KERN_INFO DPFX "Enable SW_WD_TREN\n"); | 181 | pr_info(DPFX "Enable SW_WD_TREN\n"); |
181 | #endif | 182 | #endif |
182 | } | 183 | } |
183 | 184 | ||
@@ -188,7 +189,7 @@ static inline void pc87413_disable_sw_wd_tren(void) | |||
188 | /* Disable SW_WD_TREN */ | 189 | /* Disable SW_WD_TREN */ |
189 | outb_p(inb(swc_base_addr + WDCFG) & 0x7f, swc_base_addr + WDCFG); | 190 | outb_p(inb(swc_base_addr + WDCFG) & 0x7f, swc_base_addr + WDCFG); |
190 | #ifdef DEBUG | 191 | #ifdef DEBUG |
191 | printk(KERN_INFO DPFX "pc87413 - Disable SW_WD_TREN\n"); | 192 | pr_info(DPFX "pc87413 - Disable SW_WD_TREN\n"); |
192 | #endif | 193 | #endif |
193 | } | 194 | } |
194 | 195 | ||
@@ -199,7 +200,7 @@ static inline void pc87413_enable_sw_wd_trg(void) | |||
199 | /* Enable SW_WD_TRG */ | 200 | /* Enable SW_WD_TRG */ |
200 | outb_p(inb(swc_base_addr + WDCTL) | 0x80, swc_base_addr + WDCTL); | 201 | outb_p(inb(swc_base_addr + WDCTL) | 0x80, swc_base_addr + WDCTL); |
201 | #ifdef DEBUG | 202 | #ifdef DEBUG |
202 | printk(KERN_INFO DPFX "pc87413 - Enable SW_WD_TRG\n"); | 203 | pr_info(DPFX "pc87413 - Enable SW_WD_TRG\n"); |
203 | #endif | 204 | #endif |
204 | } | 205 | } |
205 | 206 | ||
@@ -210,7 +211,7 @@ static inline void pc87413_disable_sw_wd_trg(void) | |||
210 | /* Disable SW_WD_TRG */ | 211 | /* Disable SW_WD_TRG */ |
211 | outb_p(inb(swc_base_addr + WDCTL) & 0x7f, swc_base_addr + WDCTL); | 212 | outb_p(inb(swc_base_addr + WDCTL) & 0x7f, swc_base_addr + WDCTL); |
212 | #ifdef DEBUG | 213 | #ifdef DEBUG |
213 | printk(KERN_INFO DPFX "Disable SW_WD_TRG\n"); | 214 | pr_info(DPFX "Disable SW_WD_TRG\n"); |
214 | #endif | 215 | #endif |
215 | } | 216 | } |
216 | 217 | ||
@@ -284,8 +285,7 @@ static int pc87413_open(struct inode *inode, struct file *file) | |||
284 | /* Reload and activate timer */ | 285 | /* Reload and activate timer */ |
285 | pc87413_refresh(); | 286 | pc87413_refresh(); |
286 | 287 | ||
287 | printk(KERN_INFO MODNAME | 288 | pr_info("Watchdog enabled. Timeout set to %d minute(s).\n", timeout); |
288 | "Watchdog enabled. Timeout set to %d minute(s).\n", timeout); | ||
289 | 289 | ||
290 | return nonseekable_open(inode, file); | 290 | return nonseekable_open(inode, file); |
291 | } | 291 | } |
@@ -308,11 +308,9 @@ static int pc87413_release(struct inode *inode, struct file *file) | |||
308 | 308 | ||
309 | if (expect_close == 42) { | 309 | if (expect_close == 42) { |
310 | pc87413_disable(); | 310 | pc87413_disable(); |
311 | printk(KERN_INFO MODNAME | 311 | pr_info("Watchdog disabled, sleeping again...\n"); |
312 | "Watchdog disabled, sleeping again...\n"); | ||
313 | } else { | 312 | } else { |
314 | printk(KERN_CRIT MODNAME | 313 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
315 | "Unexpected close, not stopping watchdog!\n"); | ||
316 | pc87413_refresh(); | 314 | pc87413_refresh(); |
317 | } | 315 | } |
318 | clear_bit(0, &timer_enabled); | 316 | clear_bit(0, &timer_enabled); |
@@ -428,7 +426,7 @@ static long pc87413_ioctl(struct file *file, unsigned int cmd, | |||
428 | case WDIOC_KEEPALIVE: | 426 | case WDIOC_KEEPALIVE: |
429 | pc87413_refresh(); | 427 | pc87413_refresh(); |
430 | #ifdef DEBUG | 428 | #ifdef DEBUG |
431 | printk(KERN_INFO DPFX "keepalive\n"); | 429 | pr_info(DPFX "keepalive\n"); |
432 | #endif | 430 | #endif |
433 | return 0; | 431 | return 0; |
434 | case WDIOC_SETTIMEOUT: | 432 | case WDIOC_SETTIMEOUT: |
@@ -508,7 +506,7 @@ static int __init pc87413_init(void) | |||
508 | { | 506 | { |
509 | int ret; | 507 | int ret; |
510 | 508 | ||
511 | printk(KERN_INFO PFX "Version " VERSION " at io 0x%X\n", | 509 | pr_info("Version " VERSION " at io 0x%X\n", |
512 | WDT_INDEX_IO_PORT); | 510 | WDT_INDEX_IO_PORT); |
513 | 511 | ||
514 | if (!request_muxed_region(io, 2, MODNAME)) | 512 | if (!request_muxed_region(io, 2, MODNAME)) |
@@ -516,26 +514,23 @@ static int __init pc87413_init(void) | |||
516 | 514 | ||
517 | ret = register_reboot_notifier(&pc87413_notifier); | 515 | ret = register_reboot_notifier(&pc87413_notifier); |
518 | if (ret != 0) { | 516 | if (ret != 0) { |
519 | printk(KERN_ERR PFX | 517 | pr_err("cannot register reboot notifier (err=%d)\n", ret); |
520 | "cannot register reboot notifier (err=%d)\n", ret); | ||
521 | } | 518 | } |
522 | 519 | ||
523 | ret = misc_register(&pc87413_miscdev); | 520 | ret = misc_register(&pc87413_miscdev); |
524 | if (ret != 0) { | 521 | if (ret != 0) { |
525 | printk(KERN_ERR PFX | 522 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
526 | "cannot register miscdev on minor=%d (err=%d)\n", | 523 | WATCHDOG_MINOR, ret); |
527 | WATCHDOG_MINOR, ret); | ||
528 | goto reboot_unreg; | 524 | goto reboot_unreg; |
529 | } | 525 | } |
530 | printk(KERN_INFO PFX "initialized. timeout=%d min \n", timeout); | 526 | pr_info("initialized. timeout=%d min\n", timeout); |
531 | 527 | ||
532 | pc87413_select_wdt_out(); | 528 | pc87413_select_wdt_out(); |
533 | pc87413_enable_swc(); | 529 | pc87413_enable_swc(); |
534 | pc87413_get_swc_base_addr(); | 530 | pc87413_get_swc_base_addr(); |
535 | 531 | ||
536 | if (!request_region(swc_base_addr, 0x20, MODNAME)) { | 532 | if (!request_region(swc_base_addr, 0x20, MODNAME)) { |
537 | printk(KERN_ERR PFX | 533 | pr_err("cannot request SWC region at 0x%x\n", swc_base_addr); |
538 | "cannot request SWC region at 0x%x\n", swc_base_addr); | ||
539 | ret = -EBUSY; | 534 | ret = -EBUSY; |
540 | goto misc_unreg; | 535 | goto misc_unreg; |
541 | } | 536 | } |
@@ -568,14 +563,14 @@ static void __exit pc87413_exit(void) | |||
568 | /* Stop the timer before we leave */ | 563 | /* Stop the timer before we leave */ |
569 | if (!nowayout) { | 564 | if (!nowayout) { |
570 | pc87413_disable(); | 565 | pc87413_disable(); |
571 | printk(KERN_INFO MODNAME "Watchdog disabled.\n"); | 566 | pr_info("Watchdog disabled\n"); |
572 | } | 567 | } |
573 | 568 | ||
574 | misc_deregister(&pc87413_miscdev); | 569 | misc_deregister(&pc87413_miscdev); |
575 | unregister_reboot_notifier(&pc87413_notifier); | 570 | unregister_reboot_notifier(&pc87413_notifier); |
576 | release_region(swc_base_addr, 0x20); | 571 | release_region(swc_base_addr, 0x20); |
577 | 572 | ||
578 | printk(KERN_INFO MODNAME " watchdog component driver removed.\n"); | 573 | pr_info("watchdog component driver removed\n"); |
579 | } | 574 | } |
580 | 575 | ||
581 | module_init(pc87413_init); | 576 | module_init(pc87413_init); |
@@ -597,7 +592,7 @@ MODULE_PARM_DESC(timeout, | |||
597 | "Watchdog timeout in minutes (default=" | 592 | "Watchdog timeout in minutes (default=" |
598 | __MODULE_STRING(DEFAULT_TIMEOUT) ")."); | 593 | __MODULE_STRING(DEFAULT_TIMEOUT) ")."); |
599 | 594 | ||
600 | module_param(nowayout, int, 0); | 595 | module_param(nowayout, bool, 0); |
601 | MODULE_PARM_DESC(nowayout, | 596 | MODULE_PARM_DESC(nowayout, |
602 | "Watchdog cannot be stopped once started (default=" | 597 | "Watchdog cannot be stopped once started (default=" |
603 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 598 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |