summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDale Farnsworth <dale@farnsworth.org>2007-07-24 11:17:23 -0700
committerWim Van Sebroeck <wim@iguana.be>2007-07-24 21:16:18 +0000
commitd37a5c3ddf7f57fdc0632e279eabb1772f89dfc5 (patch)
treef29706cf27ad179bff4c71cb2d49faf9b44cfa32
parent85d57238d2ff9d95892dd1f266b85d2359d48dcc (diff)
downloadop-kernel-dev-d37a5c3ddf7f57fdc0632e279eabb1772f89dfc5.zip
op-kernel-dev-d37a5c3ddf7f57fdc0632e279eabb1772f89dfc5.tar.gz
[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.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/char/watchdog/mv64x60_wdt.c b/drivers/char/watchdog/mv64x60_wdt.c
index 7b48127..009b9a2 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;
static int mv64x60_wdt_timeout;
static unsigned int bus_clk;
+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) ")");
+
static void mv64x60_wdt_reg_write(u32 val)
{
/* 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)
if (test_and_set_bit(MV64x60_WDOG_FLAG_OPENED, &wdt_flags))
return -EBUSY;
+ if (nowayout)
+ __module_get(THIS_MODULE);
+
mv64x60_wdt_service();
mv64x60_wdt_handler_enable();
@@ -110,9 +117,8 @@ static int mv64x60_wdt_release(struct inode *inode, struct file *file)
{
mv64x60_wdt_service();
-#if !defined(CONFIG_WATCHDOG_NOWAYOUT)
- mv64x60_wdt_handler_disable();
-#endif
+ if (!nowayout)
+ mv64x60_wdt_handler_disable();
clear_bit(MV64x60_WDOG_FLAG_OPENED, &wdt_flags);
OpenPOWER on IntegriCloud