diff options
Diffstat (limited to 'drivers/watchdog/pcwd.c')
-rw-r--r-- | drivers/watchdog/pcwd.c | 123 |
1 files changed, 49 insertions, 74 deletions
diff --git a/drivers/watchdog/pcwd.c b/drivers/watchdog/pcwd.c index 06f7922606c..fe370defc71 100644 --- a/drivers/watchdog/pcwd.c +++ b/drivers/watchdog/pcwd.c @@ -51,6 +51,8 @@ * http://www.pcwatchdog.com/ */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> /* For module specific items */ #include <linux/moduleparam.h> /* For new moduleparam's */ #include <linux/types.h> /* For standard types (like size_t) */ @@ -75,7 +77,6 @@ #define WATCHDOG_DATE "18 Feb 2007" #define WATCHDOG_DRIVER_NAME "ISA-PC Watchdog" #define WATCHDOG_NAME "pcwd" -#define PFX WATCHDOG_NAME ": " #define DRIVER_VERSION WATCHDOG_DRIVER_NAME " driver, v" WATCHDOG_VERSION "\n" /* @@ -220,8 +221,7 @@ static int send_isa_command(int cmd) int port0, last_port0; /* Double read for stabilising */ if (debug >= DEBUG) - printk(KERN_DEBUG PFX "sending following data cmd=0x%02x\n", - cmd); + pr_debug("sending following data cmd=0x%02x\n", cmd); /* The WCMD bit must be 1 and the command is only 4 bits in size */ control_status = (cmd & 0x0F) | WD_WCMD; @@ -240,9 +240,8 @@ static int send_isa_command(int cmd) } if (debug >= DEBUG) - printk(KERN_DEBUG PFX "received following data for " - "cmd=0x%02x: port0=0x%02x last_port0=0x%02x\n", - cmd, port0, last_port0); + pr_debug("received following data for cmd=0x%02x: port0=0x%02x last_port0=0x%02x\n", + cmd, port0, last_port0); return port0; } @@ -271,8 +270,7 @@ static int set_command_mode(void) pcwd_private.command_mode = found; if (debug >= DEBUG) - printk(KERN_DEBUG PFX "command_mode=%d\n", - pcwd_private.command_mode); + pr_debug("command_mode=%d\n", pcwd_private.command_mode); return found; } @@ -288,8 +286,7 @@ static void unset_command_mode(void) pcwd_private.command_mode = 0; if (debug >= DEBUG) - printk(KERN_DEBUG PFX "command_mode=%d\n", - pcwd_private.command_mode); + pr_debug("command_mode=%d\n", pcwd_private.command_mode); } static inline void pcwd_check_temperature_support(void) @@ -336,17 +333,14 @@ static void pcwd_show_card_info(void) /* Get some extra info from the hardware (in command/debug/diag mode) */ if (pcwd_private.revision == PCWD_REVISION_A) - printk(KERN_INFO PFX - "ISA-PC Watchdog (REV.A) detected at port 0x%04x\n", - pcwd_private.io_addr); + pr_info("ISA-PC Watchdog (REV.A) detected at port 0x%04x\n", + pcwd_private.io_addr); else if (pcwd_private.revision == PCWD_REVISION_C) { pcwd_get_firmware(); - printk(KERN_INFO PFX "ISA-PC Watchdog (REV.C) detected at port " - "0x%04x (Firmware version: %s)\n", + pr_info("ISA-PC Watchdog (REV.C) detected at port 0x%04x (Firmware version: %s)\n", pcwd_private.io_addr, pcwd_private.fw_ver_str); option_switches = pcwd_get_option_switches(); - printk(KERN_INFO PFX "Option switches (0x%02x): " - "Temperature Reset Enable=%s, Power On Delay=%s\n", + pr_info("Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n", option_switches, ((option_switches & 0x10) ? "ON" : "OFF"), ((option_switches & 0x08) ? "ON" : "OFF")); @@ -359,22 +353,18 @@ static void pcwd_show_card_info(void) } if (pcwd_private.supports_temp) - printk(KERN_INFO PFX "Temperature Option Detected\n"); + pr_info("Temperature Option Detected\n"); if (pcwd_private.boot_status & WDIOF_CARDRESET) - printk(KERN_INFO PFX - "Previous reboot was caused by the card\n"); + pr_info("Previous reboot was caused by the card\n"); if (pcwd_private.boot_status & WDIOF_OVERHEAT) { - printk(KERN_EMERG PFX - "Card senses a CPU Overheat. Panicking!\n"); - printk(KERN_EMERG PFX - "CPU Overheat\n"); + pr_emerg("Card senses a CPU Overheat. Panicking!\n"); + pr_emerg("CPU Overheat\n"); } if (pcwd_private.boot_status == 0) - printk(KERN_INFO PFX - "No previous trip detected - Cold boot or reset\n"); + pr_info("No previous trip detected - Cold boot or reset\n"); } static void pcwd_timer_ping(unsigned long data) @@ -404,8 +394,7 @@ static void pcwd_timer_ping(unsigned long data) spin_unlock(&pcwd_private.io_lock); } else { - printk(KERN_WARNING PFX - "Heartbeat lost! Will not ping the watchdog\n"); + pr_warn("Heartbeat lost! Will not ping the watchdog\n"); } } @@ -426,13 +415,13 @@ static int pcwd_start(void) stat_reg = inb_p(pcwd_private.io_addr + 2); spin_unlock(&pcwd_private.io_lock); if (stat_reg & WD_WDIS) { - printk(KERN_INFO PFX "Could not start watchdog\n"); + pr_info("Could not start watchdog\n"); return -EIO; } } if (debug >= VERBOSE) - printk(KERN_DEBUG PFX "Watchdog started\n"); + pr_debug("Watchdog started\n"); return 0; } @@ -454,13 +443,13 @@ static int pcwd_stop(void) stat_reg = inb_p(pcwd_private.io_addr + 2); spin_unlock(&pcwd_private.io_lock); if ((stat_reg & WD_WDIS) == 0) { - printk(KERN_INFO PFX "Could not stop watchdog\n"); + pr_info("Could not stop watchdog\n"); return -EIO; } } if (debug >= VERBOSE) - printk(KERN_DEBUG PFX "Watchdog stopped\n"); + pr_debug("Watchdog stopped\n"); return 0; } @@ -471,7 +460,7 @@ static int pcwd_keepalive(void) pcwd_private.next_heartbeat = jiffies + (heartbeat * HZ); if (debug >= DEBUG) - printk(KERN_DEBUG PFX "Watchdog keepalive signal send\n"); + pr_debug("Watchdog keepalive signal send\n"); return 0; } @@ -484,8 +473,7 @@ static int pcwd_set_heartbeat(int t) heartbeat = t; if (debug >= VERBOSE) - printk(KERN_DEBUG PFX "New heartbeat: %d\n", - heartbeat); + pr_debug("New heartbeat: %d\n", heartbeat); return 0; } @@ -518,8 +506,7 @@ static int pcwd_get_status(int *status) if (control_status & WD_T110) { *status |= WDIOF_OVERHEAT; if (temp_panic) { - printk(KERN_INFO PFX - "Temperature overheat trip!\n"); + pr_info("Temperature overheat trip!\n"); kernel_power_off(); } } @@ -530,8 +517,7 @@ static int pcwd_get_status(int *status) if (control_status & WD_REVC_TTRP) { *status |= WDIOF_OVERHEAT; if (temp_panic) { - printk(KERN_INFO PFX - "Temperature overheat trip!\n"); + pr_info("Temperature overheat trip!\n"); kernel_power_off(); } } @@ -548,16 +534,14 @@ static int pcwd_clear_status(void) spin_lock(&pcwd_private.io_lock); if (debug >= VERBOSE) - printk(KERN_INFO PFX - "clearing watchdog trip status\n"); + pr_info("clearing watchdog trip status\n"); control_status = inb_p(pcwd_private.io_addr + 1); if (debug >= DEBUG) { - printk(KERN_DEBUG PFX "status was: 0x%02x\n", - control_status); - printk(KERN_DEBUG PFX "sending: 0x%02x\n", - (control_status & WD_REVC_R2DS)); + pr_debug("status was: 0x%02x\n", control_status); + pr_debug("sending: 0x%02x\n", + (control_status & WD_REVC_R2DS)); } /* clear reset status & Keep Relay 2 disable state as it is */ @@ -588,8 +572,7 @@ static int pcwd_get_temperature(int *temperature) spin_unlock(&pcwd_private.io_lock); if (debug >= DEBUG) { - printk(KERN_DEBUG PFX "temperature is: %d F\n", - *temperature); + pr_debug("temperature is: %d F\n", *temperature); } return 0; @@ -720,8 +703,7 @@ static int pcwd_close(struct inode *inode, struct file *file) if (expect_close == 42) pcwd_stop(); else { - printk(KERN_CRIT PFX - "Unexpected close, not stopping watchdog!\n"); + pr_crit("Unexpected close, not stopping watchdog!\n"); pcwd_keepalive(); } expect_close = 0; @@ -828,11 +810,10 @@ static int __devinit pcwd_isa_match(struct device *dev, unsigned int id) int retval; if (debug >= DEBUG) - printk(KERN_DEBUG PFX "pcwd_isa_match id=%d\n", - id); + pr_debug("pcwd_isa_match id=%d\n", id); if (!request_region(base_addr, 4, "PCWD")) { - printk(KERN_INFO PFX "Port 0x%04x unavailable\n", base_addr); + pr_info("Port 0x%04x unavailable\n", base_addr); return 0; } @@ -870,21 +851,20 @@ static int __devinit pcwd_isa_probe(struct device *dev, unsigned int id) int ret; if (debug >= DEBUG) - printk(KERN_DEBUG PFX "pcwd_isa_probe id=%d\n", - id); + pr_debug("pcwd_isa_probe id=%d\n", id); cards_found++; if (cards_found == 1) - printk(KERN_INFO PFX "v%s Ken Hollis (kenji@bitgate.com)\n", + pr_info("v%s Ken Hollis (kenji@bitgate.com)\n", WATCHDOG_VERSION); if (cards_found > 1) { - printk(KERN_ERR PFX "This driver only supports 1 device\n"); + pr_err("This driver only supports 1 device\n"); return -ENODEV; } if (pcwd_ioports[id] == 0x0000) { - printk(KERN_ERR PFX "No I/O-Address for card detected\n"); + pr_err("No I/O-Address for card detected\n"); return -ENODEV; } pcwd_private.io_addr = pcwd_ioports[id]; @@ -896,8 +876,8 @@ static int __devinit pcwd_isa_probe(struct device *dev, unsigned int id) if (!request_region(pcwd_private.io_addr, (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4, "PCWD")) { - printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", - pcwd_private.io_addr); + pr_err("I/O address 0x%04x already in use\n", + pcwd_private.io_addr); ret = -EIO; goto error_request_region; } @@ -932,30 +912,27 @@ static int __devinit pcwd_isa_probe(struct device *dev, unsigned int id) if not reset to the default */ if (pcwd_set_heartbeat(heartbeat)) { pcwd_set_heartbeat(WATCHDOG_HEARTBEAT); - printk(KERN_INFO PFX - "heartbeat value must be 2 <= heartbeat <= 7200, using %d\n", - WATCHDOG_HEARTBEAT); + pr_info("heartbeat value must be 2 <= heartbeat <= 7200, using %d\n", + WATCHDOG_HEARTBEAT); } if (pcwd_private.supports_temp) { ret = misc_register(&temp_miscdev); if (ret) { - printk(KERN_ERR PFX - "cannot register miscdev on minor=%d (err=%d)\n", - TEMP_MINOR, ret); + pr_err("cannot register miscdev on minor=%d (err=%d)\n", + TEMP_MINOR, ret); goto error_misc_register_temp; } } ret = misc_register(&pcwd_miscdev); if (ret) { - printk(KERN_ERR PFX - "cannot register miscdev on minor=%d (err=%d)\n", - WATCHDOG_MINOR, ret); + pr_err("cannot register miscdev on minor=%d (err=%d)\n", + WATCHDOG_MINOR, ret); goto error_misc_register_watchdog; } - printk(KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n", + pr_info("initialized. heartbeat=%d sec (nowayout=%d)\n", heartbeat, nowayout); return 0; @@ -975,8 +952,7 @@ error_request_region: static int __devexit pcwd_isa_remove(struct device *dev, unsigned int id) { if (debug >= DEBUG) - printk(KERN_DEBUG PFX "pcwd_isa_remove id=%d\n", - id); + pr_debug("pcwd_isa_remove id=%d\n", id); if (!pcwd_private.io_addr) return 1; @@ -1000,8 +976,7 @@ static int __devexit pcwd_isa_remove(struct device *dev, unsigned int id) static void pcwd_isa_shutdown(struct device *dev, unsigned int id) { if (debug >= DEBUG) - printk(KERN_DEBUG PFX "pcwd_isa_shutdown id=%d\n", - id); + pr_debug("pcwd_isa_shutdown id=%d\n", id); pcwd_stop(); } @@ -1025,7 +1000,7 @@ static int __init pcwd_init_module(void) static void __exit pcwd_cleanup_module(void) { isa_unregister_driver(&pcwd_isa_driver); - printk(KERN_INFO PFX "Watchdog Module Unloaded.\n"); + pr_info("Watchdog Module Unloaded\n"); } module_init(pcwd_init_module); |