lkml.org 
[lkml]   [2000]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] watchdog cleanups/bugfixes
On Sat, Sep 30, 2000 at 03:26:53AM +0100, Philipp Rumpf wrote:
> This patch (against 2.4.0-test9-pre7) makes all watchdog drivers use
> module_init, rather than explicit init calls; as a side-effect, it fixes a
> presumed bug that would cause the softdog driver to be used if i810-tco and
> softdog were enabled.

The first patch actually broke softdog and mixcomwd when built as modules (no
return in the module_init functions. blush.) This should fix it:

diff -ur linux/drivers/char/Config.in linux-prumpf/drivers/char/Config.in
--- linux/drivers/char/Config.in Fri Sep 29 16:48:37 2000
+++ linux-prumpf/drivers/char/Config.in Fri Sep 29 17:00:34 2000
@@ -122,6 +122,7 @@
bool 'Watchdog Timer Support' CONFIG_WATCHDOG
if [ "$CONFIG_WATCHDOG" != "n" ]; then
bool ' Disable watchdog shutdown on close' CONFIG_WATCHDOG_NOWAYOUT
+ tristate ' Software Watchdog' CONFIG_SOFT_WATCHDOG
tristate ' WDT Watchdog timer' CONFIG_WDT
tristate ' WDT PCI Watchdog timer' CONFIG_WDTPCI
if [ "$CONFIG_WDT" != "n" ]; then
@@ -130,7 +131,6 @@
bool ' Fan Tachometer' CONFIG_WDT_501_FAN
fi
fi
- tristate ' Software Watchdog' CONFIG_SOFT_WATCHDOG
tristate ' Berkshire Products PC Watchdog' CONFIG_PCWATCHDOG
tristate ' Acquire SBC Watchdog Timer' CONFIG_ACQUIRE_WDT
tristate ' SBC-60XX Watchdog Timer' CONFIG_60XX_WDT
diff -ur linux/drivers/char/Makefile linux-prumpf/drivers/char/Makefile
--- linux/drivers/char/Makefile Fri Sep 29 16:48:37 2000
+++ linux-prumpf/drivers/char/Makefile Fri Sep 29 17:00:34 2000
@@ -160,27 +160,16 @@
obj-$(CONFIG_APPLICOM) += applicom.o
obj-$(CONFIG_MS_BUSMOUSE) += msbusmouse.o
obj-$(CONFIG_82C710_MOUSE) += qpmouse.o
-obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
-obj-$(CONFIG_PCWATCHDOG) += pcwd.o
-obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o
-obj-$(CONFIG_MIXCOMWD) += mixcomwd.o
-obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o
obj-$(CONFIG_AMIGAMOUSE) += amigamouse.o
obj-$(CONFIG_ATARIMOUSE) += atarimouse.o
obj-$(CONFIG_ADBMOUSE) += adbmouse.o
obj-$(CONFIG_PC110_PAD) += pc110pad.o
-obj-$(CONFIG_WDT) += wdt.o
-obj-$(CONFIG_WDTPCI) += wdt_pci.o
obj-$(CONFIG_RTC) += rtc.o
obj-$(CONFIG_EFI_RTC) += efirtc.o
ifeq ($(CONFIG_PPC),)
obj-$(CONFIG_NVRAM) += nvram.o
endif
obj-$(CONFIG_TOSHIBA) += toshiba.o
-
-obj-$(CONFIG_21285_WATCHDOG) += wdt285.o
-obj-$(CONFIG_977_WATCHDOG) += wdt977.o
-obj-$(CONFIG_I810_TCO) += i810-tco.o
obj-$(CONFIG_DS1620) += ds1620.o
obj-$(CONFIG_INTEL_RNG) += i810_rng.o

@@ -230,6 +219,23 @@
MOD_SUB_DIRS += agp
endif
endif
+
+# Only one watchdog can succeed. We probe the hardware watchdog
+# drivers first, then the softdog driver. This means if your hardware
+# watchdog dies or is 'borrowed' for some reason the software watchdog
+# still gives you some cover.
+
+obj-$(CONFIG_PCWATCHDOG) += pcwd.o
+obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o
+obj-$(CONFIG_MIXCOMWD) += mixcomwd.o
+obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o
+obj-$(CONFIG_WDT) += wdt.o
+obj-$(CONFIG_WDTPCI) += wdt_pci.o
+obj-$(CONFIG_21285_WATCHDOG) += wdt285.o
+obj-$(CONFIG_977_WATCHDOG) += wdt977.o
+obj-$(CONFIG_I810_TCO) += i810-tco.o
+obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
+

# Extract lists of the multi-part drivers.
# The 'int-*' lists are the intermediate files used to build the multi's.
diff -ur linux/drivers/char/acquirewdt.c linux-prumpf/drivers/char/acquirewdt.c
--- linux/drivers/char/acquirewdt.c Sun Jul 23 16:44:36 2000
+++ linux-prumpf/drivers/char/acquirewdt.c Fri Sep 29 17:00:34 2000
@@ -204,21 +204,7 @@
0
};

-#ifdef MODULE
-
-#define acq_init init_module
-
-void cleanup_module(void)
-{
- misc_deregister(&acq_miscdev);
- unregister_reboot_notifier(&acq_notifier);
- release_region(WDT_STOP,1);
- release_region(WDT_START,1);
-}
-
-#endif
-
-int __init acq_init(void)
+static int __init acq_init(void)
{
printk("WDT driver for Acquire single board computer initialising.\n");

@@ -229,4 +215,14 @@
register_reboot_notifier(&acq_notifier);
return 0;
}
+
+static void __exit acq_exit(void)
+{
+ misc_deregister(&acq_miscdev);
+ unregister_reboot_notifier(&acq_notifier);
+ release_region(WDT_STOP,1);
+ release_region(WDT_START,1);
+}

+module_init(acq_init);
+module_exit(acq_exit);
diff -ur linux/drivers/char/i810-tco.c linux-prumpf/drivers/char/i810-tco.c
--- linux/drivers/char/i810-tco.c Tue Sep 26 14:30:46 2000
+++ linux-prumpf/drivers/char/i810-tco.c Fri Sep 29 17:00:34 2000
@@ -301,10 +301,9 @@
tco_timer_settimer ((unsigned char) i810_margin);
tco_timer_reload ();

- /* FIXME: no floating point math */
printk (KERN_INFO
"i810 TCO timer: V0.02, timer margin: %d sec (0x%04x)\n",
- (int) (i810_margin * 0.6), TCOBASE);
+ (int) (i810_margin * 6 / 10), TCOBASE);
return 0;
}

diff -ur linux/drivers/char/misc.c linux-prumpf/drivers/char/misc.c
--- linux/drivers/char/misc.c Fri Sep 29 16:48:38 2000
+++ linux-prumpf/drivers/char/misc.c Fri Sep 29 17:00:34 2000
@@ -70,8 +70,6 @@
extern void gfx_register(void);
#endif
extern void streamable_init(void);
-extern void watchdog_init(void);
-extern void pcwatchdog_init(void);
extern int rtc_sun_init(void); /* Combines MK48T02 and MK48T08 */
extern int rtc_DP8570A_init(void);
extern int rtc_MK48T08_init(void);
@@ -254,18 +252,6 @@
#endif
#ifdef CONFIG_PC110_PAD
pc110pad_init();
-#endif
-/*
- * Only one watchdog can succeed. We probe the pcwatchdog first,
- * then the wdt cards and finally the software watchdog which always
- * works. This means if your hardware watchdog dies or is 'borrowed'
- * for some reason the software watchdog still gives you some cover.
- */
-#ifdef CONFIG_PCWATCHDOG
- pcwatchdog_init();
-#endif
-#ifdef CONFIG_SOFT_WATCHDOG
- watchdog_init();
#endif
#ifdef CONFIG_MVME16x
rtc_MK48T08_init();
diff -ur linux/drivers/char/mixcomwd.c linux-prumpf/drivers/char/mixcomwd.c
--- linux/drivers/char/mixcomwd.c Sun Jul 23 16:44:37 2000
+++ linux-prumpf/drivers/char/mixcomwd.c Sat Sep 30 06:57:35 2000
@@ -216,9 +216,10 @@
return 1;
}

-void __init mixcomwd_init(void)
+static int __init mixcomwd_init(void)
{
int i;
+ int ret;
int found=0;

for (i = 0; !found && mixcomwd_ioports[i] != 0; i++) {
@@ -238,23 +239,21 @@

if (!found) {
printk("mixcomwd: No card detected, or port not available.\n");
- return;
+ return -ENODEV;
}

request_region(watchdog_port,1,"MixCOM watchdog");

- misc_register(&mixcomwd_miscdev);
+ ret = misc_register(&mixcomwd_miscdev);
+ if (ret)
+ return ret;
+
printk(KERN_INFO "MixCOM watchdog driver v%s, watchdog port at 0x%3x\n",VERSION,watchdog_port);
-}

-#ifdef MODULE
-int init_module(void)
-{
- mixcomwd_init();
return 0;
-}
+}

-void cleanup_module(void)
+static void __exit mixcomwd_exit(void)
{
#ifndef CONFIG_WATCHDOG_NOWAYOUT
if(mixcomwd_timer_alive) {
@@ -267,4 +266,6 @@
release_region(watchdog_port,1);
misc_deregister(&mixcomwd_miscdev);
}
-#endif
+
+module_init(mixcomwd_init);
+module_exit(mixcomwd_exit);
diff -ur linux/drivers/char/pcwd.c linux-prumpf/drivers/char/pcwd.c
--- linux/drivers/char/pcwd.c Sun Jul 23 16:44:37 2000
+++ linux-prumpf/drivers/char/pcwd.c Fri Sep 29 19:10:23 2000
@@ -564,11 +564,7 @@
&pcwd_fops
};

-#ifdef MODULE
-int init_module(void)
-#else
-int __init pcwatchdog_init(void)
-#endif
+static int __init pcwatchdog_init(void)
{
int i, found = 0;
spin_lock_init(&io_lock);
@@ -644,8 +640,7 @@
return 0;
}

-#ifdef MODULE
-void cleanup_module(void)
+static void __exit pcwatchdog_exit(void)
{
/* Disable the board */
if (revision == PCWD_REVISION_C) {
@@ -658,4 +653,6 @@

release_region(current_readport, (revision == PCWD_REVISION_A) ? 2 : 4);
}
-#endif
+
+module_init(pcwatchdog_init);
+module_exit(pcwatchdog_exit);
diff -ur linux/drivers/char/sbc60xxwdt.c linux-prumpf/drivers/char/sbc60xxwdt.c
--- linux/drivers/char/sbc60xxwdt.c Sun Jul 23 16:44:37 2000
+++ linux-prumpf/drivers/char/sbc60xxwdt.c Fri Sep 29 19:10:03 2000
@@ -338,4 +338,4 @@
}

module_init(sbc60xxwdt_init);
-module_exit(sbc60xxwdt_unload)
+module_exit(sbc60xxwdt_unload);
diff -ur linux/drivers/char/softdog.c linux-prumpf/drivers/char/softdog.c
--- linux/drivers/char/softdog.c Sun Jul 23 16:44:37 2000
+++ linux-prumpf/drivers/char/softdog.c Sat Sep 30 06:51:32 2000
@@ -53,7 +53,11 @@
* Our timer
*/

-struct timer_list watchdog_ticktock;
+static void watchdog_fire(unsigned long);
+
+static struct timer_list watchdog_ticktock = {
+ function: watchdog_fire,
+};
static int timer_alive = 0;


@@ -164,23 +168,24 @@
&softdog_fops
};

-void __init watchdog_init(void)
+static int __init watchdog_init(void)
{
- misc_register(&softdog_miscdev);
- init_timer(&watchdog_ticktock);
- watchdog_ticktock.function=watchdog_fire;
+ int ret;
+
+ ret = misc_register(&softdog_miscdev);
+
+ if (ret)
+ return ret;
+
printk("Software Watchdog Timer: 0.05, timer margin: %d sec\n", soft_margin);
-}

-#ifdef MODULE
-int init_module(void)
-{
- watchdog_init();
return 0;
-}
+}

-void cleanup_module(void)
+static void __exit watchdog_exit(void)
{
misc_deregister(&softdog_miscdev);
}
-#endif
+
+module_init(watchdog_init);
+module_exit(watchdog_exit);
diff -ur linux/drivers/char/wdt.c linux-prumpf/drivers/char/wdt.c
--- linux/drivers/char/wdt.c Fri Sep 29 16:48:38 2000
+++ linux-prumpf/drivers/char/wdt.c Fri Sep 29 19:12:05 2000
@@ -459,10 +459,6 @@
0
};

-#ifdef MODULE
-
-#define wdt_init init_module
-
/**
* cleanup_module:
*
@@ -473,7 +469,7 @@
* module in 60 seconds or reboot.
*/

-void cleanup_module(void)
+static void __exit wdt_exit(void)
{
misc_deregister(&wdt_miscdev);
#ifdef CONFIG_WDT_501
@@ -484,8 +480,6 @@
free_irq(irq, NULL);
}

-#endif
-
/**
* wdt_init:
*
@@ -494,7 +488,7 @@
* The open() function will actually kick the board off.
*/

-int __init wdt_init(void)
+static int __init wdt_init(void)
{
int ret;

@@ -545,4 +539,7 @@
misc_deregister(&wdt_miscdev);
goto out;
}
+
+module_init(wdt_init);
+module_exit(wdt_exit);

diff -ur linux/drivers/char/wdt_pci.c linux-prumpf/drivers/char/wdt_pci.c
--- linux/drivers/char/wdt_pci.c Fri Sep 29 16:48:38 2000
+++ linux-prumpf/drivers/char/wdt_pci.c Fri Sep 29 17:00:35 2000
@@ -274,7 +274,7 @@
* @ptr: offset (no seek allowed)
*
* Read reports the temperature in degrees Fahrenheit. The API is in
- * farenheit. It was designed by an imperial measurement luddite.
+ * fahrenheit. It was designed by an imperial measurement luddite.
*/

static ssize_t wdtpci_read(struct file *file, char *buf, size_t count, loff_t *ptr)

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

\
 
 \ /
  Last update: 2005-03-22 12:38    [W:0.039 / U:0.736 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site