Loading drivers/watchdog/ib700wdt.c +52 −51 Original line number Diff line number Diff line Loading @@ -42,8 +42,8 @@ #include <linux/moduleparam.h> #include <linux/platform_device.h> #include <asm/io.h> #include <asm/uaccess.h> #include <linux/io.h> #include <linux/uaccess.h> #include <asm/system.h> static struct platform_device *ibwdt_platform_device; Loading Loading @@ -120,7 +120,9 @@ static int wd_margin = WD_TIMO; static int nowayout = WATCHDOG_NOWAYOUT; module_param(nowayout, int, 0); MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); /* Loading Loading @@ -165,8 +167,8 @@ ibwdt_set_heartbeat(int t) * /dev/watchdog handling */ static ssize_t ibwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) static ssize_t ibwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { if (count) { if (!nowayout) { Loading @@ -188,16 +190,15 @@ ibwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppo return count; } static int ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) static long ibwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { int new_margin; void __user *argp = (void __user *)arg; int __user *p = argp; static struct watchdog_info ident = { .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .firmware_version = 1, .identity = "IB700 WDT", }; Loading Loading @@ -238,27 +239,22 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ibwdt_disable(); retval = 0; } if (options & WDIOS_ENABLECARD) { ibwdt_ping(); retval = 0; } return retval; } default: return -ENOTTY; } return 0; } static int ibwdt_open(struct inode *inode, struct file *file) static int ibwdt_open(struct inode *inode, struct file *file) { if (test_and_set_bit(0, &ibwdt_is_open)) { if (test_and_set_bit(0, &ibwdt_is_open)) return -EBUSY; } if (nowayout) __module_get(THIS_MODULE); Loading @@ -273,7 +269,8 @@ ibwdt_close(struct inode *inode, struct file *file) if (expect_close == 42) { ibwdt_disable(); } else { printk(KERN_CRIT PFX "WDT device closed unexpectedly. WDT will not stop!\n"); printk(KERN_CRIT PFX "WDT device closed unexpectedly. WDT will not stop!\n"); ibwdt_ping(); } clear_bit(0, &ibwdt_is_open); Loading @@ -289,7 +286,7 @@ static const struct file_operations ibwdt_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .write = ibwdt_write, .ioctl = ibwdt_ioctl, .unlocked_ioctl = ibwdt_ioctl, .open = ibwdt_open, .release = ibwdt_close, }; Loading @@ -310,14 +307,16 @@ static int __devinit ibwdt_probe(struct platform_device *dev) #if WDT_START != WDT_STOP if (!request_region(WDT_STOP, 1, "IB700 WDT")) { printk (KERN_ERR PFX "STOP method I/O %X is not available.\n", WDT_STOP); printk(KERN_ERR PFX "STOP method I/O %X is not available.\n", WDT_STOP); res = -EIO; goto out_nostopreg; } #endif if (!request_region(WDT_START, 1, "IB700 WDT")) { printk (KERN_ERR PFX "START method I/O %X is not available.\n", WDT_START); printk(KERN_ERR PFX "START method I/O %X is not available.\n", WDT_START); res = -EIO; goto out_nostartreg; } Loading Loading @@ -369,13 +368,15 @@ static int __init ibwdt_init(void) { int err; printk(KERN_INFO PFX "WDT driver for IB700 single board computer initialising.\n"); printk(KERN_INFO PFX "WDT driver for IB700 single board computer initialising.\n"); err = platform_driver_register(&ibwdt_driver); if (err) return err; ibwdt_platform_device = platform_device_register_simple(DRV_NAME, -1, NULL, 0); ibwdt_platform_device = platform_device_register_simple(DRV_NAME, -1, NULL, 0); if (IS_ERR(ibwdt_platform_device)) { err = PTR_ERR(ibwdt_platform_device); goto unreg_platform_driver; Loading Loading
drivers/watchdog/ib700wdt.c +52 −51 Original line number Diff line number Diff line Loading @@ -42,8 +42,8 @@ #include <linux/moduleparam.h> #include <linux/platform_device.h> #include <asm/io.h> #include <asm/uaccess.h> #include <linux/io.h> #include <linux/uaccess.h> #include <asm/system.h> static struct platform_device *ibwdt_platform_device; Loading Loading @@ -120,7 +120,9 @@ static int wd_margin = WD_TIMO; static int nowayout = WATCHDOG_NOWAYOUT; module_param(nowayout, int, 0); MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); /* Loading Loading @@ -165,8 +167,8 @@ ibwdt_set_heartbeat(int t) * /dev/watchdog handling */ static ssize_t ibwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) static ssize_t ibwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { if (count) { if (!nowayout) { Loading @@ -188,16 +190,15 @@ ibwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppo return count; } static int ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) static long ibwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { int new_margin; void __user *argp = (void __user *)arg; int __user *p = argp; static struct watchdog_info ident = { .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .firmware_version = 1, .identity = "IB700 WDT", }; Loading Loading @@ -238,27 +239,22 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ibwdt_disable(); retval = 0; } if (options & WDIOS_ENABLECARD) { ibwdt_ping(); retval = 0; } return retval; } default: return -ENOTTY; } return 0; } static int ibwdt_open(struct inode *inode, struct file *file) static int ibwdt_open(struct inode *inode, struct file *file) { if (test_and_set_bit(0, &ibwdt_is_open)) { if (test_and_set_bit(0, &ibwdt_is_open)) return -EBUSY; } if (nowayout) __module_get(THIS_MODULE); Loading @@ -273,7 +269,8 @@ ibwdt_close(struct inode *inode, struct file *file) if (expect_close == 42) { ibwdt_disable(); } else { printk(KERN_CRIT PFX "WDT device closed unexpectedly. WDT will not stop!\n"); printk(KERN_CRIT PFX "WDT device closed unexpectedly. WDT will not stop!\n"); ibwdt_ping(); } clear_bit(0, &ibwdt_is_open); Loading @@ -289,7 +286,7 @@ static const struct file_operations ibwdt_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .write = ibwdt_write, .ioctl = ibwdt_ioctl, .unlocked_ioctl = ibwdt_ioctl, .open = ibwdt_open, .release = ibwdt_close, }; Loading @@ -310,14 +307,16 @@ static int __devinit ibwdt_probe(struct platform_device *dev) #if WDT_START != WDT_STOP if (!request_region(WDT_STOP, 1, "IB700 WDT")) { printk (KERN_ERR PFX "STOP method I/O %X is not available.\n", WDT_STOP); printk(KERN_ERR PFX "STOP method I/O %X is not available.\n", WDT_STOP); res = -EIO; goto out_nostopreg; } #endif if (!request_region(WDT_START, 1, "IB700 WDT")) { printk (KERN_ERR PFX "START method I/O %X is not available.\n", WDT_START); printk(KERN_ERR PFX "START method I/O %X is not available.\n", WDT_START); res = -EIO; goto out_nostartreg; } Loading Loading @@ -369,13 +368,15 @@ static int __init ibwdt_init(void) { int err; printk(KERN_INFO PFX "WDT driver for IB700 single board computer initialising.\n"); printk(KERN_INFO PFX "WDT driver for IB700 single board computer initialising.\n"); err = platform_driver_register(&ibwdt_driver); if (err) return err; ibwdt_platform_device = platform_device_register_simple(DRV_NAME, -1, NULL, 0); ibwdt_platform_device = platform_device_register_simple(DRV_NAME, -1, NULL, 0); if (IS_ERR(ibwdt_platform_device)) { err = PTR_ERR(ibwdt_platform_device); goto unreg_platform_driver; Loading