watchdog: Introduce a midlayer/helper library
Subsystems (2)
PATCH 1/1 watchdog: Introduce a midlayer/helper library
I first posted this last May when Wim was somewhat busy, hopefully this can now be progressed for further discussion.
- Handles the temperature device
- You pass it the ident and other structs
- It handles stop not being supported (and stop/start fails)
- It does all the reboot, nowayout and module locking and housekeeping
- I've used static objects for most things so they can be initialised by the compiler making more of the code "table filling".
- We get to delete vast amounts of repeated (usually incorrectly) code.
Current patch (& example conversions) below. I'm still debating whether the watchdog core should implement its own mutex locking for the drivers so that only special case users (eg those with IRQ handlers) need to do their own private locking. That would further reduce mistakes by authors.
(Note that you can mix old and new drivers quite happily so we don't have to
do a complete conversion in one patch set)
---
drivers/watchdog/Kconfig | 15 - drivers/watchdog/Makefile | 12 + drivers/watchdog/alim1535_wdt.c | 284 ++++--------------------- drivers/watchdog/alim7101_wdt.c | 223 +++----------------- drivers/watchdog/i6300esb.c | 262 ++++------------------- drivers/watchdog/sbc_epx_c3.c | 167 +++------------ drivers/watchdog/sc1200wdt.c | 221 +++---------------- drivers/watchdog/softdog.c | 211 +++--------------- drivers/watchdog/wdt.c | 446 ++++++++------------------------------- 9 files changed, 336 insertions(+), 1505 deletions(-)
drivers/watchdog/Kconfig +0 -15
@@ -907,21 +907,6 @@ config WDT To compile this driver as a module, choose M here: the module will be called wdt. -config WDT_501 - bool "WDT501 features" - depends on WDT - help - Saying Y here and creating a character special file /dev/temperature - with major number 10 and minor number 131 ("man mknod") will give - you a thermometer inside your computer: reading from - /dev/temperature yields one byte, the temperature in degrees - Fahrenheit. This works only if you have a WDT501P watchdog board - installed. - - If you want to enable the Fan Tachometer on the WDT501P, then you - can do this via the tachometer parameter. Only do this if you have a - fan tachometer actually set up. - # # PCI-based Watchdog Cards #
drivers/watchdog/Makefile +6 -6
@@ -13,7 +13,7 @@ # ISA-based Watchdog Cards obj-$(CONFIG_PCWATCHDOG) += pcwd.o obj-$(CONFIG_MIXCOMWD) += mixcomwd.o -obj-$(CONFIG_WDT) += wdt.o +obj-$(CONFIG_WDT) += wdt.o watchdog.o # PCI-based Watchdog Cards obj-$(CONFIG_PCIPCWATCHDOG) += pcwd_pci.o
@@ -59,8 +59,8 @@ obj-$(CONFIG_BFIN_WDT) += bfin_wdt.o # X86 (i386 + ia64 + x86_64) Architecture obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o -obj-$(CONFIG_ALIM1535_WDT) += alim1535_wdt.o -obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o +obj-$(CONFIG_ALIM1535_WDT) += alim1535_wdt.o watchdog.o +obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o watchdog.o obj-$(CONFIG_GEODE_WDT) += geodewdt.o obj-$(CONFIG_SC520_WDT) += sc520_wdt.o obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o
@@ -75,7 +75,7 @@ endif obj-$(CONFIG_IT8712F_WDT) += it8712f_wdt.o obj-$(CONFIG_IT87_WDT) += it87_wdt.o obj-$(CONFIG_HP_WATCHDOG) += hpwdt.o -obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o +obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o watchdog.o obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o obj-$(CONFIG_PC87413_WDT) += pc87413_wdt.o obj-$(CONFIG_RDC321X_WDT) += rdc321x_wdt.o
@@ -90,7 +90,7 @@ obj-$(CONFIG_W83697UG_WDT) += w83697ug_wdt.o obj-$(CONFIG_W83877F_WDT) += w83877f_wdt.o obj-$(CONFIG_W83977F_WDT) += w83977f_wdt.o obj-$(CONFIG_MACHZ_WDT) += machzwd.o -obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o +obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o watchdog.o # M32R Architecture
@@ -133,4 +133,4 @@ obj-$(CONFIG_WATCHDOG_CP1XXX) += cpwd.o # XTENSA Architecture # Architecture Independant -obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o +obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o watchdog.o
drivers/watchdog/alim1535_wdt.c +45 -239
374 lines not on this page · raw message
drivers/watchdog/alim7101_wdt.c +40 -183
285 lines not on this page · raw message
drivers/watchdog/i6300esb.c +50 -212
333 lines not on this page · raw message
drivers/watchdog/sbc_epx_c3.c +29 -138
208 lines not on this page · raw message
drivers/watchdog/sc1200wdt.c +36 -185
300 lines not on this page · raw message
drivers/watchdog/softdog.c +36 -175
275 lines not on this page · raw message
drivers/watchdog/wdt.c +94 -352
583 lines not on this page · raw message
Hi Alan,
Quoted 2 lines
I first posted this last May when Wim was somewhat busy, hopefully this can now be progressed for further discussion.
We should indeed start proceeding on this. I'll have a look at it this weekend (after I looked at the warp_pica driver).
Regards,
Wim.