diff options
author | Dale Farnsworth <dale@farnsworth.org> | 2007-07-24 14:17:23 -0400 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2007-07-24 17:16:18 -0400 |
commit | d37a5c3ddf7f57fdc0632e279eabb1772f89dfc5 (patch) | |
tree | f29706cf27ad179bff4c71cb2d49faf9b44cfa32 | |
parent | 85d57238d2ff9d95892dd1f266b85d2359d48dcc (diff) |
[WATCHDOG] mv64x60_wdt: Add a module parameter to change nowayout setting
Also, use the WATCHDOG_NOWAYOUT macro, rather than #ifdefs,
and use __module_get to prevent module unloading if WATCHDOG_NOWAYOUT
is set.
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
-rw-r--r-- | drivers/char/watchdog/mv64x60_wdt.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/char/watchdog/mv64x60_wdt.c b/drivers/char/watchdog/mv64x60_wdt.c index 7b4812776382..009b9a2c6efa 100644 --- a/drivers/char/watchdog/mv64x60_wdt.c +++ b/drivers/char/watchdog/mv64x60_wdt.c | |||
@@ -45,6 +45,10 @@ static void __iomem *mv64x60_wdt_regs; | |||
45 | static int mv64x60_wdt_timeout; | 45 | static int mv64x60_wdt_timeout; |
46 | static unsigned int bus_clk; | 46 | static unsigned int bus_clk; |
47 | 47 | ||
48 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
49 | module_param(nowayout, int, 0); | ||
50 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | ||
51 | |||
48 | static void mv64x60_wdt_reg_write(u32 val) | 52 | static void mv64x60_wdt_reg_write(u32 val) |
49 | { | 53 | { |
50 | /* Allow write only to CTL1 / CTL2 fields, retaining values in | 54 | /* Allow write only to CTL1 / CTL2 fields, retaining values in |
@@ -100,6 +104,9 @@ static int mv64x60_wdt_open(struct inode *inode, struct file *file) | |||
100 | if (test_and_set_bit(MV64x60_WDOG_FLAG_OPENED, &wdt_flags)) | 104 | if (test_and_set_bit(MV64x60_WDOG_FLAG_OPENED, &wdt_flags)) |
101 | return -EBUSY; | 105 | return -EBUSY; |
102 | 106 | ||
107 | if (nowayout) | ||
108 | __module_get(THIS_MODULE); | ||
109 | |||
103 | mv64x60_wdt_service(); | 110 | mv64x60_wdt_service(); |
104 | mv64x60_wdt_handler_enable(); | 111 | mv64x60_wdt_handler_enable(); |
105 | 112 | ||
@@ -110,9 +117,8 @@ static int mv64x60_wdt_release(struct inode *inode, struct file *file) | |||
110 | { | 117 | { |
111 | mv64x60_wdt_service(); | 118 | mv64x60_wdt_service(); |
112 | 119 | ||
113 | #if !defined(CONFIG_WATCHDOG_NOWAYOUT) | 120 | if (!nowayout) |
114 | mv64x60_wdt_handler_disable(); | 121 | mv64x60_wdt_handler_disable(); |
115 | #endif | ||
116 | 122 | ||
117 | clear_bit(MV64x60_WDOG_FLAG_OPENED, &wdt_flags); | 123 | clear_bit(MV64x60_WDOG_FLAG_OPENED, &wdt_flags); |
118 | 124 | ||