aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/i6300esb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/watchdog/i6300esb.c')
-rw-r--r--drivers/watchdog/i6300esb.c39
1 files changed, 18 insertions, 21 deletions
diff --git a/drivers/watchdog/i6300esb.c b/drivers/watchdog/i6300esb.c
index db45091ef434..738032a36bcf 100644
--- a/drivers/watchdog/i6300esb.c
+++ b/drivers/watchdog/i6300esb.c
@@ -27,6 +27,8 @@
27 * Includes, defines, variables, module parameters, ... 27 * Includes, defines, variables, module parameters, ...
28 */ 28 */
29 29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
30#include <linux/module.h> 32#include <linux/module.h>
31#include <linux/types.h> 33#include <linux/types.h>
32#include <linux/kernel.h> 34#include <linux/kernel.h>
@@ -44,7 +46,6 @@
44#define ESB_VERSION "0.05" 46#define ESB_VERSION "0.05"
45#define ESB_MODULE_NAME "i6300ESB timer" 47#define ESB_MODULE_NAME "i6300ESB timer"
46#define ESB_DRIVER_NAME ESB_MODULE_NAME ", v" ESB_VERSION 48#define ESB_DRIVER_NAME ESB_MODULE_NAME ", v" ESB_VERSION
47#define PFX ESB_MODULE_NAME ": "
48 49
49/* PCI configuration registers */ 50/* PCI configuration registers */
50#define ESB_CONFIG_REG 0x60 /* Config register */ 51#define ESB_CONFIG_REG 0x60 /* Config register */
@@ -94,8 +95,8 @@ MODULE_PARM_DESC(heartbeat,
94 "Watchdog heartbeat in seconds. (1<heartbeat<2046, default=" 95 "Watchdog heartbeat in seconds. (1<heartbeat<2046, default="
95 __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); 96 __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
96 97
97static int nowayout = WATCHDOG_NOWAYOUT; 98static bool nowayout = WATCHDOG_NOWAYOUT;
98module_param(nowayout, int, 0); 99module_param(nowayout, bool, 0);
99MODULE_PARM_DESC(nowayout, 100MODULE_PARM_DESC(nowayout,
100 "Watchdog cannot be stopped once started (default=" 101 "Watchdog cannot be stopped once started (default="
101 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); 102 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
@@ -213,8 +214,7 @@ static int esb_release(struct inode *inode, struct file *file)
213 if (esb_expect_close == 42) 214 if (esb_expect_close == 42)
214 esb_timer_stop(); 215 esb_timer_stop();
215 else { 216 else {
216 printk(KERN_CRIT PFX 217 pr_crit("Unexpected close, not stopping watchdog!\n");
217 "Unexpected close, not stopping watchdog!\n");
218 esb_timer_keepalive(); 218 esb_timer_keepalive();
219 } 219 }
220 clear_bit(0, &timer_alive); 220 clear_bit(0, &timer_alive);
@@ -347,19 +347,19 @@ MODULE_DEVICE_TABLE(pci, esb_pci_tbl);
347static unsigned char __devinit esb_getdevice(struct pci_dev *pdev) 347static unsigned char __devinit esb_getdevice(struct pci_dev *pdev)
348{ 348{
349 if (pci_enable_device(pdev)) { 349 if (pci_enable_device(pdev)) {
350 printk(KERN_ERR PFX "failed to enable device\n"); 350 pr_err("failed to enable device\n");
351 goto err_devput; 351 goto err_devput;
352 } 352 }
353 353
354 if (pci_request_region(pdev, 0, ESB_MODULE_NAME)) { 354 if (pci_request_region(pdev, 0, ESB_MODULE_NAME)) {
355 printk(KERN_ERR PFX "failed to request region\n"); 355 pr_err("failed to request region\n");
356 goto err_disable; 356 goto err_disable;
357 } 357 }
358 358
359 BASEADDR = pci_ioremap_bar(pdev, 0); 359 BASEADDR = pci_ioremap_bar(pdev, 0);
360 if (BASEADDR == NULL) { 360 if (BASEADDR == NULL) {
361 /* Something's wrong here, BASEADDR has to be set */ 361 /* Something's wrong here, BASEADDR has to be set */
362 printk(KERN_ERR PFX "failed to get BASEADDR\n"); 362 pr_err("failed to get BASEADDR\n");
363 goto err_release; 363 goto err_release;
364 } 364 }
365 365
@@ -397,7 +397,7 @@ static void __devinit esb_initdevice(void)
397 /* Check that the WDT isn't already locked */ 397 /* Check that the WDT isn't already locked */
398 pci_read_config_byte(esb_pci, ESB_LOCK_REG, &val1); 398 pci_read_config_byte(esb_pci, ESB_LOCK_REG, &val1);
399 if (val1 & ESB_WDT_LOCK) 399 if (val1 & ESB_WDT_LOCK)
400 printk(KERN_WARNING PFX "nowayout already set\n"); 400 pr_warn("nowayout already set\n");
401 401
402 /* Set the timer to watchdog mode and disable it for now */ 402 /* Set the timer to watchdog mode and disable it for now */
403 pci_write_config_byte(esb_pci, ESB_LOCK_REG, 0x00); 403 pci_write_config_byte(esb_pci, ESB_LOCK_REG, 0x00);
@@ -423,11 +423,11 @@ static int __devinit esb_probe(struct pci_dev *pdev,
423 423
424 cards_found++; 424 cards_found++;
425 if (cards_found == 1) 425 if (cards_found == 1)
426 printk(KERN_INFO PFX "Intel 6300ESB WatchDog Timer Driver v%s\n", 426 pr_info("Intel 6300ESB WatchDog Timer Driver v%s\n",
427 ESB_VERSION); 427 ESB_VERSION);
428 428
429 if (cards_found > 1) { 429 if (cards_found > 1) {
430 printk(KERN_ERR PFX "This driver only supports 1 device\n"); 430 pr_err("This driver only supports 1 device\n");
431 return -ENODEV; 431 return -ENODEV;
432 } 432 }
433 433
@@ -439,9 +439,8 @@ static int __devinit esb_probe(struct pci_dev *pdev,
439 if not reset to the default */ 439 if not reset to the default */
440 if (heartbeat < 0x1 || heartbeat > 2 * 0x03ff) { 440 if (heartbeat < 0x1 || heartbeat > 2 * 0x03ff) {
441 heartbeat = WATCHDOG_HEARTBEAT; 441 heartbeat = WATCHDOG_HEARTBEAT;
442 printk(KERN_INFO PFX 442 pr_info("heartbeat value must be 1<heartbeat<2046, using %d\n",
443 "heartbeat value must be 1<heartbeat<2046, using %d\n", 443 heartbeat);
444 heartbeat);
445 } 444 }
446 445
447 /* Initialize the watchdog and make sure it does not run */ 446 /* Initialize the watchdog and make sure it does not run */
@@ -450,14 +449,12 @@ static int __devinit esb_probe(struct pci_dev *pdev,
450 /* Register the watchdog so that userspace has access to it */ 449 /* Register the watchdog so that userspace has access to it */
451 ret = misc_register(&esb_miscdev); 450 ret = misc_register(&esb_miscdev);
452 if (ret != 0) { 451 if (ret != 0) {
453 printk(KERN_ERR PFX 452 pr_err("cannot register miscdev on minor=%d (err=%d)\n",
454 "cannot register miscdev on minor=%d (err=%d)\n", 453 WATCHDOG_MINOR, ret);
455 WATCHDOG_MINOR, ret);
456 goto err_unmap; 454 goto err_unmap;
457 } 455 }
458 printk(KERN_INFO PFX 456 pr_info("initialized (0x%p). heartbeat=%d sec (nowayout=%d)\n",
459 "initialized (0x%p). heartbeat=%d sec (nowayout=%d)\n", 457 BASEADDR, heartbeat, nowayout);
460 BASEADDR, heartbeat, nowayout);
461 return 0; 458 return 0;
462 459
463err_unmap: 460err_unmap:
@@ -503,7 +500,7 @@ static int __init watchdog_init(void)
503static void __exit watchdog_cleanup(void) 500static void __exit watchdog_cleanup(void)
504{ 501{
505 pci_unregister_driver(&esb_driver); 502 pci_unregister_driver(&esb_driver);
506 printk(KERN_INFO PFX "Watchdog Module Unloaded.\n"); 503 pr_info("Watchdog Module Unloaded\n");
507} 504}
508 505
509module_init(watchdog_init); 506module_init(watchdog_init);