diff options
Diffstat (limited to 'drivers/watchdog/wdt_pci.c')
-rw-r--r-- | drivers/watchdog/wdt_pci.c | 105 |
1 files changed, 33 insertions, 72 deletions
diff --git a/drivers/watchdog/wdt_pci.c b/drivers/watchdog/wdt_pci.c index e0fc3baa9197..e32654efdbb6 100644 --- a/drivers/watchdog/wdt_pci.c +++ b/drivers/watchdog/wdt_pci.c @@ -37,6 +37,8 @@ * Matt Domsch : nowayout module option */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/interrupt.h> #include <linux/module.h> #include <linux/moduleparam.h> @@ -53,13 +55,10 @@ #include <linux/io.h> #include <linux/uaccess.h> -#include <asm/system.h> #define WDT_IS_PCI #include "wd501p.h" -#define PFX "wdt_pci: " - /* We can only use 1 card due to the /dev/watchdog restriction */ static int dev_count; @@ -80,8 +79,8 @@ MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (0<heartbeat<65536, default=" __MODULE_STRING(WD_TIMO) ")"); -static int nowayout = WATCHDOG_NOWAYOUT; -module_param(nowayout, int, 0); +static bool nowayout = WATCHDOG_NOWAYOUT; +module_param(nowayout, bool, 0); MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); @@ -312,33 +311,32 @@ static irqreturn_t wdtpci_interrupt(int irq, void *dev_id) status = inb(WDT_SR); udelay(8); - printk(KERN_CRIT PFX "status %d\n", status); + pr_crit("status %d\n", status); if (type == 501) { if (!(status & WDC_SR_TGOOD)) { - printk(KERN_CRIT PFX "Overheat alarm.(%d)\n", - inb(WDT_RT)); + pr_crit("Overheat alarm (%d)\n", inb(WDT_RT)); udelay(8); } if (!(status & WDC_SR_PSUOVER)) - printk(KERN_CRIT PFX "PSU over voltage.\n"); + pr_crit("PSU over voltage\n"); if (!(status & WDC_SR_PSUUNDR)) - printk(KERN_CRIT PFX "PSU under voltage.\n"); + pr_crit("PSU under voltage\n"); if (tachometer) { if (!(status & WDC_SR_FANGOOD)) - printk(KERN_CRIT PFX "Possible fan fault.\n"); + pr_crit("Possible fan fault\n"); } } if (!(status & WDC_SR_WCCR)) { #ifdef SOFTWARE_REBOOT #ifdef ONLY_TESTING - printk(KERN_CRIT PFX "Would Reboot.\n"); + pr_crit("Would Reboot\n"); #else - printk(KERN_CRIT PFX "Initiating system reboot.\n"); + pr_crit("Initiating system reboot\n"); emergency_restart(NULL); #endif #else - printk(KERN_CRIT PFX "Reset in 5ms.\n"); + pr_crit("Reset in 5ms\n"); #endif } spin_unlock(&wdtpci_lock); @@ -484,7 +482,7 @@ static int wdtpci_release(struct inode *inode, struct file *file) if (expect_close == 42) { wdtpci_stop(); } else { - printk(KERN_CRIT PFX "Unexpected close, not stopping timer!"); + pr_crit("Unexpected close, not stopping timer!\n"); wdtpci_ping(); } expect_close = 0; @@ -614,29 +612,29 @@ static int __devinit wdtpci_init_one(struct pci_dev *dev, dev_count++; if (dev_count > 1) { - printk(KERN_ERR PFX "This driver only supports one device\n"); + pr_err("This driver only supports one device\n"); return -ENODEV; } if (type != 500 && type != 501) { - printk(KERN_ERR PFX "unknown card type '%d'.\n", type); + pr_err("unknown card type '%d'\n", type); return -ENODEV; } if (pci_enable_device(dev)) { - printk(KERN_ERR PFX "Not possible to enable PCI Device\n"); + pr_err("Not possible to enable PCI Device\n"); return -ENODEV; } if (pci_resource_start(dev, 2) == 0x0000) { - printk(KERN_ERR PFX "No I/O-Address for card detected\n"); + pr_err("No I/O-Address for card detected\n"); ret = -ENODEV; goto out_pci; } if (pci_request_region(dev, 2, "wdt_pci")) { - printk(KERN_ERR PFX "I/O address 0x%llx already in use\n", - (unsigned long long)pci_resource_start(dev, 2)); + pr_err("I/O address 0x%llx already in use\n", + (unsigned long long)pci_resource_start(dev, 2)); goto out_pci; } @@ -645,53 +643,48 @@ static int __devinit wdtpci_init_one(struct pci_dev *dev, if (request_irq(irq, wdtpci_interrupt, IRQF_SHARED, "wdt_pci", &wdtpci_miscdev)) { - printk(KERN_ERR PFX "IRQ %d is not free\n", irq); + pr_err("IRQ %d is not free\n", irq); goto out_reg; } - printk(KERN_INFO - "PCI-WDT500/501 (PCI-WDG-CSM) driver 0.10 at 0x%llx (Interrupt %d)\n", - (unsigned long long)io, irq); + pr_info("PCI-WDT500/501 (PCI-WDG-CSM) driver 0.10 at 0x%llx (Interrupt %d)\n", + (unsigned long long)io, irq); /* Check that the heartbeat value is within its range; if not reset to the default */ if (wdtpci_set_heartbeat(heartbeat)) { wdtpci_set_heartbeat(WD_TIMO); - printk(KERN_INFO PFX - "heartbeat value must be 0 < heartbeat < 65536, using %d\n", - WD_TIMO); + pr_info("heartbeat value must be 0 < heartbeat < 65536, using %d\n", + WD_TIMO); } ret = register_reboot_notifier(&wdtpci_notifier); if (ret) { - printk(KERN_ERR PFX - "cannot register reboot notifier (err=%d)\n", ret); + pr_err("cannot register reboot notifier (err=%d)\n", ret); goto out_irq; } if (type == 501) { 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 out_rbt; } } ret = misc_register(&wdtpci_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 out_misc; } - printk(KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n", + pr_info("initialized. heartbeat=%d sec (nowayout=%d)\n", heartbeat, nowayout); if (type == 501) - printk(KERN_INFO "wdt: Fan Tachometer is %s\n", - (tachometer ? "Enabled" : "Disabled")); + pr_info("Fan Tachometer is %s\n", + tachometer ? "Enabled" : "Disabled"); ret = 0; out: @@ -746,39 +739,7 @@ static struct pci_driver wdtpci_driver = { .remove = __devexit_p(wdtpci_remove_one), }; - -/** - * wdtpci_cleanup: - * - * Unload the watchdog. You cannot do this with any file handles open. - * If your watchdog is set to continue ticking on close and you unload - * it, well it keeps ticking. We won't get the interrupt but the board - * will not touch PC memory so all is fine. You just have to load a new - * module in xx seconds or reboot. - */ - -static void __exit wdtpci_cleanup(void) -{ - pci_unregister_driver(&wdtpci_driver); -} - - -/** - * wdtpci_init: - * - * Set up the WDT watchdog board. All we have to do is grab the - * resources we require and bitch if anyone beat us to them. - * The open() function will actually kick the board off. - */ - -static int __init wdtpci_init(void) -{ - return pci_register_driver(&wdtpci_driver); -} - - -module_init(wdtpci_init); -module_exit(wdtpci_cleanup); +module_pci_driver(wdtpci_driver); MODULE_AUTHOR("JP Nollmann, Alan Cox"); MODULE_DESCRIPTION("Driver for the ICS PCI-WDT500/501 watchdog cards"); |