From 6513e2a03887c6c9bd0b30593827a01ce3f7b542 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 19 May 2008 14:05:46 +0100 Subject: [WATCHDOG 11/57] hpwdt: couple of include cleanups clean-up includes Signed-off-by: Alan Cox Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/hpwdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/watchdog/hpwdt.c') diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index 6a63535fc04d..45bf66c72457 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c @@ -39,9 +39,9 @@ #include #include #include -#include +#include #include -#include +#include #define PCI_BIOS32_SD_VALUE 0x5F32335F /* "_32_" */ #define CRU_BIOS_SIGNATURE_VALUE 0x55524324 -- cgit v1.2.3-59-g8ed1b From 9e74114d96bb5dbaa17b9292139b0c6205e0b971 Mon Sep 17 00:00:00 2001 From: Wim Van Sebroeck Date: Tue, 15 Jul 2008 11:18:04 +0000 Subject: [WATCHDOG] hpwdt.c - fix double includes The last clean-up created 2 times the same include. delete the doubles. Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/hpwdt.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/watchdog/hpwdt.c') diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index d20f591e3fd7..7ea8f3e844f3 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c @@ -39,9 +39,7 @@ #include #include #include -#include #include -#include #define PCI_BIOS32_SD_VALUE 0x5F32335F /* "_32_" */ #define CRU_BIOS_SIGNATURE_VALUE 0x55524324 -- cgit v1.2.3-59-g8ed1b From 7944d3a5a70ee5c1904ed1e8b1d71ff0af2854d9 Mon Sep 17 00:00:00 2001 From: Wim Van Sebroeck Date: Wed, 6 Aug 2008 20:19:41 +0000 Subject: [WATCHDOG] more coding style clean-up's More coding style clean-up's. Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/Kconfig | 2 +- drivers/watchdog/Makefile | 2 +- drivers/watchdog/acquirewdt.c | 2 +- drivers/watchdog/advantechwdt.c | 17 +++++----- drivers/watchdog/alim1535_wdt.c | 2 +- drivers/watchdog/alim7101_wdt.c | 4 +-- drivers/watchdog/ar7_wdt.c | 4 +-- drivers/watchdog/at32ap700x_wdt.c | 2 +- drivers/watchdog/eurotechwdt.c | 8 ++--- drivers/watchdog/geodewdt.c | 62 ++++++++++++++-------------------- drivers/watchdog/hpwdt.c | 4 +-- drivers/watchdog/i6300esb.c | 34 +++++++++---------- drivers/watchdog/iTCO_vendor_support.c | 10 +++--- drivers/watchdog/iTCO_wdt.c | 10 +++--- drivers/watchdog/ib700wdt.c | 12 +++---- drivers/watchdog/ibmasr.c | 4 +-- drivers/watchdog/iop_wdt.c | 2 +- drivers/watchdog/it8712f_wdt.c | 2 +- drivers/watchdog/ixp4xx_wdt.c | 13 ++++--- drivers/watchdog/mpc5200_wdt.c | 6 ++-- drivers/watchdog/mpcore_wdt.c | 8 ++--- drivers/watchdog/mtx-1_wdt.c | 4 +-- drivers/watchdog/omap_wdt.c | 2 +- drivers/watchdog/pc87413_wdt.c | 38 ++++++++++----------- drivers/watchdog/pcwd.c | 6 ++-- drivers/watchdog/pcwd_pci.c | 28 +++++++-------- drivers/watchdog/pcwd_usb.c | 61 ++++++++++++++++----------------- drivers/watchdog/rm9k_wdt.c | 13 ++++--- drivers/watchdog/sb_wdog.c | 4 +-- drivers/watchdog/sbc60xxwdt.c | 4 +-- drivers/watchdog/sc1200wdt.c | 2 +- drivers/watchdog/scx200_wdt.c | 2 +- drivers/watchdog/smsc37b787_wdt.c | 4 +-- drivers/watchdog/txx9wdt.c | 2 +- drivers/watchdog/w83627hf_wdt.c | 9 +++-- drivers/watchdog/w83697hf_wdt.c | 11 +++--- drivers/watchdog/wafer5823wdt.c | 20 +++++------ drivers/watchdog/wd501p.h | 2 +- drivers/watchdog/wdrtas.c | 2 +- drivers/watchdog/wdt_pci.c | 2 +- 40 files changed, 199 insertions(+), 227 deletions(-) (limited to 'drivers/watchdog/hpwdt.c') diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 50d44b4b466b..32b9fe153641 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -463,7 +463,7 @@ config PC87413_WDT module will be called pc87413_wdt. Most people will say N. - + config 60XX_WDT tristate "SBC-60XX Watchdog Timer" depends on X86 diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index cdd674ffaa21..049c91895699 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -92,7 +92,7 @@ obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o # MIPS Architecture obj-$(CONFIG_INDYDOG) += indydog.o -obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o +obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o obj-$(CONFIG_AR7_WDT) += ar7_wdt.o diff --git a/drivers/watchdog/acquirewdt.c b/drivers/watchdog/acquirewdt.c index 7a5c69421f12..6e46a551395c 100644 --- a/drivers/watchdog/acquirewdt.c +++ b/drivers/watchdog/acquirewdt.c @@ -126,7 +126,7 @@ static ssize_t acq_write(struct file *file, const char __user *buf, if (!nowayout) { size_t i; /* note: just in case someone wrote the magic character - * five months ago... */ + five months ago... */ expect_close = 0; /* scan to see whether or not we got the magic character */ diff --git a/drivers/watchdog/advantechwdt.c b/drivers/watchdog/advantechwdt.c index bfec16600475..a5110f93a755 100644 --- a/drivers/watchdog/advantechwdt.c +++ b/drivers/watchdog/advantechwdt.c @@ -47,7 +47,8 @@ #define WATCHDOG_NAME "Advantech WDT" #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ -static struct platform_device *advwdt_platform_device; /* the watchdog platform device */ +/* the watchdog platform device */ +static struct platform_device *advwdt_platform_device; static unsigned long advwdt_is_open; static char adv_expect_close; @@ -120,7 +121,7 @@ static ssize_t advwdt_write(struct file *file, const char __user *buf, for (i = 0; i != count; i++) { char c; - if (get_user(c, buf+i)) + if (get_user(c, buf + i)) return -EFAULT; if (c == 'V') adv_expect_close = 42; @@ -199,8 +200,7 @@ static int advwdt_open(struct inode *inode, struct file *file) return nonseekable_open(inode, file); } -static int -advwdt_close(struct inode *inode, struct file *file) +static int advwdt_close(struct inode *inode, struct file *file) { if (adv_expect_close == 42) { advwdt_disable(); @@ -288,9 +288,9 @@ unreg_stop: static int __devexit advwdt_remove(struct platform_device *dev) { misc_deregister(&advwdt_miscdev); - release_region(wdt_start,1); - if(wdt_stop != wdt_start) - release_region(wdt_stop,1); + release_region(wdt_start, 1); + if (wdt_stop != wdt_start) + release_region(wdt_stop, 1); return 0; } @@ -315,7 +315,8 @@ static int __init advwdt_init(void) { int err; - printk(KERN_INFO "WDT driver for Advantech single board computer initialising.\n"); + printk(KERN_INFO + "WDT driver for Advantech single board computer initialising.\n"); err = platform_driver_register(&advwdt_driver); if (err) diff --git a/drivers/watchdog/alim1535_wdt.c b/drivers/watchdog/alim1535_wdt.c index dfa11d19043a..2a7690ecf97d 100644 --- a/drivers/watchdog/alim1535_wdt.c +++ b/drivers/watchdog/alim1535_wdt.c @@ -153,7 +153,7 @@ static ssize_t ali_write(struct file *file, const char __user *data, the magic character */ for (i = 0; i != len; i++) { char c; - if (get_user(c, data+i)) + if (get_user(c, data + i)) return -EFAULT; if (c == 'V') ali_expect_release = 42; diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c index 049c9122e40d..a045ef869439 100644 --- a/drivers/watchdog/alim7101_wdt.c +++ b/drivers/watchdog/alim7101_wdt.c @@ -125,7 +125,7 @@ static void wdt_timer_ping(unsigned long data) static void wdt_change(int writeval) { - char tmp; + char tmp; pci_read_config_byte(alim7101_pmu, ALI_7101_WDT, &tmp); if (writeval == WDT_ENABLE) { @@ -198,7 +198,7 @@ static ssize_t fop_write(struct file *file, const char __user *buf, /* now scan */ for (ofs = 0; ofs != count; ofs++) { char c; - if (get_user(c, buf+ofs)) + if (get_user(c, buf + ofs)) return -EFAULT; if (c == 'V') wdt_expect_close = 42; diff --git a/drivers/watchdog/ar7_wdt.c b/drivers/watchdog/ar7_wdt.c index 9a81a205ef74..55dcbfe2bb72 100644 --- a/drivers/watchdog/ar7_wdt.c +++ b/drivers/watchdog/ar7_wdt.c @@ -213,7 +213,7 @@ static int ar7_wdt_notify_sys(struct notifier_block *this, } static struct notifier_block ar7_wdt_notifier = { - .notifier_call = ar7_wdt_notify_sys + .notifier_call = ar7_wdt_notify_sys, }; static ssize_t ar7_wdt_write(struct file *file, const char *data, @@ -230,7 +230,7 @@ static ssize_t ar7_wdt_write(struct file *file, const char *data, expect_close = 0; for (i = 0; i < len; ++i) { char c; - if (get_user(c, data+i)) + if (get_user(c, data + i)) return -EFAULT; if (c == 'V') expect_close = 1; diff --git a/drivers/watchdog/at32ap700x_wdt.c b/drivers/watchdog/at32ap700x_wdt.c index 4538b57f451a..e8ae638e5804 100644 --- a/drivers/watchdog/at32ap700x_wdt.c +++ b/drivers/watchdog/at32ap700x_wdt.c @@ -283,7 +283,7 @@ static ssize_t at32_wdt_write(struct file *file, const char __user *data, */ for (i = 0; i != len; i++) { char c; - if (get_user(c, data+i)) + if (get_user(c, data + i)) return -EFAULT; if (c == 'V') expect_release = 42; diff --git a/drivers/watchdog/eurotechwdt.c b/drivers/watchdog/eurotechwdt.c index 96250118fd7c..bbd14e34319f 100644 --- a/drivers/watchdog/eurotechwdt.c +++ b/drivers/watchdog/eurotechwdt.c @@ -210,7 +210,7 @@ size_t count, loff_t *ppos) for (i = 0; i != count; i++) { char c; - if (get_user(c, buf+i)) + if (get_user(c, buf + i)) return -EFAULT; if (c == 'V') eur_expect_close = 42; @@ -360,10 +360,8 @@ static int eurwdt_release(struct inode *inode, struct file *file) static int eurwdt_notify_sys(struct notifier_block *this, unsigned long code, void *unused) { - if (code == SYS_DOWN || code == SYS_HALT) { - /* Turn the card off */ - eurwdt_disable_timer(); - } + if (code == SYS_DOWN || code == SYS_HALT) + eurwdt_disable_timer(); /* Turn the card off */ return NOTIFY_DONE; } diff --git a/drivers/watchdog/geodewdt.c b/drivers/watchdog/geodewdt.c index 04b861cfdf0c..614a5c7017b6 100644 --- a/drivers/watchdog/geodewdt.c +++ b/drivers/watchdog/geodewdt.c @@ -77,27 +77,24 @@ static int geodewdt_set_heartbeat(int val) return 0; } -static int -geodewdt_open(struct inode *inode, struct file *file) +static int geodewdt_open(struct inode *inode, struct file *file) { - if (test_and_set_bit(WDT_FLAGS_OPEN, &wdt_flags)) - return -EBUSY; + if (test_and_set_bit(WDT_FLAGS_OPEN, &wdt_flags)) + return -EBUSY; - if (!test_and_clear_bit(WDT_FLAGS_ORPHAN, &wdt_flags)) - __module_get(THIS_MODULE); + if (!test_and_clear_bit(WDT_FLAGS_ORPHAN, &wdt_flags)) + __module_get(THIS_MODULE); geodewdt_ping(); - return nonseekable_open(inode, file); + return nonseekable_open(inode, file); } -static int -geodewdt_release(struct inode *inode, struct file *file) +static int geodewdt_release(struct inode *inode, struct file *file) { if (safe_close) { geodewdt_disable(); module_put(THIS_MODULE); - } - else { + } else { printk(KERN_CRIT "Unexpected close - watchdog is not stopping.\n"); geodewdt_ping(); @@ -109,11 +106,10 @@ geodewdt_release(struct inode *inode, struct file *file) return 0; } -static ssize_t -geodewdt_write(struct file *file, const char __user *data, size_t len, - loff_t *ppos) +static ssize_t geodewdt_write(struct file *file, const char __user *data, + size_t len, loff_t *ppos) { - if(len) { + if (len) { if (!nowayout) { size_t i; safe_close = 0; @@ -134,9 +130,8 @@ geodewdt_write(struct file *file, const char __user *data, size_t len, return len; } -static int -geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, - unsigned long arg) +static int geodewdt_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg) { void __user *argp = (void __user *)arg; int __user *p = argp; @@ -147,7 +142,7 @@ geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | WDIOF_MAGICCLOSE, .firmware_version = 1, .identity = WATCHDOG_NAME, - }; + }; switch (cmd) { case WDIOC_GETSUPPORT: @@ -200,22 +195,21 @@ geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, } static const struct file_operations geodewdt_fops = { - .owner = THIS_MODULE, - .llseek = no_llseek, - .write = geodewdt_write, - .ioctl = geodewdt_ioctl, - .open = geodewdt_open, - .release = geodewdt_release, + .owner = THIS_MODULE, + .llseek = no_llseek, + .write = geodewdt_write, + .ioctl = geodewdt_ioctl, + .open = geodewdt_open, + .release = geodewdt_release, }; static struct miscdevice geodewdt_miscdev = { .minor = WATCHDOG_MINOR, .name = "watchdog", - .fops = &geodewdt_fops + .fops = &geodewdt_fops, }; -static int __devinit -geodewdt_probe(struct platform_device *dev) +static int __devinit geodewdt_probe(struct platform_device *dev) { int ret, timer; @@ -246,15 +240,13 @@ geodewdt_probe(struct platform_device *dev) return ret; } -static int __devexit -geodewdt_remove(struct platform_device *dev) +static int __devexit geodewdt_remove(struct platform_device *dev) { misc_deregister(&geodewdt_miscdev); return 0; } -static void -geodewdt_shutdown(struct platform_device *dev) +static void geodewdt_shutdown(struct platform_device *dev) { geodewdt_disable(); } @@ -269,8 +261,7 @@ static struct platform_driver geodewdt_driver = { }, }; -static int __init -geodewdt_init(void) +static int __init geodewdt_init(void) { int ret; @@ -290,8 +281,7 @@ err: return ret; } -static void __exit -geodewdt_exit(void) +static void __exit geodewdt_exit(void) { platform_device_unregister(geodewdt_platform_device); platform_driver_unregister(&geodewdt_driver); diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index 7ea8f3e844f3..d039d5f2fd1c 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c @@ -405,7 +405,7 @@ static int __devinit detect_cru_service(void) dmi_walk(dmi_find_cru); /* if cru_rom_addr has been set then we found a CRU service */ - return ((cru_rom_addr != NULL)? 0: -ENODEV); + return ((cru_rom_addr != NULL) ? 0: -ENODEV); } /* ------------------------------------------------------------------------- */ @@ -533,7 +533,7 @@ static ssize_t hpwdt_write(struct file *file, const char __user *data, /* scan to see whether or not we got the magic char. */ for (i = 0; i != len; i++) { char c; - if (get_user(c, data+i)) + if (get_user(c, data + i)) return -EFAULT; if (c == 'V') expect_release = 42; diff --git a/drivers/watchdog/i6300esb.c b/drivers/watchdog/i6300esb.c index c768cb718904..c13383f7fcb9 100644 --- a/drivers/watchdog/i6300esb.c +++ b/drivers/watchdog/i6300esb.c @@ -9,18 +9,18 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * - * based on i810-tco.c which is in turn based on softdog.c + * based on i810-tco.c which is in turn based on softdog.c * - * The timer is implemented in the following I/O controller hubs: - * (See the intel documentation on http://developer.intel.com.) - * 6300ESB chip : document number 300641-003 + * The timer is implemented in the following I/O controller hubs: + * (See the intel documentation on http://developer.intel.com.) + * 6300ESB chip : document number 300641-003 * * 2004YYZZ Ross Biro * Initial version 0.01 * 2004YYZZ Ross Biro - * Version 0.02 + * Version 0.02 * 20050210 David Härdeman - * Ported driver to kernel 2.6 + * Ported driver to kernel 2.6 */ /* @@ -108,7 +108,8 @@ MODULE_PARM_DESC(nowayout, * reload register. After this the appropriate registers can be written * to once before they need to be unlocked again. */ -static inline void esb_unlock_registers(void) { +static inline void esb_unlock_registers(void) +{ writeb(ESB_UNLOCK1, ESB_RELOAD_REG); writeb(ESB_UNLOCK2, ESB_RELOAD_REG); } @@ -169,7 +170,7 @@ static int esb_timer_set_heartbeat(int time) /* Write timer 2 */ esb_unlock_registers(); - writel(val, ESB_TIMER2_REG); + writel(val, ESB_TIMER2_REG); /* Reload */ esb_unlock_registers(); @@ -196,7 +197,7 @@ static int esb_timer_read(void) } /* - * /dev/watchdog handling + * /dev/watchdog handling */ static int esb_open(struct inode *inode, struct file *file) @@ -242,7 +243,7 @@ static ssize_t esb_write(struct file *file, const char __user *data, /* scan to see whether or not we got the magic character */ for (i = 0; i != len; i++) { char c; - if (get_user(c, data+i)) + if (get_user(c, data + i)) return -EFAULT; if (c == 'V') esb_expect_close = 42; @@ -262,11 +263,11 @@ static long esb_ioctl(struct file *file, unsigned int cmd, unsigned long arg) void __user *argp = (void __user *)arg; int __user *p = argp; static struct watchdog_info ident = { - .options = WDIOF_SETTIMEOUT | + .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, - .firmware_version = 0, - .identity = ESB_MODULE_NAME, + .firmware_version = 0, + .identity = ESB_MODULE_NAME, }; switch (cmd) { @@ -324,10 +325,9 @@ static long esb_ioctl(struct file *file, unsigned int cmd, unsigned long arg) static int esb_notify_sys(struct notifier_block *this, unsigned long code, void *unused) { - if (code == SYS_DOWN || code == SYS_HALT) { - /* Turn the WDT off */ - esb_timer_stop(); - } + if (code == SYS_DOWN || code == SYS_HALT) + esb_timer_stop(); /* Turn the WDT off */ + return NOTIFY_DONE; } diff --git a/drivers/watchdog/iTCO_vendor_support.c b/drivers/watchdog/iTCO_vendor_support.c index e9e1f7b3fb75..ca344a85eb95 100644 --- a/drivers/watchdog/iTCO_vendor_support.c +++ b/drivers/watchdog/iTCO_vendor_support.c @@ -18,9 +18,9 @@ */ /* Module and version information */ -#define DRV_NAME "iTCO_vendor_support" -#define DRV_VERSION "1.01" -#define DRV_RELDATE "11-Nov-2006" +#define DRV_NAME "iTCO_vendor_support" +#define DRV_VERSION "1.01" +#define DRV_RELDATE "11-Nov-2006" #define PFX DRV_NAME ": " /* Includes */ @@ -37,8 +37,8 @@ /* iTCO defines */ #define SMI_EN acpibase + 0x30 /* SMI Control and Enable Register */ -#define TCOBASE acpibase + 0x60 /* TCO base address */ -#define TCO1_STS TCOBASE + 0x04 /* TCO1 Status Register */ +#define TCOBASE acpibase + 0x60 /* TCO base address */ +#define TCO1_STS TCOBASE + 0x04 /* TCO1 Status Register */ /* List of vendor support modes */ /* SuperMicro Pentium 3 Era 370SSE+-OEM1/P3TSSE */ diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c index b18766436638..bfb93bc2ca9f 100644 --- a/drivers/watchdog/iTCO_wdt.c +++ b/drivers/watchdog/iTCO_wdt.c @@ -55,9 +55,9 @@ */ /* Module and version information */ -#define DRV_NAME "iTCO_wdt" -#define DRV_VERSION "1.03" -#define DRV_RELDATE "30-Apr-2008" +#define DRV_NAME "iTCO_wdt" +#define DRV_VERSION "1.03" +#define DRV_RELDATE "30-Apr-2008" #define PFX DRV_NAME ": " /* Includes */ @@ -107,7 +107,7 @@ enum iTCO_chipsets { TCO_ICH9, /* ICH9 */ TCO_ICH9R, /* ICH9R */ TCO_ICH9DH, /* ICH9DH */ - TCO_ICH9DO, /* ICH9DO */ + TCO_ICH9DO, /* ICH9DO */ TCO_631XESB, /* 631xESB/632xESB */ }; @@ -497,7 +497,7 @@ static ssize_t iTCO_wdt_write(struct file *file, const char __user *data, magic character */ for (i = 0; i != len; i++) { char c; - if (get_user(c, data+i)) + if (get_user(c, data + i)) return -EFAULT; if (c == 'V') expect_release = 42; diff --git a/drivers/watchdog/ib700wdt.c b/drivers/watchdog/ib700wdt.c index 6aa914e5caf5..05a28106e8eb 100644 --- a/drivers/watchdog/ib700wdt.c +++ b/drivers/watchdog/ib700wdt.c @@ -129,8 +129,7 @@ MODULE_PARM_DESC(nowayout, * Watchdog Operations */ -static void -ibwdt_ping(void) +static void ibwdt_ping(void) { spin_lock(&ibwdt_lock); @@ -140,16 +139,14 @@ ibwdt_ping(void) spin_unlock(&ibwdt_lock); } -static void -ibwdt_disable(void) +static void ibwdt_disable(void) { spin_lock(&ibwdt_lock); outb_p(0, WDT_STOP); spin_unlock(&ibwdt_lock); } -static int -ibwdt_set_heartbeat(int t) +static int ibwdt_set_heartbeat(int t) { int i; @@ -263,8 +260,7 @@ static int ibwdt_open(struct inode *inode, struct file *file) return nonseekable_open(inode, file); } -static int -ibwdt_close(struct inode *inode, struct file *file) +static int ibwdt_close(struct inode *inode, struct file *file) { if (expect_close == 42) { ibwdt_disable(); diff --git a/drivers/watchdog/ibmasr.c b/drivers/watchdog/ibmasr.c index 0b549f3ff915..b82405cfb4cd 100644 --- a/drivers/watchdog/ibmasr.c +++ b/drivers/watchdog/ibmasr.c @@ -275,7 +275,7 @@ static long asr_ioctl(struct file *file, unsigned int cmd, unsigned long arg) static const struct watchdog_info ident = { .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, - .identity = "IBM ASR" + .identity = "IBM ASR", }; void __user *argp = (void __user *)arg; int __user *p = argp; @@ -345,7 +345,7 @@ static int asr_release(struct inode *inode, struct file *file) static const struct file_operations asr_fops = { .owner = THIS_MODULE, - .llseek = no_llseek, + .llseek = no_llseek, .write = asr_write, .unlocked_ioctl = asr_ioctl, .open = asr_open, diff --git a/drivers/watchdog/iop_wdt.c b/drivers/watchdog/iop_wdt.c index e0d0a90ea10c..8278b13f77c7 100644 --- a/drivers/watchdog/iop_wdt.c +++ b/drivers/watchdog/iop_wdt.c @@ -241,7 +241,7 @@ static int __init iop_wdt_init(void) with an open */ ret = misc_register(&iop_wdt_miscdev); if (ret == 0) - printk("iop watchdog timer: timeout %lu sec\n", + printk(KERN_INFO "iop watchdog timer: timeout %lu sec\n", iop_watchdog_timeout()); return ret; diff --git a/drivers/watchdog/it8712f_wdt.c b/drivers/watchdog/it8712f_wdt.c index c1db74f6e310..2270ee07c01b 100644 --- a/drivers/watchdog/it8712f_wdt.c +++ b/drivers/watchdog/it8712f_wdt.c @@ -221,7 +221,7 @@ static ssize_t it8712f_wdt_write(struct file *file, const char __user *data, expect_close = 0; for (i = 0; i < len; ++i) { char c; - if (get_user(c, data+i)) + if (get_user(c, data + i)) return -EFAULT; if (c == 'V') expect_close = 42; diff --git a/drivers/watchdog/ixp4xx_wdt.c b/drivers/watchdog/ixp4xx_wdt.c index b94713e4773d..ef3157dc9ac1 100644 --- a/drivers/watchdog/ixp4xx_wdt.c +++ b/drivers/watchdog/ixp4xx_wdt.c @@ -157,8 +157,7 @@ static int ixp4xx_wdt_release(struct inode *inode, struct file *file) } -static const struct file_operations ixp4xx_wdt_fops = -{ +static const struct file_operations ixp4xx_wdt_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .write = ixp4xx_wdt_write, @@ -167,8 +166,7 @@ static const struct file_operations ixp4xx_wdt_fops = .release = ixp4xx_wdt_release, }; -static struct miscdevice ixp4xx_wdt_miscdev = -{ +static struct miscdevice ixp4xx_wdt_miscdev = { .minor = WATCHDOG_MINOR, .name = "watchdog", .fops = &ixp4xx_wdt_fops, @@ -181,8 +179,8 @@ static int __init ixp4xx_wdt_init(void) asm("mrc p15, 0, %0, cr0, cr0, 0;" : "=r"(processor_id) :); if (!(processor_id & 0xf) && !cpu_is_ixp46x()) { - printk("IXP4XXX Watchdog: Rev. A0 IXP42x CPU detected - " - "watchdog disabled\n"); + printk(KERN_ERR "IXP4XXX Watchdog: Rev. A0 IXP42x CPU detected" + " - watchdog disabled\n"); return -ENODEV; } @@ -191,7 +189,8 @@ static int __init ixp4xx_wdt_init(void) WDIOF_CARDRESET : 0; ret = misc_register(&ixp4xx_wdt_miscdev); if (ret == 0) - printk("IXP4xx Watchdog Timer: heartbeat %d sec\n", heartbeat); + printk(KERN_INFO "IXP4xx Watchdog Timer: heartbeat %d sec\n", + heartbeat); return ret; } diff --git a/drivers/watchdog/mpc5200_wdt.c b/drivers/watchdog/mpc5200_wdt.c index ce1811d5d6b1..db91892558f2 100644 --- a/drivers/watchdog/mpc5200_wdt.c +++ b/drivers/watchdog/mpc5200_wdt.c @@ -164,7 +164,7 @@ static int mpc5200_wdt_release(struct inode *inode, struct file *file) static const struct file_operations mpc5200_wdt_fops = { .owner = THIS_MODULE, .write = mpc5200_wdt_write, - .ioctl = mpc5200_wdt_ioctl, + .unlocked_ioctl = mpc5200_wdt_ioctl, .open = mpc5200_wdt_open, .release = mpc5200_wdt_release, }; @@ -219,9 +219,9 @@ static int mpc5200_wdt_probe(struct of_device *op, return 0; iounmap(wdt->regs); - out_release: +out_release: release_mem_region(wdt->mem.start, size); - out_free: +out_free: kfree(wdt); return err; } diff --git a/drivers/watchdog/mpcore_wdt.c b/drivers/watchdog/mpcore_wdt.c index 3c4f95599c65..2a9bfa81f9d6 100644 --- a/drivers/watchdog/mpcore_wdt.c +++ b/drivers/watchdog/mpcore_wdt.c @@ -377,13 +377,13 @@ static int __devinit mpcore_wdt_probe(struct platform_device *dev) return 0; - err_irq: +err_irq: misc_deregister(&mpcore_wdt_miscdev); - err_misc: +err_misc: iounmap(wdt->base); - err_free: +err_free: kfree(wdt); - err_out: +err_out: return ret; } diff --git a/drivers/watchdog/mtx-1_wdt.c b/drivers/watchdog/mtx-1_wdt.c index f820b82da7c3..b4b7b0a4c119 100644 --- a/drivers/watchdog/mtx-1_wdt.c +++ b/drivers/watchdog/mtx-1_wdt.c @@ -191,14 +191,14 @@ static const struct file_operations mtx1_wdt_fops = { .unlocked_ioctl = mtx1_wdt_ioctl, .open = mtx1_wdt_open, .write = mtx1_wdt_write, - .release = mtx1_wdt_release + .release = mtx1_wdt_release, }; static struct miscdevice mtx1_wdt_misc = { .minor = WATCHDOG_MINOR, .name = "watchdog", - .fops = &mtx1_wdt_fops + .fops = &mtx1_wdt_fops, }; diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c index 7beb21ce1de9..6f5420f478a9 100644 --- a/drivers/watchdog/omap_wdt.c +++ b/drivers/watchdog/omap_wdt.c @@ -245,7 +245,7 @@ static const struct file_operations omap_wdt_fops = { static struct miscdevice omap_wdt_miscdev = { .minor = WATCHDOG_MINOR, .name = "watchdog", - .fops = &omap_wdt_fops + .fops = &omap_wdt_fops, }; static int __init omap_wdt_probe(struct platform_device *pdev) diff --git a/drivers/watchdog/pc87413_wdt.c b/drivers/watchdog/pc87413_wdt.c index 5fc7f1349950..e91ada72da1d 100644 --- a/drivers/watchdog/pc87413_wdt.c +++ b/drivers/watchdog/pc87413_wdt.c @@ -38,7 +38,7 @@ /* #define DEBUG 1 */ -#define DEFAULT_TIMEOUT 1 /* 1 minute */ +#define DEFAULT_TIMEOUT 1 /* 1 minute */ #define MAX_TIMEOUT 255 #define VERSION "1.1" @@ -46,17 +46,17 @@ #define PFX MODNAME ": " #define DPFX MODNAME " - DEBUG: " -#define WDT_INDEX_IO_PORT (io+0) /* I/O port base (index register) */ +#define WDT_INDEX_IO_PORT (io+0) /* I/O port base (index register) */ #define WDT_DATA_IO_PORT (WDT_INDEX_IO_PORT+1) #define SWC_LDN 0x04 -#define SIOCFG2 0x22 /* Serial IO register */ -#define WDCTL 0x10 /* Watchdog-Timer-Controll-Register */ -#define WDTO 0x11 /* Watchdog timeout register */ -#define WDCFG 0x12 /* Watchdog config register */ +#define SIOCFG2 0x22 /* Serial IO register */ +#define WDCTL 0x10 /* Watchdog-Timer-Controll-Register */ +#define WDTO 0x11 /* Watchdog timeout register */ +#define WDCFG 0x12 /* Watchdog config register */ -static int io = 0x2E; /* Address used on Portwell Boards */ +static int io = 0x2E; /* Address used on Portwell Boards */ -static int timeout = DEFAULT_TIMEOUT; /* timeout value */ +static int timeout = DEFAULT_TIMEOUT; /* timeout value */ static unsigned long timer_enabled; /* is the timer enabled? */ static char expect_close; /* is the close expected? */ @@ -99,14 +99,14 @@ static inline void pc87413_enable_swc(void) /* Step 2: Enable SWC functions */ - outb_p(0x07, WDT_INDEX_IO_PORT); /* Point SWC_LDN (LDN=4) */ + outb_p(0x07, WDT_INDEX_IO_PORT); /* Point SWC_LDN (LDN=4) */ outb_p(SWC_LDN, WDT_DATA_IO_PORT); - outb_p(0x30, WDT_INDEX_IO_PORT); /* Read Index 0x30 First */ + outb_p(0x30, WDT_INDEX_IO_PORT); /* Read Index 0x30 First */ cr_data = inb(WDT_DATA_IO_PORT); - cr_data |= 0x01; /* Set Bit0 to 1 */ + cr_data |= 0x01; /* Set Bit0 to 1 */ outb_p(0x30, WDT_INDEX_IO_PORT); - outb_p(cr_data, WDT_DATA_IO_PORT); /* Index0x30_bit0P1 */ + outb_p(cr_data, WDT_DATA_IO_PORT); /* Index0x30_bit0P1 */ #ifdef DEBUG printk(KERN_INFO DPFX "pc87413 - Enable SWC functions\n"); @@ -122,10 +122,10 @@ static inline unsigned int pc87413_get_swc_base(void) /* Step 3: Read SWC I/O Base Address */ - outb_p(0x60, WDT_INDEX_IO_PORT); /* Read Index 0x60 */ + outb_p(0x60, WDT_INDEX_IO_PORT); /* Read Index 0x60 */ addr_h = inb(WDT_DATA_IO_PORT); - outb_p(0x61, WDT_INDEX_IO_PORT); /* Read Index 0x61 */ + outb_p(0x61, WDT_INDEX_IO_PORT); /* Read Index 0x61 */ addr_l = inb(WDT_DATA_IO_PORT); @@ -374,7 +374,7 @@ static ssize_t pc87413_write(struct file *file, const char __user *data, magic character */ for (i = 0; i != len; i++) { char c; - if (get_user(c, data+i)) + if (get_user(c, data + i)) return -EFAULT; if (c == 'V') expect_close = 42; @@ -413,7 +413,7 @@ static long pc87413_ioctl(struct file *file, unsigned int cmd, WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .firmware_version = 1, - .identity = "PC87413(HF/F) watchdog" + .identity = "PC87413(HF/F) watchdog", }; uarg.i = (int __user *)arg; @@ -507,7 +507,7 @@ static struct notifier_block pc87413_notifier = { static struct miscdevice pc87413_miscdev = { .minor = WATCHDOG_MINOR, .name = "watchdog", - .fops = &pc87413_fops + .fops = &pc87413_fops, }; /* -- Module init functions -------------------------------------*/ @@ -567,9 +567,9 @@ static void __exit pc87413_exit(void) misc_deregister(&pc87413_miscdev); unregister_reboot_notifier(&pc87413_notifier); - /* release_region(io,2); */ + /* release_region(io, 2); */ - printk(MODNAME " watchdog component driver removed.\n"); + printk(KERN_INFO MODNAME " watchdog component driver removed.\n"); } module_init(pc87413_init); diff --git a/drivers/watchdog/pcwd.c b/drivers/watchdog/pcwd.c index 134386a88852..3b0ddc7fcf3f 100644 --- a/drivers/watchdog/pcwd.c +++ b/drivers/watchdog/pcwd.c @@ -145,7 +145,7 @@ static int pcwd_ioports[] = { 0x270, 0x350, 0x370, 0x000 }; #define CMD_ISA_RESET_RELAYS 0x0D /* Watchdog's Dip Switch heartbeat values */ -static const int heartbeat_tbl [] = { +static const int heartbeat_tbl[] = { 20, /* OFF-OFF-OFF = 20 Sec */ 40, /* OFF-OFF-ON = 40 Sec */ 60, /* OFF-ON-OFF = 1 Min */ @@ -272,7 +272,7 @@ static int set_command_mode(void) printk(KERN_DEBUG PFX "command_mode=%d\n", pcwd_private.command_mode); - return(found); + return found; } static void unset_command_mode(void) @@ -325,7 +325,7 @@ static inline int pcwd_get_option_switches(void) } unset_command_mode(); - return(option_switches); + return option_switches; } static void pcwd_show_card_info(void) diff --git a/drivers/watchdog/pcwd_pci.c b/drivers/watchdog/pcwd_pci.c index 2617129a7ccc..90eb1d4271d7 100644 --- a/drivers/watchdog/pcwd_pci.c +++ b/drivers/watchdog/pcwd_pci.c @@ -96,7 +96,7 @@ #define CMD_GET_CLEAR_RESET_COUNT 0x84 /* Watchdog's Dip Switch heartbeat values */ -static const int heartbeat_tbl [] = { +static const int heartbeat_tbl[] = { 5, /* OFF-OFF-OFF = 5 Sec */ 10, /* OFF-OFF-ON = 10 Sec */ 30, /* OFF-ON-OFF = 30 Sec */ @@ -219,11 +219,10 @@ static void pcipcwd_show_card_info(void) int option_switches; got_fw_rev = send_command(CMD_GET_FIRMWARE_VERSION, &fw_rev_major, &fw_rev_minor); - if (got_fw_rev) { + if (got_fw_rev) sprintf(fw_ver_str, "%u.%02u", fw_rev_major, fw_rev_minor); - } else { + else sprintf(fw_ver_str, ""); - } /* Get switch settings */ option_switches = pcipcwd_get_option_switches(); @@ -330,7 +329,7 @@ static int pcipcwd_get_status(int *status) { int control_status; - *status=0; + *status = 0; control_status = inb_p(pcipcwd_private.io_addr + 1); if (control_status & WD_PCI_WTRP) *status |= WDIOF_CARDRESET; @@ -368,8 +367,8 @@ static int pcipcwd_clear_status(void) outb_p((control_status & WD_PCI_R2DS) | WD_PCI_WTRP, pcipcwd_private.io_addr + 1); /* clear reset counter */ - msb=0; - reset_counter=0xff; + msb = 0; + reset_counter = 0xff; send_command(CMD_GET_CLEAR_RESET_COUNT, &msb, &reset_counter); if (debug >= DEBUG) { @@ -441,7 +440,7 @@ static ssize_t pcipcwd_write(struct file *file, const char __user *data, /* scan to see whether or not we got the magic character */ for (i = 0; i != len; i++) { char c; - if(get_user(c, data+i)) + if (get_user(c, data + i)) return -EFAULT; if (c == 'V') expect_release = 42; @@ -471,8 +470,7 @@ static long pcipcwd_ioctl(struct file *file, unsigned int cmd, switch (cmd) { case WDIOC_GETSUPPORT: - return copy_to_user(argp, &ident, - sizeof (ident)) ? -EFAULT : 0; + return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; case WDIOC_GETSTATUS: { @@ -498,7 +496,7 @@ static long pcipcwd_ioctl(struct file *file, unsigned int cmd, { int new_options, retval = -EINVAL; - if (get_user (new_options, p)) + if (get_user(new_options, p)) return -EFAULT; if (new_options & WDIOS_DISABLECARD) { @@ -600,7 +598,7 @@ static ssize_t pcipcwd_temp_read(struct file *file, char __user *data, if (pcipcwd_get_temperature(&temperature)) return -EFAULT; - if (copy_to_user (data, &temperature, 1)) + if (copy_to_user(data, &temperature, 1)) return -EFAULT; return 1; @@ -625,10 +623,8 @@ static int pcipcwd_temp_release(struct inode *inode, struct file *file) static int pcipcwd_notify_sys(struct notifier_block *this, unsigned long code, void *unused) { - if (code==SYS_DOWN || code==SYS_HALT) { - /* Turn the WDT off */ - pcipcwd_stop(); - } + if (code == SYS_DOWN || code == SYS_HALT) + pcipcwd_stop(); /* Turn the WDT off */ return NOTIFY_DONE; } diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c index 8c582bc0588e..c1685c942de6 100644 --- a/drivers/watchdog/pcwd_usb.c +++ b/drivers/watchdog/pcwd_usb.c @@ -87,7 +87,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" _ #define USB_PCWD_PRODUCT_ID 0x1140 /* table of devices that work with this driver */ -static struct usb_device_id usb_pcwd_table [] = { +static struct usb_device_id usb_pcwd_table[] = { { USB_DEVICE(USB_PCWD_VENDOR_ID, USB_PCWD_PRODUCT_ID) }, { } /* Terminating entry */ }; @@ -109,7 +109,7 @@ MODULE_DEVICE_TABLE (usb, usb_pcwd_table); #define CMD_DISABLE_WATCHDOG CMD_ENABLE_WATCHDOG /* Watchdog's Dip Switch heartbeat values */ -static const int heartbeat_tbl [] = { +static const int heartbeat_tbl[] = { 5, /* OFF-OFF-OFF = 5 Sec */ 10, /* OFF-OFF-ON = 10 Sec */ 30, /* OFF-ON-OFF = 30 Sec */ @@ -129,15 +129,15 @@ static char expect_release; /* Structure to hold all of our device specific stuff */ struct usb_pcwd_private { - struct usb_device * udev; /* save off the usb device pointer */ - struct usb_interface * interface; /* the interface for this device */ + struct usb_device *udev; /* save off the usb device pointer */ + struct usb_interface *interface; /* the interface for this device */ unsigned int interface_number; /* the interface number used for cmd's */ - unsigned char * intr_buffer; /* the buffer to intr data */ + unsigned char *intr_buffer; /* the buffer to intr data */ dma_addr_t intr_dma; /* the dma address for the intr buffer */ size_t intr_size; /* the size of the intr buffer */ - struct urb * intr_urb; /* the urb used for the intr pipe */ + struct urb *intr_urb; /* the urb used for the intr pipe */ unsigned char cmd_command; /* The command that is reported back */ unsigned char cmd_data_msb; /* The data MSB that is reported back */ @@ -153,8 +153,8 @@ static struct usb_pcwd_private *usb_pcwd_device; static DEFINE_MUTEX(disconnect_mutex); /* local function prototypes */ -static int usb_pcwd_probe (struct usb_interface *interface, const struct usb_device_id *id); -static void usb_pcwd_disconnect (struct usb_interface *interface); +static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_device_id *id); +static void usb_pcwd_disconnect(struct usb_interface *interface); /* usb specific object needed to register this driver with the usb subsystem */ static struct usb_driver usb_pcwd_driver = { @@ -194,10 +194,10 @@ static void usb_pcwd_intr_done(struct urb *urb) usb_pcwd->cmd_data_lsb = data[2]; /* notify anyone waiting that the cmd has finished */ - atomic_set (&usb_pcwd->cmd_received, 1); + atomic_set(&usb_pcwd->cmd_received, 1); resubmit: - retval = usb_submit_urb (urb, GFP_ATOMIC); + retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) printk(KERN_ERR PFX "can't resubmit intr, usb_submit_urb failed with result %d\n", retval); @@ -223,7 +223,7 @@ static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd, unsigned cha dbg("sending following data cmd=0x%02x msb=0x%02x lsb=0x%02x", buf[0], buf[1], buf[2]); - atomic_set (&usb_pcwd->cmd_received, 0); + atomic_set(&usb_pcwd->cmd_received, 0); if (usb_control_msg(usb_pcwd->udev, usb_sndctrlpipe(usb_pcwd->udev, 0), HID_REQ_SET_REPORT, HID_DT_REPORT, @@ -236,7 +236,7 @@ static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd, unsigned cha got_response = 0; for (count = 0; (count < USB_COMMAND_TIMEOUT) && (!got_response); count++) { mdelay(1); - if (atomic_read (&usb_pcwd->cmd_received)) + if (atomic_read(&usb_pcwd->cmd_received)) got_response = 1; } @@ -355,7 +355,7 @@ static ssize_t usb_pcwd_write(struct file *file, const char __user *data, /* scan to see whether or not we got the magic character */ for (i = 0; i != len; i++) { char c; - if(get_user(c, data+i)) + if (get_user(c, data + i)) return -EFAULT; if (c == 'V') expect_release = 42; @@ -383,8 +383,7 @@ static long usb_pcwd_ioctl(struct file *file, unsigned int cmd, switch (cmd) { case WDIOC_GETSUPPORT: - return copy_to_user(argp, &ident, - sizeof (ident)) ? -EFAULT : 0; + return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: @@ -404,7 +403,7 @@ static long usb_pcwd_ioctl(struct file *file, unsigned int cmd, { int new_options, retval = -EINVAL; - if (get_user (new_options, p)) + if (get_user(new_options, p)) return -EFAULT; if (new_options & WDIOS_DISABLECARD) { @@ -518,10 +517,8 @@ static int usb_pcwd_temperature_release(struct inode *inode, struct file *file) static int usb_pcwd_notify_sys(struct notifier_block *this, unsigned long code, void *unused) { - if (code==SYS_DOWN || code==SYS_HALT) { - /* Turn the WDT off */ - usb_pcwd_stop(usb_pcwd_device); - } + if (code == SYS_DOWN || code == SYS_HALT) + usb_pcwd_stop(usb_pcwd_device); /* Turn the WDT off */ return NOTIFY_DONE; } @@ -566,13 +563,13 @@ static struct notifier_block usb_pcwd_notifier = { /** * usb_pcwd_delete */ -static inline void usb_pcwd_delete (struct usb_pcwd_private *usb_pcwd) +static inline void usb_pcwd_delete(struct usb_pcwd_private *usb_pcwd) { usb_free_urb(usb_pcwd->intr_urb); if (usb_pcwd->intr_buffer != NULL) usb_buffer_free(usb_pcwd->udev, usb_pcwd->intr_size, usb_pcwd->intr_buffer, usb_pcwd->intr_dma); - kfree (usb_pcwd); + kfree(usb_pcwd); } /** @@ -625,7 +622,7 @@ static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_devi maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); /* allocate memory for our device and initialize it */ - usb_pcwd = kzalloc (sizeof(struct usb_pcwd_private), GFP_KERNEL); + usb_pcwd = kzalloc(sizeof(struct usb_pcwd_private), GFP_KERNEL); if (usb_pcwd == NULL) { printk(KERN_ERR PFX "Out of memory\n"); goto error; @@ -640,7 +637,8 @@ static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_devi usb_pcwd->intr_size = (le16_to_cpu(endpoint->wMaxPacketSize) > 8 ? le16_to_cpu(endpoint->wMaxPacketSize) : 8); /* set up the memory buffer's */ - if (!(usb_pcwd->intr_buffer = usb_buffer_alloc(udev, usb_pcwd->intr_size, GFP_ATOMIC, &usb_pcwd->intr_dma))) { + usb_pcwd->intr_buffer = usb_buffer_alloc(udev, usb_pcwd->intr_size, GFP_ATOMIC, &usb_pcwd->intr_dma); + if (!usb_pcwd->intr_buffer) { printk(KERN_ERR PFX "Out of memory\n"); goto error; } @@ -674,11 +672,10 @@ static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_devi /* Get the Firmware Version */ got_fw_rev = usb_pcwd_send_command(usb_pcwd, CMD_GET_FIRMWARE_VERSION, &fw_rev_major, &fw_rev_minor); - if (got_fw_rev) { + if (got_fw_rev) sprintf(fw_ver_str, "%u.%02u", fw_rev_major, fw_rev_minor); - } else { + else sprintf(fw_ver_str, ""); - } printk(KERN_INFO PFX "Found card (Firmware: %s) with temp option\n", fw_ver_str); @@ -724,7 +721,7 @@ static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_devi } /* we can register the device now, as it is ready */ - usb_set_intfdata (interface, usb_pcwd); + usb_set_intfdata(interface, usb_pcwd); printk(KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n", heartbeat, nowayout); @@ -758,8 +755,8 @@ static void usb_pcwd_disconnect(struct usb_interface *interface) /* prevent races with open() */ mutex_lock(&disconnect_mutex); - usb_pcwd = usb_get_intfdata (interface); - usb_set_intfdata (interface, NULL); + usb_pcwd = usb_get_intfdata(interface); + usb_set_intfdata(interface, NULL); mutex_lock(&usb_pcwd->mtx); @@ -819,5 +816,5 @@ static void __exit usb_pcwd_exit(void) } -module_init (usb_pcwd_init); -module_exit (usb_pcwd_exit); +module_init(usb_pcwd_init); +module_exit(usb_pcwd_exit); diff --git a/drivers/watchdog/rm9k_wdt.c b/drivers/watchdog/rm9k_wdt.c index c172906b553c..f1ae3729a19e 100644 --- a/drivers/watchdog/rm9k_wdt.c +++ b/drivers/watchdog/rm9k_wdt.c @@ -234,8 +234,8 @@ static int wdt_gpi_release(struct inode *inode, struct file *file) return 0; } -static ssize_t -wdt_gpi_write(struct file *f, const char __user *d, size_t s, loff_t *o) +static ssize_t wdt_gpi_write(struct file *f, const char __user *d, size_t s, + loff_t *o) { char val; @@ -325,8 +325,8 @@ static long wdt_gpi_ioctl(struct file *f, unsigned int cmd, unsigned long arg) /* Shutdown notifier */ -static int -wdt_gpi_notify(struct notifier_block *this, unsigned long code, void *unused) +static int wdt_gpi_notify(struct notifier_block *this, unsigned long code, + void *unused) { if (code == SYS_DOWN || code == SYS_HALT) wdt_gpi_stop(); @@ -336,9 +336,8 @@ wdt_gpi_notify(struct notifier_block *this, unsigned long code, void *unused) /* Init & exit procedures */ -static const struct resource * -wdt_gpi_get_resource(struct platform_device *pdv, const char *name, - unsigned int type) +static const struct resource *wdt_gpi_get_resource(struct platform_device *pdv, + const char *name, unsigned int type) { char buf[80]; if (snprintf(buf, sizeof buf, "%s_0", name) >= sizeof buf) diff --git a/drivers/watchdog/sb_wdog.c b/drivers/watchdog/sb_wdog.c index 528097651f7f..27e526a07c9a 100644 --- a/drivers/watchdog/sb_wdog.c +++ b/drivers/watchdog/sb_wdog.c @@ -215,8 +215,8 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd, /* * Notifier for system down */ -static int -sbwdog_notify_sys(struct notifier_block *this, unsigned long code, void *erf) +static int sbwdog_notify_sys(struct notifier_block *this, unsigned long code, + void *erf) { if (code == SYS_DOWN || code == SYS_HALT) { /* diff --git a/drivers/watchdog/sbc60xxwdt.c b/drivers/watchdog/sbc60xxwdt.c index e801cd46c647..3266daaaecf8 100644 --- a/drivers/watchdog/sbc60xxwdt.c +++ b/drivers/watchdog/sbc60xxwdt.c @@ -183,7 +183,7 @@ static ssize_t fop_write(struct file *file, const char __user *buf, magic character */ for (ofs = 0; ofs != count; ofs++) { char c; - if (get_user(c, buf+ofs)) + if (get_user(c, buf + ofs)) return -EFAULT; if (c == 'V') wdt_expect_close = 42; @@ -238,7 +238,7 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) switch (cmd) { case WDIOC_GETSUPPORT: - return copy_to_user(argp, &ident, sizeof(ident))? -EFAULT : 0; + return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: return put_user(0, p); diff --git a/drivers/watchdog/sc1200wdt.c b/drivers/watchdog/sc1200wdt.c index f3bdc8227cc4..23da3ccd832a 100644 --- a/drivers/watchdog/sc1200wdt.c +++ b/drivers/watchdog/sc1200wdt.c @@ -279,7 +279,7 @@ static ssize_t sc1200wdt_write(struct file *file, const char __user *data, for (i = 0; i != len; i++) { char c; - if (get_user(c, data+i)) + if (get_user(c, data + i)) return -EFAULT; if (c == 'V') expect_close = 42; diff --git a/drivers/watchdog/scx200_wdt.c b/drivers/watchdog/scx200_wdt.c index fd5c09446bce..9e19a10a5bb9 100644 --- a/drivers/watchdog/scx200_wdt.c +++ b/drivers/watchdog/scx200_wdt.c @@ -143,7 +143,7 @@ static ssize_t scx200_wdt_write(struct file *file, const char __user *data, expect_close = 0; for (i = 0; i < len; ++i) { char c; - if (get_user(c, data+i)) + if (get_user(c, data + i)) return -EFAULT; if (c == 'V') expect_close = 42; diff --git a/drivers/watchdog/smsc37b787_wdt.c b/drivers/watchdog/smsc37b787_wdt.c index 239383da6d87..988ff1d5b4be 100644 --- a/drivers/watchdog/smsc37b787_wdt.c +++ b/drivers/watchdog/smsc37b787_wdt.c @@ -408,7 +408,7 @@ static ssize_t wb_smsc_wdt_write(struct file *file, const char __user *data, magic character */ for (i = 0; i != len; i++) { char c; - if (get_user(c, data+i)) + if (get_user(c, data + i)) return -EFAULT; if (c == 'V') expect_close = 42; @@ -438,7 +438,7 @@ static long wb_smsc_wdt_ioctl(struct file *file, WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .firmware_version = 0, - .identity = "SMsC 37B787 Watchdog" + .identity = "SMsC 37B787 Watchdog", }; uarg.i = (int __user *)arg; diff --git a/drivers/watchdog/txx9wdt.c b/drivers/watchdog/txx9wdt.c index 8382f9a9534b..dbbc018a5f46 100644 --- a/drivers/watchdog/txx9wdt.c +++ b/drivers/watchdog/txx9wdt.c @@ -190,7 +190,7 @@ static struct miscdevice txx9wdt_miscdev = { }; static struct notifier_block txx9wdt_notifier = { - .notifier_call = txx9wdt_notify_sys + .notifier_call = txx9wdt_notify_sys, }; static int __init txx9wdt_probe(struct platform_device *dev) diff --git a/drivers/watchdog/w83627hf_wdt.c b/drivers/watchdog/w83627hf_wdt.c index 59507f609996..69396adaa5c3 100644 --- a/drivers/watchdog/w83627hf_wdt.c +++ b/drivers/watchdog/w83627hf_wdt.c @@ -180,7 +180,7 @@ static ssize_t wdt_write(struct file *file, const char __user *buf, for (i = 0; i != count; i++) { char c; - if (get_user(c, buf+i)) + if (get_user(c, buf + i)) return -EFAULT; if (c == 'V') expect_close = 42; @@ -278,10 +278,9 @@ static int wdt_close(struct inode *inode, struct file *file) static int wdt_notify_sys(struct notifier_block *this, unsigned long code, void *unused) { - if (code == SYS_DOWN || code == SYS_HALT) { - /* Turn the WDT off */ - wdt_disable(); - } + if (code == SYS_DOWN || code == SYS_HALT) + wdt_disable(); /* Turn the WDT off */ + return NOTIFY_DONE; } diff --git a/drivers/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c index 12bd6618ed5e..445d30a01ed3 100644 --- a/drivers/watchdog/w83697hf_wdt.c +++ b/drivers/watchdog/w83697hf_wdt.c @@ -218,7 +218,7 @@ static ssize_t wdt_write(struct file *file, const char __user *buf, for (i = 0; i != count; i++) { char c; - if (get_user(c, buf+i)) + if (get_user(c, buf + i)) return -EFAULT; if (c == 'V') expect_close = 42; @@ -325,10 +325,9 @@ static int wdt_close(struct inode *inode, struct file *file) static int wdt_notify_sys(struct notifier_block *this, unsigned long code, void *unused) { - if (code == SYS_DOWN || code == SYS_HALT) { - /* Turn the WDT off */ - wdt_disable(); - } + if (code == SYS_DOWN || code == SYS_HALT) + wdt_disable(); /* Turn the WDT off */ + return NOTIFY_DONE; } @@ -414,7 +413,7 @@ static int __init wdt_init(void) w83697hf_init(); if (early_disable) { 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(); } diff --git a/drivers/watchdog/wafer5823wdt.c b/drivers/watchdog/wafer5823wdt.c index 44e81f7d4322..68377ae171ff 100644 --- a/drivers/watchdog/wafer5823wdt.c +++ b/drivers/watchdog/wafer5823wdt.c @@ -1,11 +1,11 @@ /* * ICP Wafer 5823 Single Board Computer WDT driver - * http://www.icpamerica.com/wafer_5823.php - * May also work on other similar models + * http://www.icpamerica.com/wafer_5823.php + * May also work on other similar models * * (c) Copyright 2002 Justin Cormack * - * Release 0.02 + * Release 0.02 * * Based on advantechwdt.c which is based on wdt.c. * Original copyright messages: @@ -50,10 +50,10 @@ static DEFINE_SPINLOCK(wafwdt_lock); /* * You must set these - there is no sane way to probe for this board. * - * To enable, write the timeout value in seconds (1 to 255) to I/O - * port WDT_START, then read the port to start the watchdog. To pat - * the dog, read port WDT_STOP to stop the timer, then read WDT_START - * to restart it again. + * To enable, write the timeout value in seconds (1 to 255) to I/O + * port WDT_START, then read the port to start the watchdog. To pat + * the dog, read port WDT_STOP to stop the timer, then read WDT_START + * to restart it again. */ static int wdt_stop = 0x843; @@ -87,8 +87,7 @@ static void wafwdt_start(void) inb_p(wdt_start); } -static void -wafwdt_stop(void) +static void wafwdt_stop(void) { /* stop watchdog */ inb_p(wdt_stop); @@ -199,8 +198,7 @@ static int wafwdt_open(struct inode *inode, struct file *file) return nonseekable_open(inode, file); } -static int -wafwdt_close(struct inode *inode, struct file *file) +static int wafwdt_close(struct inode *inode, struct file *file) { if (expect_close == 42) wafwdt_stop(); diff --git a/drivers/watchdog/wd501p.h b/drivers/watchdog/wd501p.h index a4504f40394d..db34853c28ae 100644 --- a/drivers/watchdog/wd501p.h +++ b/drivers/watchdog/wd501p.h @@ -12,7 +12,7 @@ * http://www.cymru.net * * This driver is provided under the GNU General Public License, incorporated - * herein by reference. The driver is provided without warranty or + * herein by reference. The driver is provided without warranty or * support. * * Release 0.04. diff --git a/drivers/watchdog/wdrtas.c b/drivers/watchdog/wdrtas.c index 20fd6715f25f..5d3b1a8e28b0 100644 --- a/drivers/watchdog/wdrtas.c +++ b/drivers/watchdog/wdrtas.c @@ -313,7 +313,7 @@ static long wdrtas_ioctl(struct file *file, unsigned int cmd, static struct watchdog_info wdinfo = { .options = WDRTAS_SUPPORTED_MASK, .firmware_version = 0, - .identity = "wdrtas" + .identity = "wdrtas", }; switch (cmd) { diff --git a/drivers/watchdog/wdt_pci.c b/drivers/watchdog/wdt_pci.c index fb8fc0144852..ed02bdb38c09 100644 --- a/drivers/watchdog/wdt_pci.c +++ b/drivers/watchdog/wdt_pci.c @@ -381,7 +381,7 @@ static ssize_t wdtpci_write(struct file *file, const char __user *buf, for (i = 0; i != count; i++) { char c; - if (get_user(c, buf+i)) + if (get_user(c, buf + i)) return -EFAULT; if (c == 'V') expect_close = 42; -- cgit v1.2.3-59-g8ed1b From ab4ba3cdeb59e85552422680b5bac99e28740330 Mon Sep 17 00:00:00 2001 From: Thomas Mingarelli Date: Tue, 15 Jul 2008 19:40:41 +0000 Subject: [WATCHDOG] hpwdt.c kdebug support add kdebug support for the hpwdt.c driver. Signed-off-by: Thomas Mingarelli Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/hpwdt.c | 93 ++++++++++++++++++++++++++---------------------- 1 file changed, 50 insertions(+), 43 deletions(-) (limited to 'drivers/watchdog/hpwdt.c') diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index d039d5f2fd1c..a3765e0be4a8 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c @@ -116,6 +116,7 @@ static unsigned int reload; /* the computed soft_margin */ static int nowayout = WATCHDOG_NOWAYOUT; static char expect_release; static unsigned long hpwdt_is_open; +static unsigned int allow_kdump; static void __iomem *pci_mem_addr; /* the PCI-memory address */ static unsigned long __iomem *hpwdt_timer_reg; @@ -221,19 +222,19 @@ static int __devinit cru_detect(unsigned long map_entry, if (cmn_regs.u1.ral != 0) { printk(KERN_WARNING - "hpwdt: Call succeeded but with an error: 0x%x\n", - cmn_regs.u1.ral); + "hpwdt: Call succeeded but with an error: 0x%x\n", + cmn_regs.u1.ral); } else { physical_bios_base = cmn_regs.u2.rebx; physical_bios_offset = cmn_regs.u4.redx; cru_length = cmn_regs.u3.recx; cru_physical_address = - physical_bios_base + physical_bios_offset; + physical_bios_base + physical_bios_offset; /* If the values look OK, then map it in. */ if ((physical_bios_base + physical_bios_offset)) { cru_rom_addr = - ioremap(cru_physical_address, cru_length); + ioremap(cru_physical_address, cru_length); if (cru_rom_addr) retval = 0; } @@ -356,7 +357,6 @@ asm(".text \n\t" "call *%r12 \n\t" "pushfq \n\t" "popq %r12 \n\t" - "popfq \n\t" "movl %eax, (%r9) \n\t" "movl %ebx, 4(%r9) \n\t" "movl %ecx, 8(%r9) \n\t" @@ -390,10 +390,10 @@ static void __devinit dmi_find_cru(const struct dmi_header *dm) smbios_cru64_ptr = (struct smbios_cru64_info *) dm; if (smbios_cru64_ptr->signature == CRU_BIOS_SIGNATURE_VALUE) { cru_physical_address = - smbios_cru64_ptr->physical_address + - smbios_cru64_ptr->double_offset; + smbios_cru64_ptr->physical_address + + smbios_cru64_ptr->double_offset; cru_rom_addr = ioremap(cru_physical_address, - smbios_cru64_ptr->double_length); + smbios_cru64_ptr->double_length); } } } @@ -405,41 +405,13 @@ static int __devinit detect_cru_service(void) dmi_walk(dmi_find_cru); /* if cru_rom_addr has been set then we found a CRU service */ - return ((cru_rom_addr != NULL) ? 0: -ENODEV); + return ((cru_rom_addr != NULL) ? 0 : -ENODEV); } /* ------------------------------------------------------------------------- */ #endif -/* - * NMI Handler - */ -static int hpwdt_pretimeout(struct notifier_block *nb, unsigned long ulReason, - void *data) -{ - unsigned long rom_pl; - static int die_nmi_called; - - if (ulReason != DIE_NMI && ulReason != DIE_NMI_IPI) - return NOTIFY_OK; - - spin_lock_irqsave(&rom_lock, rom_pl); - if (!die_nmi_called) - asminline_call(&cmn_regs, cru_rom_addr); - die_nmi_called = 1; - spin_unlock_irqrestore(&rom_lock, rom_pl); - if (cmn_regs.u1.ral == 0) { - printk(KERN_WARNING "hpwdt: An NMI occurred, " - "but unable to determine source.\n"); - } else { - panic("An NMI occurred, please see the Integrated " - "Management Log for details.\n"); - } - - return NOTIFY_STOP; -} - /* * Watchdog operations */ @@ -483,6 +455,36 @@ static int hpwdt_change_timer(int new_margin) return 0; } +/* + * NMI Handler + */ +static int hpwdt_pretimeout(struct notifier_block *nb, unsigned long ulReason, + void *data) +{ + unsigned long rom_pl; + static int die_nmi_called; + + if (ulReason != DIE_NMI && ulReason != DIE_NMI_IPI) + return NOTIFY_OK; + + spin_lock_irqsave(&rom_lock, rom_pl); + if (!die_nmi_called) + asminline_call(&cmn_regs, cru_rom_addr); + die_nmi_called = 1; + spin_unlock_irqrestore(&rom_lock, rom_pl); + if (cmn_regs.u1.ral == 0) { + printk(KERN_WARNING "hpwdt: An NMI occurred, " + "but unable to determine source.\n"); + } else { + if (allow_kdump) + hpwdt_stop(); + panic("An NMI occurred, please see the Integrated " + "Management Log for details.\n"); + } + + return NOTIFY_STOP; +} + /* * /dev/watchdog handling */ @@ -625,17 +627,18 @@ static struct notifier_block die_notifier = { */ static int __devinit hpwdt_init_one(struct pci_dev *dev, - const struct pci_device_id *ent) + const struct pci_device_id *ent) { int retval; /* * First let's find out if we are on an iLO2 server. We will * not run on a legacy ASM box. + * So we only support the G5 ProLiant servers and higher. */ if (dev->subsystem_vendor != PCI_VENDOR_ID_HP) { dev_warn(&dev->dev, - "This server does not have an iLO2 ASIC.\n"); + "This server does not have an iLO2 ASIC.\n"); return -ENODEV; } @@ -669,7 +672,7 @@ static int __devinit hpwdt_init_one(struct pci_dev *dev, retval = detect_cru_service(); if (retval < 0) { dev_warn(&dev->dev, - "Unable to detect the %d Bit CRU Service.\n", + "Unable to detect the %d Bit CRU Service.\n", HPWDT_ARCH); goto error_get_cru; } @@ -684,7 +687,7 @@ static int __devinit hpwdt_init_one(struct pci_dev *dev, retval = register_die_notifier(&die_notifier); if (retval != 0) { dev_warn(&dev->dev, - "Unable to register a die notifier (err=%d).\n", + "Unable to register a die notifier (err=%d).\n", retval); goto error_die_notifier; } @@ -699,8 +702,9 @@ static int __devinit hpwdt_init_one(struct pci_dev *dev, printk(KERN_INFO "hp Watchdog Timer Driver: 1.00" - ", timer margin: %d seconds( nowayout=%d).\n", - soft_margin, nowayout); + ", timer margin: %d seconds (nowayout=%d)" + ", allow kernel dump: %s (default = 0/OFF).\n", + soft_margin, nowayout, (allow_kdump == 0) ? "OFF" : "ON"); return 0; @@ -755,6 +759,9 @@ MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); module_param(soft_margin, int, 0); MODULE_PARM_DESC(soft_margin, "Watchdog timeout in seconds"); +module_param(allow_kdump, int, 0); +MODULE_PARM_DESC(allow_kdump, "Start a kernel dump after NMI occurs"); + module_param(nowayout, int, 0); MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); -- cgit v1.2.3-59-g8ed1b