Commit 7a5aa432 authored by Wim Van Sebroeck's avatar Wim Van Sebroeck

[WATCHDOG] wafer5823wdt.c - patch

general clean-up (comments, trailing spaces, ...)
Added WATCHDOG_NAME and PFX defines for easier printk's.
clean-up printk's.
parent c464aee6
/* /*
* ICP Wafer 5823 Single Board Computer WDT driver for Linux 2.4.x * ICP Wafer 5823 Single Board Computer WDT driver
* http://www.icpamerica.com/wafer_5823.php * http://www.icpamerica.com/wafer_5823.php
* May also work on other similar models * May also work on other similar models
* *
...@@ -39,6 +39,10 @@ ...@@ -39,6 +39,10 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#define WATCHDOG_NAME "Wafer 5823 WDT"
#define PFX WATCHDOG_NAME ": "
#define WD_TIMO 60 /* 60 sec default timeout */
static unsigned long wafwdt_is_open; static unsigned long wafwdt_is_open;
static spinlock_t wafwdt_lock; static spinlock_t wafwdt_lock;
static int expect_close = 0; static int expect_close = 0;
...@@ -55,7 +59,6 @@ static int expect_close = 0; ...@@ -55,7 +59,6 @@ static int expect_close = 0;
#define WDT_START 0x443 #define WDT_START 0x443
#define WDT_STOP 0x843 #define WDT_STOP 0x843
#define WD_TIMO 60 /* 1 minute */
static int wd_margin = WD_TIMO; static int wd_margin = WD_TIMO;
#ifdef CONFIG_WATCHDOG_NOWAYOUT #ifdef CONFIG_WATCHDOG_NOWAYOUT
...@@ -124,7 +127,7 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -124,7 +127,7 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd
static struct watchdog_info ident = { static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
.firmware_version = 1, .firmware_version = 1,
.identity = "Wafer 5823 WDT" .identity = "Wafer 5823 WDT",
}; };
int one=1; int one=1;
...@@ -177,7 +180,7 @@ wafwdt_close(struct inode *inode, struct file *file) ...@@ -177,7 +180,7 @@ wafwdt_close(struct inode *inode, struct file *file)
if (expect_close) { if (expect_close) {
wafwdt_stop(); wafwdt_stop();
} else { } else {
printk(KERN_CRIT "WDT device closed unexpectedly. WDT will not stop!\n"); printk(KERN_CRIT PFX "WDT device closed unexpectedly. WDT will not stop!\n");
} }
return 0; return 0;
} }
...@@ -201,6 +204,7 @@ static int wafwdt_notify_sys(struct notifier_block *this, unsigned long code, vo ...@@ -201,6 +204,7 @@ static int wafwdt_notify_sys(struct notifier_block *this, unsigned long code, vo
static struct file_operations wafwdt_fops = { static struct file_operations wafwdt_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.llseek = no_llseek,
.write = wafwdt_write, .write = wafwdt_write,
.ioctl = wafwdt_ioctl, .ioctl = wafwdt_ioctl,
.open = wafwdt_open, .open = wafwdt_open,
...@@ -210,7 +214,7 @@ static struct file_operations wafwdt_fops = { ...@@ -210,7 +214,7 @@ static struct file_operations wafwdt_fops = {
static struct miscdevice wafwdt_miscdev = { static struct miscdevice wafwdt_miscdev = {
.minor = WATCHDOG_MINOR, .minor = WATCHDOG_MINOR,
.name = "watchdog", .name = "watchdog",
.fops = &wafwdt_fops .fops = &wafwdt_fops,
}; };
/* /*
...@@ -221,12 +225,12 @@ static struct miscdevice wafwdt_miscdev = { ...@@ -221,12 +225,12 @@ static struct miscdevice wafwdt_miscdev = {
static struct notifier_block wafwdt_notifier = { static struct notifier_block wafwdt_notifier = {
.notifier_call = wafwdt_notify_sys, .notifier_call = wafwdt_notify_sys,
.next = NULL, .next = NULL,
.priority = 0 .priority = 0,
}; };
static int __init wafwdt_init(void) static int __init wafwdt_init(void)
{ {
printk(KERN_INFO "WDT driver for Wafer 5823 single board computer initialising.\n"); printk(KERN_INFO PFX "WDT driver for Wafer 5823 single board computer initialising.\n");
spin_lock_init(&wafwdt_lock); spin_lock_init(&wafwdt_lock);
if(!request_region(WDT_STOP, 1, "Wafer 5823 WDT")) if(!request_region(WDT_STOP, 1, "Wafer 5823 WDT"))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment