diff options
Diffstat (limited to 'drivers/watchdog/nv_tco.c')
| -rw-r--r-- | drivers/watchdog/nv_tco.c | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/drivers/watchdog/nv_tco.c b/drivers/watchdog/nv_tco.c index 809f41c30c4..0b9ec61e131 100644 --- a/drivers/watchdog/nv_tco.c +++ b/drivers/watchdog/nv_tco.c @@ -21,6 +21,8 @@ * Includes, defines, variables, module parameters, ... */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/types.h> @@ -41,7 +43,6 @@ #define TCO_VERSION "0.01" #define TCO_MODULE_NAME "NV_TCO" #define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION -#define PFX TCO_MODULE_NAME ": " /* internal variables */ static unsigned int tcobase; @@ -60,8 +61,8 @@ module_param(heartbeat, int, 0); MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (2<heartbeat<39, " "default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); -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) ")"); @@ -169,8 +170,7 @@ static int nv_tco_release(struct inode *inode, struct file *file) if (tco_expect_close == 42) { tco_timer_stop(); } else { - printk(KERN_CRIT PFX "Unexpected close, not stopping " - "watchdog!\n"); + pr_crit("Unexpected close, not stopping watchdog!\n"); tco_timer_keepalive(); } clear_bit(0, &timer_alive); @@ -289,7 +289,7 @@ static struct miscdevice nv_tco_miscdev = { * register a pci_driver, because someone else might one day * want to register another driver on the same PCI id. */ -static DEFINE_PCI_DEVICE_TABLE(tco_pci_tbl) = { +static const struct pci_device_id tco_pci_tbl[] = { { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SMBUS, PCI_ANY_ID, PCI_ANY_ID, }, { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SMBUS, @@ -302,7 +302,7 @@ MODULE_DEVICE_TABLE(pci, tco_pci_tbl); * Init & exit routines */ -static unsigned char __devinit nv_tco_getdevice(void) +static unsigned char nv_tco_getdevice(void) { struct pci_dev *dev = NULL; u32 val; @@ -323,15 +323,14 @@ static unsigned char __devinit nv_tco_getdevice(void) val &= 0xffff; if (val == 0x0001 || val == 0x0000) { /* Something is wrong here, bar isn't setup */ - printk(KERN_ERR PFX "failed to get tcobase address\n"); + pr_err("failed to get tcobase address\n"); return 0; } val &= 0xff00; tcobase = val + 0x40; if (!request_region(tcobase, 0x10, "NV TCO")) { - printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", - tcobase); + pr_err("I/O address 0x%04x already in use\n", tcobase); return 0; } @@ -347,7 +346,7 @@ static unsigned char __devinit nv_tco_getdevice(void) /* Disable SMI caused by TCO */ if (!request_region(MCP51_SMI_EN(tcobase), 4, "NV TCO")) { - printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", + pr_err("I/O address 0x%04x already in use\n", MCP51_SMI_EN(tcobase)); goto out; } @@ -357,7 +356,7 @@ static unsigned char __devinit nv_tco_getdevice(void) val = inl(MCP51_SMI_EN(tcobase)); release_region(MCP51_SMI_EN(tcobase), 4); if (val & MCP51_SMI_EN_TCO) { - printk(KERN_ERR PFX "Could not disable SMI caused by TCO\n"); + pr_err("Could not disable SMI caused by TCO\n"); goto out; } @@ -367,8 +366,7 @@ static unsigned char __devinit nv_tco_getdevice(void) pci_write_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, val); pci_read_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, &val); if (!(val & MCP51_SMBUS_SETUP_B_TCO_REBOOT)) { - printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot " - "disabled by hardware\n"); + pr_err("failed to reset NO_REBOOT flag, reboot disabled by hardware\n"); goto out; } @@ -378,7 +376,7 @@ out: return 0; } -static int __devinit nv_tco_init(struct platform_device *dev) +static int nv_tco_init(struct platform_device *dev) { int ret; @@ -387,8 +385,8 @@ static int __devinit nv_tco_init(struct platform_device *dev) return -ENODEV; /* Check to see if last reboot was due to watchdog timeout */ - printk(KERN_INFO PFX "Watchdog reboot %sdetected.\n", - inl(TCO_STS(tcobase)) & TCO_STS_TCO2TO_STS ? "" : "not "); + pr_info("Watchdog reboot %sdetected\n", + inl(TCO_STS(tcobase)) & TCO_STS_TCO2TO_STS ? "" : "not "); /* Clear out the old status */ outl(TCO_STS_RESET, TCO_STS(tcobase)); @@ -400,14 +398,14 @@ static int __devinit nv_tco_init(struct platform_device *dev) if (tco_timer_set_heartbeat(heartbeat)) { heartbeat = WATCHDOG_HEARTBEAT; tco_timer_set_heartbeat(heartbeat); - printk(KERN_INFO PFX "heartbeat value must be 2<heartbeat<39, " - "using %d\n", heartbeat); + pr_info("heartbeat value must be 2<heartbeat<39, using %d\n", + heartbeat); } ret = misc_register(&nv_tco_miscdev); if (ret != 0) { - 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 unreg_region; } @@ -415,8 +413,8 @@ static int __devinit nv_tco_init(struct platform_device *dev) tco_timer_stop(); - printk(KERN_INFO PFX "initialized (0x%04x). heartbeat=%d sec " - "(nowayout=%d)\n", tcobase, heartbeat, nowayout); + pr_info("initialized (0x%04x). heartbeat=%d sec (nowayout=%d)\n", + tcobase, heartbeat, nowayout); return 0; @@ -425,7 +423,7 @@ unreg_region: return ret; } -static void __devexit nv_tco_cleanup(void) +static void nv_tco_cleanup(void) { u32 val; @@ -439,8 +437,7 @@ static void __devexit nv_tco_cleanup(void) pci_write_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, val); pci_read_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, &val); if (val & MCP51_SMBUS_SETUP_B_TCO_REBOOT) { - printk(KERN_CRIT PFX "Couldn't unset REBOOT bit. Machine may " - "soon reset\n"); + pr_crit("Couldn't unset REBOOT bit. Machine may soon reset\n"); } /* Deregister */ @@ -448,7 +445,7 @@ static void __devexit nv_tco_cleanup(void) release_region(tcobase, 0x10); } -static int __devexit nv_tco_remove(struct platform_device *dev) +static int nv_tco_remove(struct platform_device *dev) { if (tcobase) nv_tco_cleanup(); @@ -471,7 +468,7 @@ static void nv_tco_shutdown(struct platform_device *dev) static struct platform_driver nv_tco_driver = { .probe = nv_tco_init, - .remove = __devexit_p(nv_tco_remove), + .remove = nv_tco_remove, .shutdown = nv_tco_shutdown, .driver = { .owner = THIS_MODULE, @@ -483,8 +480,7 @@ static int __init nv_tco_init_module(void) { int err; - printk(KERN_INFO PFX "NV TCO WatchDog Timer Driver v%s\n", - TCO_VERSION); + pr_info("NV TCO WatchDog Timer Driver v%s\n", TCO_VERSION); err = platform_driver_register(&nv_tco_driver); if (err) @@ -508,7 +504,7 @@ static void __exit nv_tco_cleanup_module(void) { platform_device_unregister(nv_tco_platform_device); platform_driver_unregister(&nv_tco_driver); - printk(KERN_INFO PFX "NV TCO Watchdog Module Unloaded.\n"); + pr_info("NV TCO Watchdog Module Unloaded\n"); } module_init(nv_tco_init_module); @@ -517,4 +513,3 @@ module_exit(nv_tco_cleanup_module); MODULE_AUTHOR("Mike Waychison"); MODULE_DESCRIPTION("TCO timer driver for NV chipsets"); MODULE_LICENSE("GPL"); -MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); |
