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
* *
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version * as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
* *
* Neither Alan Cox nor CymruNet Ltd. admit liability nor provide * Neither Alan Cox nor CymruNet Ltd. admit liability nor provide
* warranty for any of this software. This material is provided * warranty for any of this software. This material is provided
* "AS-IS" and at no charge. * "AS-IS" and at no charge.
* *
* (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk> * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>
* *
...@@ -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;
...@@ -174,10 +177,10 @@ static int ...@@ -174,10 +177,10 @@ static int
wafwdt_close(struct inode *inode, struct file *file) wafwdt_close(struct inode *inode, struct file *file)
{ {
clear_bit(0, &wafwdt_is_open); clear_bit(0, &wafwdt_is_open);
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,23 +214,23 @@ static struct file_operations wafwdt_fops = { ...@@ -210,23 +214,23 @@ 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,
}; };
/* /*
* The WDT needs to learn about soft shutdowns in order to * The WDT needs to learn about soft shutdowns in order to
* turn the timebomb registers off. * turn the timebomb registers off.
*/ */
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