[PATCH] - module params for WDT501 driver

Tim Hockin (tphocki@www.orl.ilstu.edu)
Mon, 26 Apr 1999 22:40:35 -0500 (CDT)


This has bugged me since 2.2 came out. Small patch to fix it.

Tim

diff -ruN clean-linux-2.2.6/drivers/char/wdt.c patched-linux-2.2.6/drivers/char/wdt.c
--- clean-linux-2.2.6/drivers/char/wdt.c Sat Oct 17 17:52:18 1998
+++ patched-linux-2.2.6/drivers/char/wdt.c Mon Apr 26 22:29:42 1999
@@ -15,7 +15,7 @@
*
* (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>
*
- * Release 0.07.
+ * Release 0.08.
*
* Fixes
* Dave Gregorich : Modularisation and minor bugs
@@ -24,6 +24,8 @@
* Matt Crocker).
* Alan Cox : Added wdt= boot option
* Alan Cox : Cleaned up copy/user stuff
+ * Tim Hockin : Added insmod parameters, comment cleanup
+ * Parameterized timeout
*/

#include <linux/config.h>
@@ -49,14 +51,27 @@
static int wdt_is_open=0;

/*
- * You must set these - there is no sane way to probe for this board.
- * You can use wdt=x,y to set these now.
+ * There is no sane way to probe for this board.
+ * You can use wdt=x,y,n to set these values
+ * or you can use 'insmod wdt io=x irq=y timeout=n'
*/

static int io=0x240;
static int irq=11;
+static int timeout=60; /* seconds */

-#define WD_TIMO (100*60) /* 1 minute */
+#ifdef MODULE
+
+EXPORT_NO_SYMBOLS;
+MODULE_PARM(io, "i");
+MODULE_PARM_DESC(io, "I/O port for Watchdog WDT500/501 board");
+MODULE_PARM(irq, "i");
+MODULE_PARM_DESC(irq, "IRQ for Watchdog WDT500/501 board");
+MODULE_PARM(timeout, "i");
+MODULE_PARM_DESC(timeout,
+ "Timeout value for Watchdog WDT500/501 board (in seconds)");
+
+#endif

/*
* Setup options
@@ -69,7 +84,11 @@
io=ints[1];
if(ints[0]>1)
irq=ints[2];
+ if(ints[0]>2)
+ timeout=ints[3];
}
+
+ timeout *= 100;
}

/*
@@ -166,7 +185,7 @@
/* Write a watchdog value */
inb_p(WDT_DC);
wdt_ctr_mode(1,2);
- wdt_ctr_load(1,WD_TIMO); /* Timeout */
+ wdt_ctr_load(1,timeout); /* Timeout */
outb_p(0, WDT_DC);
}

@@ -258,7 +277,7 @@
wdt_ctr_mode(1,2);
wdt_ctr_mode(2,0);
wdt_ctr_load(0, 8948); /* count at 100Hz */
- wdt_ctr_load(1,WD_TIMO); /* Timeout 120 seconds */
+ wdt_ctr_load(1,timeout); /* Timeout */
wdt_ctr_load(2,65535);
outb_p(0, WDT_DC); /* Enable */
return 0;
@@ -365,7 +384,7 @@

__initfunc(int wdt_init(void))
{
- printk("WDT500/501-P driver 0.07 at %X (Interrupt %d)\n", io,irq);
+ printk("WDT500/501-P driver 0.08 at %X (Interrupt %d)\n", io,irq);
if(request_irq(irq, wdt_interrupt, SA_INTERRUPT, "wdt501p", NULL))
{
printk("IRQ %d is not free.\n", irq);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/