diff options
Diffstat (limited to 'drivers/watchdog/indydog.c')
| -rw-r--r-- | drivers/watchdog/indydog.c | 42 | 
1 files changed, 13 insertions, 29 deletions
diff --git a/drivers/watchdog/indydog.c b/drivers/watchdog/indydog.c index 1cc5609666d..5d20cdd30ef 100644 --- a/drivers/watchdog/indydog.c +++ b/drivers/watchdog/indydog.c @@ -12,6 +12,8 @@   *	based on softdog.c by Alan Cox <alan@lxorguk.ukuu.org.uk>   */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +  #include <linux/module.h>  #include <linux/moduleparam.h>  #include <linux/types.h> @@ -26,41 +28,31 @@  #include <linux/uaccess.h>  #include <asm/sgi/mc.h> -#define PFX "indydog: "  static unsigned long indydog_alive; -static spinlock_t indydog_lock; +static DEFINE_SPINLOCK(indydog_lock);  #define WATCHDOG_TIMEOUT 30		/* 30 sec default timeout */ -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) ")");  static void indydog_start(void)  { -	u32 mc_ctrl0; -  	spin_lock(&indydog_lock); -	mc_ctrl0 = sgimc->cpuctrl0; -	mc_ctrl0 = sgimc->cpuctrl0 | SGIMC_CCTRL0_WDOG; -	sgimc->cpuctrl0 = mc_ctrl0; +	sgimc->cpuctrl0 |= SGIMC_CCTRL0_WDOG;  	spin_unlock(&indydog_lock);  }  static void indydog_stop(void)  { -	u32 mc_ctrl0; -  	spin_lock(&indydog_lock); - -	mc_ctrl0 = sgimc->cpuctrl0; -	mc_ctrl0 &= ~SGIMC_CCTRL0_WDOG; -	sgimc->cpuctrl0 = mc_ctrl0; +	sgimc->cpuctrl0 &= ~SGIMC_CCTRL0_WDOG;  	spin_unlock(&indydog_lock); -	printk(KERN_INFO PFX "Stopped watchdog timer.\n"); +	pr_info("Stopped watchdog timer\n");  }  static void indydog_ping(void) @@ -83,7 +75,7 @@ static int indydog_open(struct inode *inode, struct file *file)  	indydog_start();  	indydog_ping(); -	printk(KERN_INFO "Started watchdog timer.\n"); +	pr_info("Started watchdog timer\n");  	return nonseekable_open(inode, file);  } @@ -178,32 +170,25 @@ static struct notifier_block indydog_notifier = {  	.notifier_call = indydog_notify_sys,  }; -static char banner[] __initdata = -	KERN_INFO PFX "Hardware Watchdog Timer for SGI IP22: 0.3\n"; -  static int __init watchdog_init(void)  {  	int ret; -	spin_lock_init(&indydog_lock); -  	ret = register_reboot_notifier(&indydog_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);  		return ret;  	}  	ret = misc_register(&indydog_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);  		unregister_reboot_notifier(&indydog_notifier);  		return ret;  	} -	printk(banner); +	pr_info("Hardware Watchdog Timer for SGI IP22: 0.3\n");  	return 0;  } @@ -220,4 +205,3 @@ module_exit(watchdog_exit);  MODULE_AUTHOR("Guido Guenther <agx@sigxcpu.org>");  MODULE_DESCRIPTION("Hardware Watchdog Device for SGI IP22");  MODULE_LICENSE("GPL"); -MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);  | 
