diff options
Diffstat (limited to 'drivers/watchdog/machzwd.c')
| -rw-r--r-- | drivers/watchdog/machzwd.c | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/drivers/watchdog/machzwd.c b/drivers/watchdog/machzwd.c index 2dfc27559bf..9826b59ef73 100644 --- a/drivers/watchdog/machzwd.c +++ b/drivers/watchdog/machzwd.c @@ -21,13 +21,15 @@ * wd#1 - 2 seconds; * wd#2 - 7.2 ms; * After the expiration of wd#1, it can generate a NMI, SCI, SMI, or - * a system RESET and it starts wd#2 that unconditionaly will RESET + * a system RESET and it starts wd#2 that unconditionally will RESET * the system when the counter reaches zero. * * 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com> * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/types.h> @@ -43,7 +45,6 @@ #include <linux/io.h> #include <linux/uaccess.h> -#include <asm/system.h> /* ports */ #define ZF_IOBASE 0x218 @@ -54,7 +55,7 @@ /* indexes */ /* size */ #define ZFL_VERSION 0x02 /* 16 */ -#define CONTROL 0x10 /* 16 */ +#define CONTROL 0x10 /* 16 */ #define STATUS 0x12 /* 8 */ #define COUNTER_1 0x0C /* 16 */ #define COUNTER_2 0x0E /* 8 */ @@ -91,17 +92,16 @@ static unsigned short zf_readw(unsigned char port) MODULE_AUTHOR("Fernando Fuganti <fuganti@conectiva.com.br>"); MODULE_DESCRIPTION("MachZ ZF-Logic Watchdog driver"); MODULE_LICENSE("GPL"); -MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); -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) ")"); #define PFX "machzwd" -static struct watchdog_info zf_info = { +static const struct watchdog_info zf_info = { .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, .firmware_version = 1, .identity = "ZF-Logic watchdog", @@ -118,7 +118,8 @@ static struct watchdog_info zf_info = { */ static int action; module_param(action, int, 0); -MODULE_PARM_DESC(action, "after watchdog resets, generate: 0 = RESET(*) 1 = SMI 2 = NMI 3 = SCI"); +MODULE_PARM_DESC(action, "after watchdog resets, generate: " + "0 = RESET(*) 1 = SMI 2 = NMI 3 = SCI"); static void zf_ping(unsigned long data); @@ -140,9 +141,10 @@ static unsigned long next_heartbeat; #define ZF_CTIMEOUT 0xffff #ifndef ZF_DEBUG -# define dprintk(format, args...) +#define dprintk(format, args...) #else -# define dprintk(format, args...) printk(KERN_DEBUG PFX ":%s:%d: " format, __func__, __LINE__ , ## args) +#define dprintk(format, args...) \ + pr_debug(":%s:%d: " format, __func__, __LINE__ , ## args) #endif @@ -201,7 +203,7 @@ static void zf_timer_off(void) zf_set_control(ctrl_reg); spin_unlock_irqrestore(&zf_port_lock, flags); - printk(KERN_INFO PFX ": Watchdog timer is now disabled\n"); + pr_info("Watchdog timer is now disabled\n"); } @@ -231,7 +233,7 @@ static void zf_timer_on(void) zf_set_control(ctrl_reg); spin_unlock_irqrestore(&zf_port_lock, flags); - printk(KERN_INFO PFX ": Watchdog timer is now enabled\n"); + pr_info("Watchdog timer is now enabled\n"); } @@ -261,7 +263,7 @@ static void zf_ping(unsigned long data) mod_timer(&zf_timer, jiffies + ZF_HW_TIMEO); } else - printk(KERN_CRIT PFX ": I will reset your machine\n"); + pr_crit("I will reset your machine\n"); } static ssize_t zf_write(struct file *file, const char __user *buf, size_t count, @@ -340,7 +342,7 @@ static int zf_close(struct inode *inode, struct file *file) zf_timer_off(); else { del_timer(&zf_timer); - printk(KERN_ERR PFX ": device file closed unexpectedly. Will not stop the WDT!\n"); + pr_err("device file closed unexpectedly. Will not stop the WDT!\n"); } clear_bit(0, &zf_is_open); zf_expect_close = 0; @@ -385,21 +387,20 @@ static struct notifier_block zf_notifier = { static void __init zf_show_action(int act) { - char *str[] = { "RESET", "SMI", "NMI", "SCI" }; + static const char * const str[] = { "RESET", "SMI", "NMI", "SCI" }; - printk(KERN_INFO PFX ": Watchdog using action = %s\n", str[act]); + pr_info("Watchdog using action = %s\n", str[act]); } static int __init zf_init(void) { int ret; - printk(KERN_INFO PFX - ": MachZ ZF-Logic Watchdog driver initializing.\n"); + pr_info("MachZ ZF-Logic Watchdog driver initializing\n"); ret = zf_get_ZFL_version(); if (!ret || ret == 0xffff) { - printk(KERN_WARNING PFX ": no ZF-Logic found\n"); + pr_warn("no ZF-Logic found\n"); return -ENODEV; } @@ -411,23 +412,20 @@ static int __init zf_init(void) zf_show_action(action); if (!request_region(ZF_IOBASE, 3, "MachZ ZFL WDT")) { - printk(KERN_ERR "cannot reserve I/O ports at %d\n", - ZF_IOBASE); + pr_err("cannot reserve I/O ports at %d\n", ZF_IOBASE); ret = -EBUSY; goto no_region; } ret = register_reboot_notifier(&zf_notifier); if (ret) { - printk(KERN_ERR "can't register reboot notifier (err=%d)\n", - ret); + pr_err("can't register reboot notifier (err=%d)\n", ret); goto no_reboot; } ret = misc_register(&zf_miscdev); if (ret) { - printk(KERN_ERR "can't misc_register on minor=%d\n", - WATCHDOG_MINOR); + pr_err("can't misc_register on minor=%d\n", WATCHDOG_MINOR); goto no_misc; } |
