Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* git://www.linux-watchdog.org/linux-watchdog:
  watchdog: omap_wdt.c: fix the WDIOC_GETBOOTSTATUS ioctl if not implemented.
  watchdog: new driver for VIA chipsets
  watchdog: ath79_wdt: flush register writes
  drivers/watchdog/lantiq_wdt.c: drop iounmap for devm_ allocated data
  watchdog: documentation: describe nowayout in coversion-guide
  watchdog: documentation: update index file
  watchdog: Convert wm831x driver to devm_kzalloc()
  watchdog: add nowayout helpers to Watchdog Timer Driver Kernel API
  watchdog: convert drivers/watchdog/* to use module_platform_driver()
  watchdog: Use DEFINE_SPINLOCK() for static spinlocks
  watchdog: Convert Wolfson drivers to module_platform_driver
  • Loading branch information
torvalds committed Jan 10, 2012
2 parents 269d430 + e2bf7c4 commit 8826691
Show file tree
Hide file tree
Showing 39 changed files with 371 additions and 290 deletions.
2 changes: 2 additions & 0 deletions Documentation/watchdog/00-INDEX
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
00-INDEX
- this file.
convert_drivers_to_kernel_api.txt
- how-to for converting old watchdog drivers to the new kernel API.
hpwdt.txt
- information on the HP iLO2 NMI watchdog
pcwd-watchdog.txt
Expand Down
19 changes: 19 additions & 0 deletions Documentation/watchdog/convert_drivers_to_kernel_api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,25 @@ Here is a simple example for a watchdog device:
+};


Handle the 'nowayout' feature
-----------------------------

A few drivers use nowayout statically, i.e. there is no module parameter for it
and only CONFIG_WATCHDOG_NOWAYOUT determines if the feature is going to be
used. This needs to be converted by initializing the status variable of the
watchdog_device like this:

.status = WATCHDOG_NOWAYOUT_INIT_STATUS,

Most drivers, however, also allow runtime configuration of nowayout, usually
by adding a module parameter. The conversion for this would be something like:

watchdog_set_nowayout(&s3c2410_wdd, nowayout);

The module parameter itself needs to stay, everything else related to nowayout
can go, though. This will likely be some code in open(), close() or write().


Register the watchdog device
----------------------------

Expand Down
10 changes: 9 additions & 1 deletion Documentation/watchdog/watchdog-kernel-api.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The Linux WatchDog Timer Driver Core kernel API.
===============================================
Last reviewed: 22-Jul-2011
Last reviewed: 29-Nov-2011

Wim Van Sebroeck <[email protected]>

Expand Down Expand Up @@ -142,6 +142,14 @@ bit-operations. The status bits that are defined are:
* WDOG_NO_WAY_OUT: this bit stores the nowayout setting for the watchdog.
If this bit is set then the watchdog timer will not be able to stop.

To set the WDOG_NO_WAY_OUT status bit (before registering your watchdog
timer device) you can either:
* set it statically in your watchdog_device struct with
.status = WATCHDOG_NOWAYOUT_INIT_STATUS,
(this will set the value the same as CONFIG_WATCHDOG_NOWAYOUT) or
* use the following helper function:
static inline void watchdog_set_nowayout(struct watchdog_device *wdd, int nowayout)

Note: The WatchDog Timer Driver Core supports the magic close feature and
the nowayout feature. To use the magic close feature you must set the
WDIOF_MAGICCLOSE bit in the options field of the watchdog's info structure.
Expand Down
13 changes: 13 additions & 0 deletions drivers/watchdog/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,19 @@ config SMSC37B787_WDT

Most people will say N.

config VIA_WDT
tristate "VIA Watchdog Timer"
depends on X86
select WATCHDOG_CORE
---help---
This is the driver for the hardware watchdog timer on VIA
southbridge chipset CX700, VX800/VX820 or VX855/VX875.

To compile this driver as a module, choose M here; the module
will be called via_wdt.

Most people will say N.

config W83627HF_WDT
tristate "W83627HF/W83627DHG Watchdog Timer"
depends on X86
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ obj-$(CONFIG_SBC7240_WDT) += sbc7240_wdt.o
obj-$(CONFIG_CPU5_WDT) += cpu5wdt.o
obj-$(CONFIG_SMSC_SCH311X_WDT) += sch311x_wdt.o
obj-$(CONFIG_SMSC37B787_WDT) += smsc37b787_wdt.o
obj-$(CONFIG_VIA_WDT) += via_wdt.o
obj-$(CONFIG_W83627HF_WDT) += w83627hf_wdt.o
obj-$(CONFIG_W83697HF_WDT) += w83697hf_wdt.o
obj-$(CONFIG_W83697UG_WDT) += w83697ug_wdt.o
Expand Down
17 changes: 2 additions & 15 deletions drivers/watchdog/ar7_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ struct ar7_wdt {
};

static unsigned long wdt_is_open;
static spinlock_t wdt_lock;
static unsigned expect_close;
static DEFINE_SPINLOCK(wdt_lock);

/* XXX currently fixed, allows max margin ~68.72 secs */
#define prescale_value 0xffff
Expand Down Expand Up @@ -280,8 +280,6 @@ static int __devinit ar7_wdt_probe(struct platform_device *pdev)
{
int rc;

spin_lock_init(&wdt_lock);

ar7_regs_wdt =
platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
if (!ar7_regs_wdt) {
Expand Down Expand Up @@ -355,15 +353,4 @@ static struct platform_driver ar7_wdt_driver = {
},
};

static int __init ar7_wdt_init(void)
{
return platform_driver_register(&ar7_wdt_driver);
}

static void __exit ar7_wdt_cleanup(void)
{
platform_driver_unregister(&ar7_wdt_driver);
}

module_init(ar7_wdt_init);
module_exit(ar7_wdt_cleanup);
module_platform_driver(ar7_wdt_driver);
6 changes: 6 additions & 0 deletions drivers/watchdog/ath79_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,23 @@ static int max_timeout;
static inline void ath79_wdt_keepalive(void)
{
ath79_reset_wr(AR71XX_RESET_REG_WDOG, wdt_freq * timeout);
/* flush write */
ath79_reset_rr(AR71XX_RESET_REG_WDOG);
}

static inline void ath79_wdt_enable(void)
{
ath79_wdt_keepalive();
ath79_reset_wr(AR71XX_RESET_REG_WDOG_CTRL, WDOG_CTRL_ACTION_FCR);
/* flush write */
ath79_reset_rr(AR71XX_RESET_REG_WDOG_CTRL);
}

static inline void ath79_wdt_disable(void)
{
ath79_reset_wr(AR71XX_RESET_REG_WDOG_CTRL, WDOG_CTRL_ACTION_NONE);
/* flush write */
ath79_reset_rr(AR71XX_RESET_REG_WDOG_CTRL);
}

static int ath79_wdt_set_timeout(int val)
Expand Down
13 changes: 1 addition & 12 deletions drivers/watchdog/bcm63xx_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,18 +311,7 @@ static struct platform_driver bcm63xx_wdt = {
}
};

static int __init bcm63xx_wdt_init(void)
{
return platform_driver_register(&bcm63xx_wdt);
}

static void __exit bcm63xx_wdt_exit(void)
{
platform_driver_unregister(&bcm63xx_wdt);
}

module_init(bcm63xx_wdt_init);
module_exit(bcm63xx_wdt_exit);
module_platform_driver(bcm63xx_wdt);

MODULE_AUTHOR("Miguel Gaio <[email protected]>");
MODULE_AUTHOR("Florian Fainelli <[email protected]>");
Expand Down
3 changes: 1 addition & 2 deletions drivers/watchdog/cpu5wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
static int verbose;
static int port = 0x91;
static int ticks = 10000;
static spinlock_t cpu5wdt_lock;
static DEFINE_SPINLOCK(cpu5wdt_lock);

#define PFX "cpu5wdt: "

Expand Down Expand Up @@ -223,7 +223,6 @@ static int __devinit cpu5wdt_init(void)
"port=0x%x, verbose=%i\n", port, verbose);

init_completion(&cpu5wdt_device.stop);
spin_lock_init(&cpu5wdt_lock);
cpu5wdt_device.queue = 0;
setup_timer(&cpu5wdt_device.timer, cpu5wdt_trigger, 0);
cpu5wdt_device.default_ticks = ticks;
Expand Down
13 changes: 1 addition & 12 deletions drivers/watchdog/cpwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,15 +687,4 @@ static struct platform_driver cpwd_driver = {
.remove = __devexit_p(cpwd_remove),
};

static int __init cpwd_init(void)
{
return platform_driver_register(&cpwd_driver);
}

static void __exit cpwd_exit(void)
{
platform_driver_unregister(&cpwd_driver);
}

module_init(cpwd_init);
module_exit(cpwd_exit);
module_platform_driver(cpwd_driver);
13 changes: 1 addition & 12 deletions drivers/watchdog/davinci_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,18 +271,7 @@ static struct platform_driver platform_wdt_driver = {
.remove = __devexit_p(davinci_wdt_remove),
};

static int __init davinci_wdt_init(void)
{
return platform_driver_register(&platform_wdt_driver);
}

static void __exit davinci_wdt_exit(void)
{
platform_driver_unregister(&platform_wdt_driver);
}

module_init(davinci_wdt_init);
module_exit(davinci_wdt_exit);
module_platform_driver(platform_wdt_driver);

MODULE_AUTHOR("Texas Instruments");
MODULE_DESCRIPTION("DaVinci Watchdog Driver");
Expand Down
12 changes: 1 addition & 11 deletions drivers/watchdog/dw_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,17 +358,7 @@ static struct platform_driver dw_wdt_driver = {
},
};

static int __init dw_wdt_watchdog_init(void)
{
return platform_driver_register(&dw_wdt_driver);
}
module_init(dw_wdt_watchdog_init);

static void __exit dw_wdt_watchdog_exit(void)
{
platform_driver_unregister(&dw_wdt_driver);
}
module_exit(dw_wdt_watchdog_exit);
module_platform_driver(dw_wdt_driver);

MODULE_AUTHOR("Jamie Iles");
MODULE_DESCRIPTION("Synopsys DesignWare Watchdog Driver");
Expand Down
4 changes: 1 addition & 3 deletions drivers/watchdog/eurotechwdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
static unsigned long eurwdt_is_open;
static int eurwdt_timeout;
static char eur_expect_close;
static spinlock_t eurwdt_lock;
static DEFINE_SPINLOCK(eurwdt_lock);

/*
* You must set these - there is no sane way to probe for this board.
Expand Down Expand Up @@ -446,8 +446,6 @@ static int __init eurwdt_init(void)
goto outreg;
}

spin_lock_init(&eurwdt_lock);

ret = misc_register(&eurwdt_miscdev);
if (ret) {
printk(KERN_ERR "eurwdt: can't misc_register on minor=%d\n",
Expand Down
4 changes: 1 addition & 3 deletions drivers/watchdog/ibmasr.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static char asr_expect_close;
static unsigned int asr_type, asr_base, asr_length;
static unsigned int asr_read_addr, asr_write_addr;
static unsigned char asr_toggle_mask, asr_disable_mask;
static spinlock_t asr_lock;
static DEFINE_SPINLOCK(asr_lock);

static void __asr_toggle(void)
{
Expand Down Expand Up @@ -386,8 +386,6 @@ static int __init ibmasr_init(void)
if (!asr_type)
return -ENODEV;

spin_lock_init(&asr_lock);

rc = asr_get_base_address();
if (rc)
return rc;
Expand Down
4 changes: 1 addition & 3 deletions drivers/watchdog/indydog.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#define PFX "indydog: "
static unsigned long indydog_alive;
static spinlock_t indydog_lock;
static DEFINE_SPINLOCK(indydog_lock);

#define WATCHDOG_TIMEOUT 30 /* 30 sec default timeout */

Expand Down Expand Up @@ -185,8 +185,6 @@ static int __init watchdog_init(void)
{
int ret;

spin_lock_init(&indydog_lock);

ret = register_reboot_notifier(&indydog_notifier);
if (ret) {
printk(KERN_ERR PFX
Expand Down
5 changes: 1 addition & 4 deletions drivers/watchdog/iop_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
static int nowayout = WATCHDOG_NOWAYOUT;
static unsigned long wdt_status;
static unsigned long boot_status;
static spinlock_t wdt_lock;
static DEFINE_SPINLOCK(wdt_lock);

#define WDT_IN_USE 0
#define WDT_OK_TO_CLOSE 1
Expand Down Expand Up @@ -226,9 +226,6 @@ static int __init iop_wdt_init(void)
{
int ret;

spin_lock_init(&wdt_lock);


/* check if the reset was caused by the watchdog timer */
boot_status = (read_rcsr() & IOP_RCSR_WDT) ? WDIOF_CARDRESET : 0;

Expand Down
3 changes: 1 addition & 2 deletions drivers/watchdog/ixp2000_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
static int nowayout = WATCHDOG_NOWAYOUT;
static unsigned int heartbeat = 60; /* (secs) Default is 1 minute */
static unsigned long wdt_status;
static spinlock_t wdt_lock;
static DEFINE_SPINLOCK(wdt_lock);

#define WDT_IN_USE 0
#define WDT_OK_TO_CLOSE 1
Expand Down Expand Up @@ -189,7 +189,6 @@ static int __init ixp2000_wdt_init(void)
return -EIO;
}
wdt_tick_rate = (*IXP2000_T1_CLD * HZ) / 256;
spin_lock_init(&wdt_lock);
return misc_register(&ixp2000_wdt_miscdev);
}

Expand Down
1 change: 0 additions & 1 deletion drivers/watchdog/ixp4xx_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ static int __init ixp4xx_wdt_init(void)

return -ENODEV;
}
spin_lock_init(&wdt_lock);
boot_status = (*IXP4XX_OSST & IXP4XX_OSST_TIMER_WARM_RESET) ?
WDIOF_CARDRESET : 0;
ret = misc_register(&ixp4xx_wdt_miscdev);
Expand Down
13 changes: 1 addition & 12 deletions drivers/watchdog/jz4740_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,18 +295,7 @@ static struct platform_driver jz4740_wdt_driver = {
},
};


static int __init jz4740_wdt_init(void)
{
return platform_driver_register(&jz4740_wdt_driver);
}
module_init(jz4740_wdt_init);

static void __exit jz4740_wdt_exit(void)
{
platform_driver_unregister(&jz4740_wdt_driver);
}
module_exit(jz4740_wdt_exit);
module_platform_driver(jz4740_wdt_driver);

MODULE_AUTHOR("Paul Cercueil <[email protected]>");
MODULE_DESCRIPTION("jz4740 Watchdog Driver");
Expand Down
3 changes: 1 addition & 2 deletions drivers/watchdog/ks8695_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="


static unsigned long ks8695wdt_busy;
static spinlock_t ks8695_lock;
static DEFINE_SPINLOCK(ks8695_lock);

/* ......................................................................... */

Expand Down Expand Up @@ -288,7 +288,6 @@ static struct platform_driver ks8695wdt_driver = {

static int __init ks8695_wdt_init(void)
{
spin_lock_init(&ks8695_lock);
/* Check that the heartbeat value is within range;
if not reset to the default */
if (ks8695_wdt_settimeout(wdt_time)) {
Expand Down
3 changes: 0 additions & 3 deletions drivers/watchdog/lantiq_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,6 @@ ltq_wdt_remove(struct platform_device *pdev)
{
misc_deregister(&ltq_wdt_miscdev);

if (ltq_wdt_membase)
iounmap(ltq_wdt_membase);

return 0;
}

Expand Down
Loading

0 comments on commit 8826691

Please sign in to comment.