aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/watchdog/advantechwdt.c
diff options
context:
space:
mode:
authorWim Van Sebroeck <wim@iguana.be>2007-01-11 16:19:28 -0500
committerWim Van Sebroeck <wim@iguana.be>2007-01-11 16:19:28 -0500
commit1d747be647c2239e39a9b5faa138c1e36222b37e (patch)
tree5d8aa778e61de714b7de337042dfeea3b6184b72 /drivers/char/watchdog/advantechwdt.c
parent98c08e98f8e5af1caf106e9ee3d46f3eb1ba4858 (diff)
[WATCHDOG] advantechwdt.c - cleanup before platform_device patches
This cleanup consists of: - make sure that the printk's use the module/driver-name - do the exit of the module exactly the opposite of the init of the module Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/char/watchdog/advantechwdt.c')
-rw-r--r--drivers/char/watchdog/advantechwdt.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/char/watchdog/advantechwdt.c b/drivers/char/watchdog/advantechwdt.c
index 9d732769ba01..6c919797591a 100644
--- a/drivers/char/watchdog/advantechwdt.c
+++ b/drivers/char/watchdog/advantechwdt.c
@@ -43,8 +43,9 @@
43#include <asm/uaccess.h> 43#include <asm/uaccess.h>
44#include <asm/system.h> 44#include <asm/system.h>
45 45
46#define DRV_NAME "advantechwdt"
47#define PFX DRV_NAME ": "
46#define WATCHDOG_NAME "Advantech WDT" 48#define WATCHDOG_NAME "Advantech WDT"
47#define PFX WATCHDOG_NAME ": "
48#define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ 49#define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */
49 50
50static unsigned long advwdt_is_open; 51static unsigned long advwdt_is_open;
@@ -75,10 +76,10 @@ MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=63, defaul
75 76
76static int nowayout = WATCHDOG_NOWAYOUT; 77static int nowayout = WATCHDOG_NOWAYOUT;
77module_param(nowayout, int, 0); 78module_param(nowayout, int, 0);
78MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 79MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
79 80
80/* 81/*
81 * Kernel methods. 82 * Watchdog Operations
82 */ 83 */
83 84
84static void 85static void
@@ -94,6 +95,10 @@ advwdt_disable(void)
94 inb_p(wdt_stop); 95 inb_p(wdt_stop);
95} 96}
96 97
98/*
99 * /dev/watchdog handling
100 */
101
97static ssize_t 102static ssize_t
98advwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) 103advwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
99{ 104{
@@ -126,7 +131,7 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
126 static struct watchdog_info ident = { 131 static struct watchdog_info ident = {
127 .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, 132 .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
128 .firmware_version = 1, 133 .firmware_version = 1,
129 .identity = "Advantech WDT", 134 .identity = WATCHDOG_NAME,
130 }; 135 };
131 136
132 switch (cmd) { 137 switch (cmd) {
@@ -237,9 +242,9 @@ static const struct file_operations advwdt_fops = {
237}; 242};
238 243
239static struct miscdevice advwdt_miscdev = { 244static struct miscdevice advwdt_miscdev = {
240 .minor = WATCHDOG_MINOR, 245 .minor = WATCHDOG_MINOR,
241 .name = "watchdog", 246 .name = "watchdog",
242 .fops = &advwdt_fops, 247 .fops = &advwdt_fops,
243}; 248};
244 249
245/* 250/*
@@ -251,6 +256,10 @@ static struct notifier_block advwdt_notifier = {
251 .notifier_call = advwdt_notify_sys, 256 .notifier_call = advwdt_notify_sys,
252}; 257};
253 258
259/*
260 * Init & exit routines
261 */
262
254static int __init 263static int __init
255advwdt_init(void) 264advwdt_init(void)
256{ 265{
@@ -314,9 +323,9 @@ advwdt_exit(void)
314{ 323{
315 misc_deregister(&advwdt_miscdev); 324 misc_deregister(&advwdt_miscdev);
316 unregister_reboot_notifier(&advwdt_notifier); 325 unregister_reboot_notifier(&advwdt_notifier);
326 release_region(wdt_start,1);
317 if(wdt_stop != wdt_start) 327 if(wdt_stop != wdt_start)
318 release_region(wdt_stop,1); 328 release_region(wdt_stop,1);
319 release_region(wdt_start,1);
320} 329}
321 330
322module_init(advwdt_init); 331module_init(advwdt_init);