aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/nv_tco.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/nv_tco.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/nv_tco.c')
-rw-r--r--drivers/watchdog/nv_tco.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/drivers/watchdog/nv_tco.c b/drivers/watchdog/nv_tco.c
index 809f41c30c44..16d9413a81c1 100644
--- a/drivers/watchdog/nv_tco.c
+++ b/drivers/watchdog/nv_tco.c
@@ -21,6 +21,8 @@
21 * Includes, defines, variables, module parameters, ... 21 * Includes, defines, variables, module parameters, ...
22 */ 22 */
23 23
24#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
25
24#include <linux/module.h> 26#include <linux/module.h>
25#include <linux/moduleparam.h> 27#include <linux/moduleparam.h>
26#include <linux/types.h> 28#include <linux/types.h>
@@ -41,7 +43,6 @@
41#define TCO_VERSION "0.01" 43#define TCO_VERSION "0.01"
42#define TCO_MODULE_NAME "NV_TCO" 44#define TCO_MODULE_NAME "NV_TCO"
43#define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION 45#define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION
44#define PFX TCO_MODULE_NAME ": "
45 46
46/* internal variables */ 47/* internal variables */
47static unsigned int tcobase; 48static unsigned int tcobase;
@@ -169,8 +170,7 @@ static int nv_tco_release(struct inode *inode, struct file *file)
169 if (tco_expect_close == 42) { 170 if (tco_expect_close == 42) {
170 tco_timer_stop(); 171 tco_timer_stop();
171 } else { 172 } else {
172 printk(KERN_CRIT PFX "Unexpected close, not stopping " 173 pr_crit("Unexpected close, not stopping watchdog!\n");
173 "watchdog!\n");
174 tco_timer_keepalive(); 174 tco_timer_keepalive();
175 } 175 }
176 clear_bit(0, &timer_alive); 176 clear_bit(0, &timer_alive);
@@ -323,15 +323,14 @@ static unsigned char __devinit nv_tco_getdevice(void)
323 val &= 0xffff; 323 val &= 0xffff;
324 if (val == 0x0001 || val == 0x0000) { 324 if (val == 0x0001 || val == 0x0000) {
325 /* Something is wrong here, bar isn't setup */ 325 /* Something is wrong here, bar isn't setup */
326 printk(KERN_ERR PFX "failed to get tcobase address\n"); 326 pr_err("failed to get tcobase address\n");
327 return 0; 327 return 0;
328 } 328 }
329 val &= 0xff00; 329 val &= 0xff00;
330 tcobase = val + 0x40; 330 tcobase = val + 0x40;
331 331
332 if (!request_region(tcobase, 0x10, "NV TCO")) { 332 if (!request_region(tcobase, 0x10, "NV TCO")) {
333 printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", 333 pr_err("I/O address 0x%04x already in use\n", tcobase);
334 tcobase);
335 return 0; 334 return 0;
336 } 335 }
337 336
@@ -347,7 +346,7 @@ static unsigned char __devinit nv_tco_getdevice(void)
347 346
348 /* Disable SMI caused by TCO */ 347 /* Disable SMI caused by TCO */
349 if (!request_region(MCP51_SMI_EN(tcobase), 4, "NV TCO")) { 348 if (!request_region(MCP51_SMI_EN(tcobase), 4, "NV TCO")) {
350 printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", 349 pr_err("I/O address 0x%04x already in use\n",
351 MCP51_SMI_EN(tcobase)); 350 MCP51_SMI_EN(tcobase));
352 goto out; 351 goto out;
353 } 352 }
@@ -357,7 +356,7 @@ static unsigned char __devinit nv_tco_getdevice(void)
357 val = inl(MCP51_SMI_EN(tcobase)); 356 val = inl(MCP51_SMI_EN(tcobase));
358 release_region(MCP51_SMI_EN(tcobase), 4); 357 release_region(MCP51_SMI_EN(tcobase), 4);
359 if (val & MCP51_SMI_EN_TCO) { 358 if (val & MCP51_SMI_EN_TCO) {
360 printk(KERN_ERR PFX "Could not disable SMI caused by TCO\n"); 359 pr_err("Could not disable SMI caused by TCO\n");
361 goto out; 360 goto out;
362 } 361 }
363 362
@@ -367,8 +366,7 @@ static unsigned char __devinit nv_tco_getdevice(void)
367 pci_write_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, val); 366 pci_write_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, val);
368 pci_read_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, &val); 367 pci_read_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, &val);
369 if (!(val & MCP51_SMBUS_SETUP_B_TCO_REBOOT)) { 368 if (!(val & MCP51_SMBUS_SETUP_B_TCO_REBOOT)) {
370 printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot " 369 pr_err("failed to reset NO_REBOOT flag, reboot disabled by hardware\n");
371 "disabled by hardware\n");
372 goto out; 370 goto out;
373 } 371 }
374 372
@@ -387,8 +385,8 @@ static int __devinit nv_tco_init(struct platform_device *dev)
387 return -ENODEV; 385 return -ENODEV;
388 386
389 /* Check to see if last reboot was due to watchdog timeout */ 387 /* Check to see if last reboot was due to watchdog timeout */
390 printk(KERN_INFO PFX "Watchdog reboot %sdetected.\n", 388 pr_info("Watchdog reboot %sdetected\n",
391 inl(TCO_STS(tcobase)) & TCO_STS_TCO2TO_STS ? "" : "not "); 389 inl(TCO_STS(tcobase)) & TCO_STS_TCO2TO_STS ? "" : "not ");
392 390
393 /* Clear out the old status */ 391 /* Clear out the old status */
394 outl(TCO_STS_RESET, TCO_STS(tcobase)); 392 outl(TCO_STS_RESET, TCO_STS(tcobase));
@@ -400,14 +398,14 @@ static int __devinit nv_tco_init(struct platform_device *dev)
400 if (tco_timer_set_heartbeat(heartbeat)) { 398 if (tco_timer_set_heartbeat(heartbeat)) {
401 heartbeat = WATCHDOG_HEARTBEAT; 399 heartbeat = WATCHDOG_HEARTBEAT;
402 tco_timer_set_heartbeat(heartbeat); 400 tco_timer_set_heartbeat(heartbeat);
403 printk(KERN_INFO PFX "heartbeat value must be 2<heartbeat<39, " 401 pr_info("heartbeat value must be 2<heartbeat<39, using %d\n",
404 "using %d\n", heartbeat); 402 heartbeat);
405 } 403 }
406 404
407 ret = misc_register(&nv_tco_miscdev); 405 ret = misc_register(&nv_tco_miscdev);
408 if (ret != 0) { 406 if (ret != 0) {
409 printk(KERN_ERR PFX "cannot register miscdev on minor=%d " 407 pr_err("cannot register miscdev on minor=%d (err=%d)\n",
410 "(err=%d)\n", WATCHDOG_MINOR, ret); 408 WATCHDOG_MINOR, ret);
411 goto unreg_region; 409 goto unreg_region;
412 } 410 }
413 411
@@ -415,8 +413,8 @@ static int __devinit nv_tco_init(struct platform_device *dev)
415 413
416 tco_timer_stop(); 414 tco_timer_stop();
417 415
418 printk(KERN_INFO PFX "initialized (0x%04x). heartbeat=%d sec " 416 pr_info("initialized (0x%04x). heartbeat=%d sec (nowayout=%d)\n",
419 "(nowayout=%d)\n", tcobase, heartbeat, nowayout); 417 tcobase, heartbeat, nowayout);
420 418
421 return 0; 419 return 0;
422 420
@@ -439,8 +437,7 @@ static void __devexit nv_tco_cleanup(void)
439 pci_write_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, val); 437 pci_write_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, val);
440 pci_read_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, &val); 438 pci_read_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, &val);
441 if (val & MCP51_SMBUS_SETUP_B_TCO_REBOOT) { 439 if (val & MCP51_SMBUS_SETUP_B_TCO_REBOOT) {
442 printk(KERN_CRIT PFX "Couldn't unset REBOOT bit. Machine may " 440 pr_crit("Couldn't unset REBOOT bit. Machine may soon reset\n");
443 "soon reset\n");
444 } 441 }
445 442
446 /* Deregister */ 443 /* Deregister */
@@ -483,8 +480,7 @@ static int __init nv_tco_init_module(void)
483{ 480{
484 int err; 481 int err;
485 482
486 printk(KERN_INFO PFX "NV TCO WatchDog Timer Driver v%s\n", 483 pr_info("NV TCO WatchDog Timer Driver v%s\n", TCO_VERSION);
487 TCO_VERSION);
488 484
489 err = platform_driver_register(&nv_tco_driver); 485 err = platform_driver_register(&nv_tco_driver);
490 if (err) 486 if (err)
@@ -508,7 +504,7 @@ static void __exit nv_tco_cleanup_module(void)
508{ 504{
509 platform_device_unregister(nv_tco_platform_device); 505 platform_device_unregister(nv_tco_platform_device);
510 platform_driver_unregister(&nv_tco_driver); 506 platform_driver_unregister(&nv_tco_driver);
511 printk(KERN_INFO PFX "NV TCO Watchdog Module Unloaded.\n"); 507 pr_info("NV TCO Watchdog Module Unloaded\n");
512} 508}
513 509
514module_init(nv_tco_init_module); 510module_init(nv_tco_init_module);