[WATCHDOG] Some more general cleanup

Clean-up the watchdog drivers so that checkpatch.pl get's happy...

Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
This commit is contained in:
Wim Van Sebroeck 2009-04-14 20:20:07 +00:00
parent 0a7e658226
commit a77dba7e44
17 changed files with 82 additions and 58 deletions

View file

@ -322,7 +322,8 @@ static int wdt_notify_sys(struct notifier_block *this,
* watchdog on reboot with no heartbeat * watchdog on reboot with no heartbeat
*/ */
wdt_change(WDT_ENABLE); wdt_change(WDT_ENABLE);
printk(KERN_INFO PFX "Watchdog timer is now enabled with no heartbeat - should reboot in ~1 second.\n"); printk(KERN_INFO PFX "Watchdog timer is now enabled "
"with no heartbeat - should reboot in ~1 second.\n");
} }
return NOTIFY_DONE; return NOTIFY_DONE;
} }
@ -374,12 +375,17 @@ static int __init alim7101_wdt_init(void)
pci_dev_put(ali1543_south); pci_dev_put(ali1543_south);
if ((tmp & 0x1e) == 0x00) { if ((tmp & 0x1e) == 0x00) {
if (!use_gpio) { if (!use_gpio) {
printk(KERN_INFO PFX "Detected old alim7101 revision 'a1d'. If this is a cobalt board, set the 'use_gpio' module parameter.\n"); printk(KERN_INFO PFX
"Detected old alim7101 revision 'a1d'. "
"If this is a cobalt board, set the 'use_gpio' "
"module parameter.\n");
goto err_out; goto err_out;
} }
nowayout = 1; nowayout = 1;
} else if ((tmp & 0x1e) != 0x12 && (tmp & 0x1e) != 0x00) { } else if ((tmp & 0x1e) != 0x12 && (tmp & 0x1e) != 0x00) {
printk(KERN_INFO PFX "ALi 1543 South-Bridge does not have the correct revision number (???1001?) - WDT not set\n"); printk(KERN_INFO PFX
"ALi 1543 South-Bridge does not have the correct "
"revision number (???1001?) - WDT not set\n");
goto err_out; goto err_out;
} }
@ -409,7 +415,8 @@ static int __init alim7101_wdt_init(void)
if (nowayout) if (nowayout)
__module_get(THIS_MODULE); __module_get(THIS_MODULE);
printk(KERN_INFO PFX "WDT driver for ALi M7101 initialised. timeout=%d sec (nowayout=%d)\n", printk(KERN_INFO PFX "WDT driver for ALi M7101 initialised. "
"timeout=%d sec (nowayout=%d)\n",
timeout, nowayout); timeout, nowayout);
return 0; return 0;

View file

@ -268,7 +268,8 @@ static int __init at91_wdt_init(void)
if not reset to the default */ if not reset to the default */
if (at91_wdt_settimeout(wdt_time)) { if (at91_wdt_settimeout(wdt_time)) {
at91_wdt_settimeout(WDT_DEFAULT_TIME); at91_wdt_settimeout(WDT_DEFAULT_TIME);
pr_info("at91_wdt: wdt_time value must be 1 <= wdt_time <= 256, using %d\n", wdt_time); pr_info("at91_wdt: wdt_time value must be 1 <= wdt_time <= 256"
", using %d\n", wdt_time);
} }
return platform_driver_register(&at91wdt_driver); return platform_driver_register(&at91wdt_driver);

View file

@ -27,10 +27,15 @@
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <asm/blackfin.h> #include <asm/blackfin.h>
#define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args) #define stamp(fmt, args...) \
pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args)
#define stampit() stamp("here i am") #define stampit() stamp("here i am")
#define pr_devinit(fmt, args...) ({ static const __devinitconst char __fmt[] = fmt; printk(__fmt, ## args); }) #define pr_devinit(fmt, args...) \
#define pr_init(fmt, args...) ({ static const __initconst char __fmt[] = fmt; printk(__fmt, ## args); }) ({ static const __devinitconst char __fmt[] = fmt; \
printk(__fmt, ## args); })
#define pr_init(fmt, args...) \
({ static const __initconst char __fmt[] = fmt; \
printk(__fmt, ## args); })
#define WATCHDOG_NAME "bfin-wdt" #define WATCHDOG_NAME "bfin-wdt"
#define PFX WATCHDOG_NAME ": " #define PFX WATCHDOG_NAME ": "
@ -476,7 +481,8 @@ static int __init bfin_wdt_init(void)
return ret; return ret;
} }
bfin_wdt_device = platform_device_register_simple(WATCHDOG_NAME, -1, NULL, 0); bfin_wdt_device = platform_device_register_simple(WATCHDOG_NAME,
-1, NULL, 0);
if (IS_ERR(bfin_wdt_device)) { if (IS_ERR(bfin_wdt_device)) {
pr_init(KERN_ERR PFX "unable to register device\n"); pr_init(KERN_ERR PFX "unable to register device\n");
platform_driver_unregister(&bfin_wdt_driver); platform_driver_unregister(&bfin_wdt_driver);

View file

@ -154,9 +154,9 @@ static struct cpwd *cpwd_device;
static struct timer_list cpwd_timer; static struct timer_list cpwd_timer;
static int wd0_timeout = 0; static int wd0_timeout;
static int wd1_timeout = 0; static int wd1_timeout;
static int wd2_timeout = 0; static int wd2_timeout;
module_param(wd0_timeout, int, 0); module_param(wd0_timeout, int, 0);
MODULE_PARM_DESC(wd0_timeout, "Default watchdog0 timeout in 1/10secs"); MODULE_PARM_DESC(wd0_timeout, "Default watchdog0 timeout in 1/10secs");

View file

@ -293,8 +293,8 @@ static int __init ks8695_wdt_init(void)
if not reset to the default */ if not reset to the default */
if (ks8695_wdt_settimeout(wdt_time)) { if (ks8695_wdt_settimeout(wdt_time)) {
ks8695_wdt_settimeout(WDT_DEFAULT_TIME); ks8695_wdt_settimeout(WDT_DEFAULT_TIME);
pr_info("ks8695_wdt: wdt_time value must be 1 <= wdt_time <= %i, using %d\n", pr_info("ks8695_wdt: wdt_time value must be 1 <= wdt_time <= %i"
wdt_time, WDT_MAX_TIME); ", using %d\n", wdt_time, WDT_MAX_TIME);
} }
return platform_driver_register(&ks8695wdt_driver); return platform_driver_register(&ks8695wdt_driver);
} }

View file

@ -118,7 +118,8 @@ static struct watchdog_info zf_info = {
*/ */
static int action; static int action;
module_param(action, int, 0); 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); static void zf_ping(unsigned long data);
@ -142,7 +143,8 @@ static unsigned long next_heartbeat;
#ifndef ZF_DEBUG #ifndef ZF_DEBUG
# define dprintk(format, args...) # define dprintk(format, args...)
#else #else
# define dprintk(format, args...) printk(KERN_DEBUG PFX ":%s:%d: " format, __func__, __LINE__ , ## args) # define dprintk(format, args...) printk(KERN_DEBUG PFX
":%s:%d: " format, __func__, __LINE__ , ## args)
#endif #endif
@ -340,7 +342,8 @@ static int zf_close(struct inode *inode, struct file *file)
zf_timer_off(); zf_timer_off();
else { else {
del_timer(&zf_timer); del_timer(&zf_timer);
printk(KERN_ERR PFX ": device file closed unexpectedly. Will not stop the WDT!\n"); printk(KERN_ERR PFX ": device file closed unexpectedly. "
"Will not stop the WDT!\n");
} }
clear_bit(0, &zf_is_open); clear_bit(0, &zf_is_open);
zf_expect_close = 0; zf_expect_close = 0;

View file

@ -61,7 +61,9 @@ MODULE_PARM_DESC(nowayout,
#define ONLY_TESTING 0 #define ONLY_TESTING 0
static int mpcore_noboot = ONLY_TESTING; static int mpcore_noboot = ONLY_TESTING;
module_param(mpcore_noboot, int, 0); module_param(mpcore_noboot, int, 0);
MODULE_PARM_DESC(mpcore_noboot, "MPcore watchdog action, set to 1 to ignore reboots, 0 to reboot (default=" __MODULE_STRING(ONLY_TESTING) ")"); MODULE_PARM_DESC(mpcore_noboot, "MPcore watchdog action, "
"set to 1 to ignore reboots, 0 to reboot (default="
__MODULE_STRING(ONLY_TESTING) ")");
/* /*
* This is the interrupt handler. Note that we only use this * This is the interrupt handler. Note that we only use this
@ -416,7 +418,8 @@ static struct platform_driver mpcore_wdt_driver = {
}, },
}; };
static char banner[] __initdata = KERN_INFO "MPcore Watchdog Timer: 0.1. mpcore_noboot=%d mpcore_margin=%d sec (nowayout= %d)\n"; static char banner[] __initdata = KERN_INFO "MPcore Watchdog Timer: 0.1. "
"mpcore_noboot=%d mpcore_margin=%d sec (nowayout= %d)\n";
static int __init mpcore_wdt_init(void) static int __init mpcore_wdt_init(void)
{ {

View file

@ -68,15 +68,10 @@ MODULE_PARM_DESC(tmr_atboot,
__MODULE_STRING(CONFIG_S3C2410_WATCHDOG_ATBOOT)); __MODULE_STRING(CONFIG_S3C2410_WATCHDOG_ATBOOT));
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
MODULE_PARM_DESC(soft_noboot, "Watchdog action, set to 1 to ignore reboots, 0 to reboot (default depends on ONLY_TESTING)"); MODULE_PARM_DESC(soft_noboot, "Watchdog action, set to 1 to ignore reboots, "
"0 to reboot (default depends on ONLY_TESTING)");
MODULE_PARM_DESC(debug, "Watchdog debug, set to >1 for debug, (default 0)"); MODULE_PARM_DESC(debug, "Watchdog debug, set to >1 for debug, (default 0)");
typedef enum close_state {
CLOSE_STATE_NOT,
CLOSE_STATE_ALLOW = 0x4021
} close_state_t;
static unsigned long open_lock; static unsigned long open_lock;
static struct device *wdt_dev; /* platform device attached to */ static struct device *wdt_dev; /* platform device attached to */
static struct resource *wdt_mem; static struct resource *wdt_mem;
@ -84,7 +79,7 @@ static struct resource *wdt_irq;
static struct clk *wdt_clock; static struct clk *wdt_clock;
static void __iomem *wdt_base; static void __iomem *wdt_base;
static unsigned int wdt_count; static unsigned int wdt_count;
static close_state_t allow_close; static char expect_close;
static DEFINE_SPINLOCK(wdt_lock); static DEFINE_SPINLOCK(wdt_lock);
/* watchdog control routines */ /* watchdog control routines */
@ -211,7 +206,7 @@ static int s3c2410wdt_open(struct inode *inode, struct file *file)
if (nowayout) if (nowayout)
__module_get(THIS_MODULE); __module_get(THIS_MODULE);
allow_close = CLOSE_STATE_NOT; expect_close = 0;
/* start the timer */ /* start the timer */
s3c2410wdt_start(); s3c2410wdt_start();
@ -225,13 +220,13 @@ static int s3c2410wdt_release(struct inode *inode, struct file *file)
* Lock it in if it's a module and we set nowayout * Lock it in if it's a module and we set nowayout
*/ */
if (allow_close == CLOSE_STATE_ALLOW) if (expect_close == 42)
s3c2410wdt_stop(); s3c2410wdt_stop();
else { else {
dev_err(wdt_dev, "Unexpected close, not stopping watchdog\n"); dev_err(wdt_dev, "Unexpected close, not stopping watchdog\n");
s3c2410wdt_keepalive(); s3c2410wdt_keepalive();
} }
allow_close = CLOSE_STATE_NOT; expect_close = 0;
clear_bit(0, &open_lock); clear_bit(0, &open_lock);
return 0; return 0;
} }
@ -247,7 +242,7 @@ static ssize_t s3c2410wdt_write(struct file *file, const char __user *data,
size_t i; size_t i;
/* In case it was set long ago */ /* In case it was set long ago */
allow_close = CLOSE_STATE_NOT; expect_close = 0;
for (i = 0; i != len; i++) { for (i = 0; i != len; i++) {
char c; char c;
@ -255,7 +250,7 @@ static ssize_t s3c2410wdt_write(struct file *file, const char __user *data,
if (get_user(c, data + i)) if (get_user(c, data + i))
return -EFAULT; return -EFAULT;
if (c == 'V') if (c == 'V')
allow_close = CLOSE_STATE_ALLOW; expect_close = 42;
} }
} }
s3c2410wdt_keepalive(); s3c2410wdt_keepalive();
@ -263,7 +258,7 @@ static ssize_t s3c2410wdt_write(struct file *file, const char __user *data,
return len; return len;
} }
#define OPTIONS WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE #define OPTIONS (WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE)
static const struct watchdog_info s3c2410_wdt_ident = { static const struct watchdog_info s3c2410_wdt_ident = {
.options = OPTIONS, .options = OPTIONS,
@ -331,7 +326,7 @@ static irqreturn_t s3c2410wdt_irq(int irqno, void *param)
} }
/* device interface */ /* device interface */
static int s3c2410wdt_probe(struct platform_device *pdev) static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
{ {
struct resource *res; struct resource *res;
struct device *dev; struct device *dev;
@ -404,7 +399,8 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
"tmr_margin value out of range, default %d used\n", "tmr_margin value out of range, default %d used\n",
CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME); CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME);
else else
dev_info(dev, "default timer value is out of range, cannot start\n"); dev_info(dev, "default timer value is out of range, "
"cannot start\n");
} }
ret = misc_register(&s3c2410wdt_miscdev); ret = misc_register(&s3c2410wdt_miscdev);
@ -453,7 +449,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int s3c2410wdt_remove(struct platform_device *dev) static int __devexit s3c2410wdt_remove(struct platform_device *dev)
{ {
release_resource(wdt_mem); release_resource(wdt_mem);
kfree(wdt_mem); kfree(wdt_mem);
@ -515,7 +511,7 @@ static int s3c2410wdt_resume(struct platform_device *dev)
static struct platform_driver s3c2410wdt_driver = { static struct platform_driver s3c2410wdt_driver = {
.probe = s3c2410wdt_probe, .probe = s3c2410wdt_probe,
.remove = s3c2410wdt_remove, .remove = __devexit_p(s3c2410wdt_remove),
.shutdown = s3c2410wdt_shutdown, .shutdown = s3c2410wdt_shutdown,
.suspend = s3c2410wdt_suspend, .suspend = s3c2410wdt_suspend,
.resume = s3c2410wdt_resume, .resume = s3c2410wdt_resume,

View file

@ -269,9 +269,10 @@ irqreturn_t sbwdog_interrupt(int irq, void *addr)
* if it's the second watchdog timer, it's for those users * if it's the second watchdog timer, it's for those users
*/ */
if (wd_cfg_reg == user_dog) if (wd_cfg_reg == user_dog)
printk(KERN_CRIT printk(KERN_CRIT "%s in danger of initiating system reset "
"%s in danger of initiating system reset in %ld.%01ld seconds\n", "in %ld.%01ld seconds\n",
ident.identity, wd_init / 1000000, (wd_init / 100000) % 10); ident.identity,
wd_init / 1000000, (wd_init / 100000) % 10);
else else
cfg |= 1; cfg |= 1;

View file

@ -372,8 +372,9 @@ static int __init sbc60xxwdt_init(void)
wdt_miscdev.minor, rc); wdt_miscdev.minor, rc);
goto err_out_reboot; goto err_out_reboot;
} }
printk(KERN_INFO PFX "WDT driver for 60XX single board computer initialised. timeout=%d sec (nowayout=%d)\n", printk(KERN_INFO PFX
timeout, nowayout); "WDT driver for 60XX single board computer initialised. "
"timeout=%d sec (nowayout=%d)\n", timeout, nowayout);
return 0; return 0;

View file

@ -280,8 +280,8 @@ static int sbc8360_close(struct inode *inode, struct file *file)
if (expect_close == 42) if (expect_close == 42)
sbc8360_stop(); sbc8360_stop();
else else
printk(KERN_CRIT PFX printk(KERN_CRIT PFX "SBC8360 device closed unexpectedly. "
"SBC8360 device closed unexpectedly. SBC8360 will not stop!\n"); "SBC8360 will not stop!\n");
clear_bit(0, &sbc8360_is_open); clear_bit(0, &sbc8360_is_open);
expect_close = 0; expect_close = 0;

View file

@ -174,8 +174,8 @@ static struct notifier_block epx_c3_notifier = {
.notifier_call = epx_c3_notify_sys, .notifier_call = epx_c3_notify_sys,
}; };
static const char banner[] __initdata = static const char banner[] __initdata = KERN_INFO PFX
KERN_INFO PFX "Hardware Watchdog Timer for Winsystems EPX-C3 SBC: 0.1\n"; "Hardware Watchdog Timer for Winsystems EPX-C3 SBC: 0.1\n";
static int __init watchdog_init(void) static int __init watchdog_init(void)
{ {
@ -219,6 +219,9 @@ module_init(watchdog_init);
module_exit(watchdog_exit); module_exit(watchdog_exit);
MODULE_AUTHOR("Calin A. Culianu <calin@ajvar.org>"); MODULE_AUTHOR("Calin A. Culianu <calin@ajvar.org>");
MODULE_DESCRIPTION("Hardware Watchdog Device for Winsystems EPX-C3 SBC. Note that there is no way to probe for this device -- so only use it if you are *sure* you are runnning on this specific SBC system from Winsystems! It writes to IO ports 0x1ee and 0x1ef!"); MODULE_DESCRIPTION("Hardware Watchdog Device for Winsystems EPX-C3 SBC. "
"Note that there is no way to probe for this device -- "
"so only use it if you are *sure* you are runnning on this specific "
"SBC system from Winsystems! It writes to IO ports 0x1ee and 0x1ef!");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);

View file

@ -108,7 +108,9 @@ static int scx200_wdt_open(struct inode *inode, struct file *file)
static int scx200_wdt_release(struct inode *inode, struct file *file) static int scx200_wdt_release(struct inode *inode, struct file *file)
{ {
if (expect_close != 42) if (expect_close != 42)
printk(KERN_WARNING NAME ": watchdog device closed unexpectedly, will not disable the watchdog timer\n"); printk(KERN_WARNING NAME
": watchdog device closed unexpectedly, "
"will not disable the watchdog timer\n");
else if (!nowayout) else if (!nowayout)
scx200_wdt_disable(); scx200_wdt_disable();
expect_close = 0; expect_close = 0;

View file

@ -494,7 +494,9 @@ MODULE_LICENSE("GPL");
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
module_param(clock_division_ratio, int, 0); module_param(clock_division_ratio, int, 0);
MODULE_PARM_DESC(clock_division_ratio, "Clock division ratio. Valid ranges are from 0x5 (1.31ms) to 0x7 (5.25ms). (default=" __MODULE_STRING(clock_division_ratio) ")"); MODULE_PARM_DESC(clock_division_ratio,
"Clock division ratio. Valid ranges are from 0x5 (1.31ms) "
"to 0x7 (5.25ms). (default=" __MODULE_STRING(clock_division_ratio) ")");
module_param(heartbeat, int, 0); module_param(heartbeat, int, 0);
MODULE_PARM_DESC(heartbeat, MODULE_PARM_DESC(heartbeat,

View file

@ -71,7 +71,9 @@ static int soft_noboot = 0;
#endif /* ONLY_TESTING */ #endif /* ONLY_TESTING */
module_param(soft_noboot, int, 0); module_param(soft_noboot, int, 0);
MODULE_PARM_DESC(soft_noboot, "Softdog action, set to 1 to ignore reboots, 0 to reboot (default depends on ONLY_TESTING)"); MODULE_PARM_DESC(soft_noboot,
"Softdog action, set to 1 to ignore reboots, 0 to reboot "
"(default depends on ONLY_TESTING)");
/* /*
* Our timer * Our timer
@ -264,7 +266,8 @@ static struct notifier_block softdog_notifier = {
.notifier_call = softdog_notify_sys, .notifier_call = softdog_notify_sys,
}; };
static char banner[] __initdata = KERN_INFO "Software Watchdog Timer: 0.07 initialized. soft_noboot=%d soft_margin=%d sec (nowayout= %d)\n"; static char banner[] __initdata = KERN_INFO "Software Watchdog Timer: 0.07 "
"initialized. soft_noboot=%d soft_margin=%d sec (nowayout= %d)\n";
static int __init watchdog_init(void) static int __init watchdog_init(void)
{ {

View file

@ -413,7 +413,8 @@ static int __init wdt_init(void)
w83697hf_init(); w83697hf_init();
if (early_disable) { if (early_disable) {
if (wdt_running()) if (wdt_running())
printk(KERN_WARNING PFX "Stopping previously enabled watchdog until userland kicks in\n"); printk(KERN_WARNING PFX "Stopping previously enabled "
"watchdog until userland kicks in\n");
wdt_disable(); wdt_disable();
} }

View file

@ -49,12 +49,7 @@ MODULE_LICENSE("GPL");
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
MODULE_ALIAS_MISCDEV(TEMP_MINOR); MODULE_ALIAS_MISCDEV(TEMP_MINOR);
#ifdef CONFIG_WATCHDOG_NOWAYOUT static int wdrtas_nowayout = WATCHDOG_NOWAYOUT;
static int wdrtas_nowayout = 1;
#else
static int wdrtas_nowayout = 0;
#endif
static atomic_t wdrtas_miscdev_open = ATOMIC_INIT(0); static atomic_t wdrtas_miscdev_open = ATOMIC_INIT(0);
static char wdrtas_expect_close; static char wdrtas_expect_close;