aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/pc87413_wdt.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/pc87413_wdt.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/pc87413_wdt.c')
-rw-r--r--drivers/watchdog/pc87413_wdt.c53
1 files changed, 24 insertions, 29 deletions
diff --git a/drivers/watchdog/pc87413_wdt.c b/drivers/watchdog/pc87413_wdt.c
index e78d89986768..a86f405b6325 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) */
@@ -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
581module_init(pc87413_init); 576module_init(pc87413_init);