Skip to contentSkip to conversation

watchdog - v3.2

GIT PULL Wim Van Sebroeck 1 participant 1 message Jan 10, 2012

Subsystems (9)
lore
Share & tools
lore
#0 lore raw

Hi Linus,

Please pull from 'master' branch of
git://www.linux-watchdog.org/linux-watchdog.git

This will update the following files:

 Documentation/watchdog/00-INDEX                          |    2 
 Documentation/watchdog/convert_drivers_to_kernel_api.txt |   19 +
 Documentation/watchdog/watchdog-kernel-api.txt           |   10 
 drivers/watchdog/Kconfig                                 |   13 
 drivers/watchdog/Makefile                                |    1 
 drivers/watchdog/ar7_wdt.c                               |   17 
 drivers/watchdog/ath79_wdt.c                             |    6 
 drivers/watchdog/bcm63xx_wdt.c                           |   13 
 drivers/watchdog/cpu5wdt.c                               |    3 
 drivers/watchdog/cpwd.c                                  |   13 
 drivers/watchdog/davinci_wdt.c                           |   13 
 drivers/watchdog/dw_wdt.c                                |   12 
 drivers/watchdog/eurotechwdt.c                           |    4 
 drivers/watchdog/ibmasr.c                                |    4 
 drivers/watchdog/indydog.c                               |    4 
 drivers/watchdog/iop_wdt.c                               |    5 
 drivers/watchdog/ixp2000_wdt.c                           |    3 
 drivers/watchdog/ixp4xx_wdt.c                            |    1 
 drivers/watchdog/jz4740_wdt.c                            |   13 
 drivers/watchdog/ks8695_wdt.c                            |    3 
 drivers/watchdog/lantiq_wdt.c                            |    3 
 drivers/watchdog/max63xx_wdt.c                           |   13 
 drivers/watchdog/mtx-1_wdt.c                             |   13 
 drivers/watchdog/nuc900_wdt.c                            |   13 
 drivers/watchdog/of_xilinx_wdt.c                         |   13 
 drivers/watchdog/omap_wdt.c                              |   17 
 drivers/watchdog/orion_wdt.c                             |   16 
 drivers/watchdog/pnx4008_wdt.c                           |   13 
 drivers/watchdog/rc32434_wdt.c                           |   13 
 drivers/watchdog/rdc321x_wdt.c                           |   13 
 drivers/watchdog/riowd.c                                 |   13 
 drivers/watchdog/s3c2410_wdt.c                           |    2 
 drivers/watchdog/stmp3xxx_wdt.c                          |   13 
 drivers/watchdog/ts72xx_wdt.c                            |   12 
 drivers/watchdog/twl4030_wdt.c                           |   12 
 drivers/watchdog/via_wdt.c                               |  267 +++++++++++++++
 drivers/watchdog/wm831x_wdt.c                            |   23 -
 drivers/watchdog/wm8350_wdt.c                            |   12 
 include/linux/watchdog.h                                 |   21 -
 39 files changed, 371 insertions(+), 290 deletions(-)

with these Changes:

commit e2bf7c4c22939bd83814d8da40a352d246030b1b

Author: Shubhrajyoti D <[email protected]>
Date:   Wed Jan 4 19:45:28 2012 +0530

watchdog: omap_wdt.c: fix the WDIOC_GETBOOTSTATUS ioctl if not implemented.

WDIOC_GETBOOTSTATUS ioctl is imlemented for cpu_is_omap16xx and cpu_is_omap24xx cpus only. For other cpus it falls through to WDIOC_KEEPALIVE. This patch prevents the fall through.

commit dc3c56b703dad4aec8a9b3dd86f03a90d0c26a2d

Author: Marc Vertes <[email protected]>
Date:   Mon Dec 5 17:00:23 2011 +0100

watchdog: new driver for VIA chipsets

New driver for the hardware watchdog timer on VIA chipsets. This driver uses the new watchdog framework.
PnP must be enabled in BIOS to get full control of watchdog registers. The timer code has been added by Wim Van Sebroeck.
Tested on a Artigo A1100, VX855 chipset.

commit 86955e2bcb320bf8f271443cb7b03896fc3cbd67

Author: Gabor Juhos <[email protected]>
Date:   Fri Dec 23 19:25:42 2011 +0100

watchdog: ath79_wdt: flush register writes

The watchdog register writes required to have a flush in order to commit the values to the register. Without the flush, the driver not function correctly on AR934X SoCs.

commit 60daac4a9084d5a6216443f428d0060c42eb44ff

Author: Julia Lawall <[email protected]>
Date:   Mon Dec 26 18:38:00 2011 +0100
    drivers/watchdog/lantiq_wdt.c: drop iounmap for devm_ allocated data
    
    Data allocated with devm_ioremap or devm_ioremap_nocache should not be
    freed using iounmap, because doing so causes a dangling pointer, and a
    subsequent double free.
    
    The semantic match that finds this problem is as follows:
    (http://coccinelle.lip6.fr/)
    
    // <smpl>
    @r@
    expression x;
    @@
    (
     x = devm_ioremap(...)
    |
     x = devm_ioremap_nocache(...)
    )
    
    @@
    expression r.x;
    @@
    * iounmap(x)
    // </smpl>
    
    Signed-off-by: Julia Lawall <[email protected]>
    Signed-off-by: Wim Van Sebroeck <[email protected]>

commit 02861cca4b4f1ceaa7dc805041d84caee580670b

Author: Wolfram Sang <[email protected]>
Date:   Fri Dec 2 00:43:11 2011 +0100

watchdog: documentation: describe nowayout in coversion-guide

nowayout is also handled by the watchdog core. Describe how this needs to be addressed in the conversion guide.

commit 9d36bc8cd8d607ec5db98bcc85b27cff9e1b6dfd

Author: Wim Van Sebroeck <[email protected]>
Date:   Tue Nov 29 12:14:30 2011 +0100

watchdog: documentation: update index file

Add the convert_drivers_to_kernel_api.txt to the 00-INDEX file.

commit 7b9bb6d8cfe80580329318caf6c3a137762ecea3

Author: Mark Brown <[email protected]>
Date:   Thu Dec 15 02:23:19 2011 +0800

watchdog: Convert wm831x driver to devm_kzalloc()

Saves a small amount of code and systematically eliminates leaks.

commit ff0b3cd4a416bc727b0797b95b229b278d2a28f2

Author: Wim Van Sebroeck <[email protected]>
Date:   Tue Nov 29 16:24:16 2011 +0100

watchdog: add nowayout helpers to Watchdog Timer Driver Kernel API

Add two nowayout helpers for the Watchdog Timer Driver Kernel API. And apply this to the already converted drivers.
Note: s3c2410_wdt lost the nowayout feature during the conversion.

commit b8ec61189f3b4cd9d1b2856342f5d7676151d01c

Author: Axel Lin <[email protected]>
Date:   Tue Nov 29 13:56:27 2011 +0800

watchdog: convert drivers/watchdog/* to use module_platform_driver()

This patch converts the drivers in drivers/watchdog/* to use the module_platform_driver() macro which makes the code smaller and a bit simpler.

Cc Nicolas Thill <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Paul Cercueil <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Wan ZongShun <[email protected]>
Cc Alejandro Cabrera <[email protected]>
Cc "George G. Davis" <[email protected]>
Cc Sylver Bruneau <[email protected]>
Cc Vitaly Wool <[email protected]>
Cc Mika Westerberg <[email protected]>
Cc Timo Kokkonen <[email protected]>

commit 1334f32938e46fb321c67a652997d33583257249

Author: Axel Lin <[email protected]>
Date:   Tue Nov 29 13:54:01 2011 +0800

watchdog: Use DEFINE_SPINLOCK() for static spinlocks

Rather than just defining static spinlock_t variables and then initializing them later in init functions, simply define them with DEFINE_SPINLOCK() and remove the calls to spin_lock_init().

Cc Nicolas Thill <[email protected]>
Cc Heiko Ronsdorf <[email protected]>
Cc Rodolfo Giometti <[email protected]>
Cc Andrey Panin <[email protected]>
Cc Guido Guenther <[email protected]>
Cc Curt E Bruns <[email protected]>
Cc Deepak Saxena <[email protected]>
Cc Andrew Victor <[email protected]>
Cc George G. Davis <[email protected]>
Cc Sylver Bruneau <[email protected]>

commit 216f3ad9aa5731024b9c96e63b676f9f65078dd5

Author: Mark Brown <[email protected]>
Date:   Wed Nov 23 15:22:36 2011 +0000

watchdog: Convert Wolfson drivers to module_platform_driver

Factors out some boilerplate code.

For completeness, I added the overal diff below.

Greetings,
Wim.

================================================================================

Documentation/watchdog/00-INDEX +2 -0
index fc51128..fc9082a 100644
@@ -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
Documentation/watchdog/convert_drivers_to_kernel_api.txt +19 -0
index ae1e900..be8119b 100644
@@ -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
 ----------------------------
 
Documentation/watchdog/watchdog-kernel-api.txt +9 -1
index 4f7c894..4b93c28 100644
@@ -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]>
 
@@ -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.
drivers/watchdog/Kconfig +13 -0
index 79fd606..877b107 100644
@@ -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
drivers/watchdog/Makefile +1 -0
index fe893e9..e8f479a 100644
@@ -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
drivers/watchdog/ar7_wdt.c +2 -15
index b292217..502773a 100644
@@ -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
@@ -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) {
@@ -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);
drivers/watchdog/ath79_wdt.c +6 -0
index 725c84b..9db8083 100644
@@ -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)
drivers/watchdog/bcm63xx_wdt.c +1 -12
index 5064e83..8dc7de6 100644
@@ -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]>");
drivers/watchdog/cpu5wdt.c +1 -2
index edd3475..251c863 100644
@@ -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: "
 
@@ -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;
drivers/watchdog/cpwd.c +1 -12
index 1e013e8..1b793df 100644
@@ -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);
drivers/watchdog/davinci_wdt.c +1 -12
index 51b5551..c8c5c80 100644
@@ -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");
drivers/watchdog/dw_wdt.c +1 -11
index f10f8c0..1b0e3dd 100644
@@ -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");
drivers/watchdog/eurotechwdt.c +1 -3
index 41018d4..3946c51 100644
@@ -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.
@@ -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",
drivers/watchdog/ibmasr.c +1 -3
index 195e0f7..c7481ad 100644
@@ -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)
 {
@@ -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;
drivers/watchdog/indydog.c +1 -3
index 1cc5609..1475e09 100644
@@ -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 */
 
@@ -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
drivers/watchdog/iop_wdt.c +1 -4
index aef9478..82fa7a9 100644
@@ -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
@@ -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;
 
drivers/watchdog/ixp2000_wdt.c +1 -2
index e86952a..084f71a 100644
@@ -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
@@ -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);
 }
 
drivers/watchdog/ixp4xx_wdt.c +0 -1
index e02c0ec..4fc2e9a 100644
@@ -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);
drivers/watchdog/jz4740_wdt.c +1 -12
index 684ba01..17ef300 100644
@@ -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");
drivers/watchdog/ks8695_wdt.c +1 -2
index 8114719..51757a5 100644
@@ -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);
 
 /* ......................................................................... */
 
@@ -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)) {
drivers/watchdog/lantiq_wdt.c +0 -3
index 102aed0..d3a63be 100644
@@ -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;
 }
 
drivers/watchdog/max63xx_wdt.c +1 -12
index 73ba2fd..af63ecf 100644
@@ -364,18 +364,7 @@ static struct platform_driver max63xx_wdt_driver = {
 	},
 };
 
-static int __init max63xx_wdt_init(void)
-{
-	return platform_driver_register(&max63xx_wdt_driver);
-}
-
-static void __exit max63xx_wdt_exit(void)
-{
-	platform_driver_unregister(&max63xx_wdt_driver);
-}
-
-module_init(max63xx_wdt_init);
-module_exit(max63xx_wdt_exit);
+module_platform_driver(max63xx_wdt_driver);
 
 MODULE_AUTHOR("Marc Zyngier <[email protected]>");
 MODULE_DESCRIPTION("max63xx Watchdog Driver");
drivers/watchdog/mtx-1_wdt.c +1 -12
index ac37bb8..c29e31d 100644
@@ -253,18 +253,7 @@ static struct platform_driver mtx1_wdt_driver = {
 	.driver.owner = THIS_MODULE,
 };
 
-static int __init mtx1_wdt_init(void)
-{
-	return platform_driver_register(&mtx1_wdt_driver);
-}
-
-static void __exit mtx1_wdt_exit(void)
-{
-	platform_driver_unregister(&mtx1_wdt_driver);
-}
-
-module_init(mtx1_wdt_init);
-module_exit(mtx1_wdt_exit);
+module_platform_driver(mtx1_wdt_driver);
 
 MODULE_AUTHOR("Michael Stickel, Florian Fainelli");
 MODULE_DESCRIPTION("Driver for the MTX-1 watchdog");
drivers/watchdog/nuc900_wdt.c +1 -12
index 6cee33d..50359ba 100644
@@ -334,18 +334,7 @@ static struct platform_driver nuc900wdt_driver = {
 	},
 };
 
-static int __init nuc900_wdt_init(void)
-{
-	return platform_driver_register(&nuc900wdt_driver);
-}
-
-static void __exit nuc900_wdt_exit(void)
-{
-	platform_driver_unregister(&nuc900wdt_driver);
-}
-
-module_init(nuc900_wdt_init);
-module_exit(nuc900_wdt_exit);
+module_platform_driver(nuc900wdt_driver);
 
 MODULE_AUTHOR("Wan ZongShun <[email protected]>");
 MODULE_DESCRIPTION("Watchdog driver for NUC900");
drivers/watchdog/of_xilinx_wdt.c +1 -12
index 4ec741a..f359ab8 100644
@@ -414,18 +414,7 @@ static struct platform_driver xwdt_driver = {
 	},
 };
 
-static int __init xwdt_init(void)
-{
-	return platform_driver_register(&xwdt_driver);
-}
-
-static void __exit xwdt_exit(void)
-{
-	platform_driver_unregister(&xwdt_driver);
-}
-
-module_init(xwdt_init);
-module_exit(xwdt_exit);
+module_platform_driver(xwdt_driver);
 
 MODULE_AUTHOR("Alejandro Cabrera <[email protected]>");
 MODULE_DESCRIPTION("Xilinx Watchdog driver");
drivers/watchdog/omap_wdt.c +3 -14
index 2b4acb8..4b33e3f 100644
@@ -55,7 +55,7 @@ module_param(timer_margin, uint, 0);
 MODULE_PARM_DESC(timer_margin, "initial watchdog timeout (in seconds)");
 
 static unsigned int wdt_trgr_pattern = 0x1234;
-static spinlock_t wdt_lock;
+static DEFINE_SPINLOCK(wdt_lock);
 
 struct omap_wdt_dev {
 	void __iomem    *base;          /* physical */
@@ -232,6 +232,7 @@ static long omap_wdt_ioctl(struct file *file, unsigned int cmd,
 		if (cpu_is_omap24xx())
 			return put_user(omap_prcm_get_reset_sources(),
 					(int __user *)arg);
+		return put_user(0, (int __user *)arg);
 	case WDIOC_KEEPALIVE:
 		pm_runtime_get_sync(wdev->dev);
 		spin_lock(&wdt_lock);
@@ -437,19 +438,7 @@ static struct platform_driver omap_wdt_driver = {
 	},
 };
 
-static int __init omap_wdt_init(void)
-{
-	spin_lock_init(&wdt_lock);
-	return platform_driver_register(&omap_wdt_driver);
-}
-
-static void __exit omap_wdt_exit(void)
-{
-	platform_driver_unregister(&omap_wdt_driver);
-}
-
-module_init(omap_wdt_init);
-module_exit(omap_wdt_exit);
+module_platform_driver(omap_wdt_driver);
 
 MODULE_AUTHOR("George G. Davis");
 MODULE_LICENSE("GPL");
drivers/watchdog/orion_wdt.c +2 -14
index 2d9fb96..4ad78f8 100644
@@ -41,7 +41,7 @@ static int heartbeat = -1;		/* module parameter (seconds) */
 static unsigned int wdt_max_duration;	/* (seconds) */
 static unsigned int wdt_tclk;
 static unsigned long wdt_status;
-static spinlock_t wdt_lock;
+static DEFINE_SPINLOCK(wdt_lock);
 
 static void orion_wdt_ping(void)
 {
@@ -294,19 +294,7 @@ static struct platform_driver orion_wdt_driver = {
 	},
 };
 
-static int __init orion_wdt_init(void)
-{
-	spin_lock_init(&wdt_lock);
-	return platform_driver_register(&orion_wdt_driver);
-}
-
-static void __exit orion_wdt_exit(void)
-{
-	platform_driver_unregister(&orion_wdt_driver);
-}
-
-module_init(orion_wdt_init);
-module_exit(orion_wdt_exit);
+module_platform_driver(orion_wdt_driver);
 
 MODULE_AUTHOR("Sylver Bruneau <[email protected]>");
 MODULE_DESCRIPTION("Orion Processor Watchdog");
drivers/watchdog/pnx4008_wdt.c +1 -12
index 6149332..bd143c9 100644
@@ -334,18 +334,7 @@ static struct platform_driver platform_wdt_driver = {
 	.remove = __devexit_p(pnx4008_wdt_remove),
 };
 
-static int __init pnx4008_wdt_init(void)
-{
-	return platform_driver_register(&platform_wdt_driver);
-}
-
-static void __exit pnx4008_wdt_exit(void)
-{
-	platform_driver_unregister(&platform_wdt_driver);
-}
-
-module_init(pnx4008_wdt_init);
-module_exit(pnx4008_wdt_exit);
+module_platform_driver(platform_wdt_driver);
 
 MODULE_AUTHOR("MontaVista Software, Inc. <[email protected]>");
 MODULE_DESCRIPTION("PNX4008 Watchdog Driver");
drivers/watchdog/rc32434_wdt.c +1 -12
index d4c29b5..bf7bc8a 100644
@@ -332,18 +332,7 @@ static struct platform_driver rc32434_wdt_driver = {
 	}
 };
 
-static int __init rc32434_wdt_init(void)
-{
-	return platform_driver_register(&rc32434_wdt_driver);
-}
-
-static void __exit rc32434_wdt_exit(void)
-{
-	platform_driver_unregister(&rc32434_wdt_driver);
-}
-
-module_init(rc32434_wdt_init);
-module_exit(rc32434_wdt_exit);
+module_platform_driver(rc32434_wdt_driver);
 
 MODULE_AUTHOR("Ondrej Zajicek <[email protected]>,"
 		"Florian Fainelli <[email protected]>");
drivers/watchdog/rdc321x_wdt.c +1 -12
index 428f8a1..042ccc5 100644
@@ -293,18 +293,7 @@ static struct platform_driver rdc321x_wdt_driver = {
 	},
 };
 
-static int __init rdc321x_wdt_init(void)
-{
-	return platform_driver_register(&rdc321x_wdt_driver);
-}
-
-static void __exit rdc321x_wdt_exit(void)
-{
-	platform_driver_unregister(&rdc321x_wdt_driver);
-}
-
-module_init(rdc321x_wdt_init);
-module_exit(rdc321x_wdt_exit);
+module_platform_driver(rdc321x_wdt_driver);
 
 MODULE_AUTHOR("Florian Fainelli <[email protected]>");
 MODULE_DESCRIPTION("RDC321x watchdog driver");
drivers/watchdog/riowd.c +1 -12
index 109b533..c7e17ce 100644
@@ -247,15 +247,4 @@ static struct platform_driver riowd_driver = {
 	.remove		= __devexit_p(riowd_remove),
 };
 
-static int __init riowd_init(void)
-{
-	return platform_driver_register(&riowd_driver);
-}
-
-static void __exit riowd_exit(void)
-{
-	platform_driver_unregister(&riowd_driver);
-}
-
-module_init(riowd_init);
-module_exit(riowd_exit);
+module_platform_driver(riowd_driver);
drivers/watchdog/s3c2410_wdt.c +2 -0
index a79e384..4bc3744 100644
@@ -378,6 +378,8 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
 							"cannot start\n");
 	}
 
+	watchdog_set_nowayout(&s3c2410_wdd, nowayout);
+
 	ret = watchdog_register_device(&s3c2410_wdd);
 	if (ret) {
 		dev_err(dev, "cannot register watchdog (%d)\n", ret);
drivers/watchdog/stmp3xxx_wdt.c +1 -12
index ac2346a..4c2a4e8 100644
@@ -272,18 +272,7 @@ static struct platform_driver platform_wdt_driver = {
 	.resume = stmp3xxx_wdt_resume,
 };
 
-static int __init stmp3xxx_wdt_init(void)
-{
-	return platform_driver_register(&platform_wdt_driver);
-}
-
-static void __exit stmp3xxx_wdt_exit(void)
-{
-	return platform_driver_unregister(&platform_wdt_driver);
-}
-
-module_init(stmp3xxx_wdt_init);
-module_exit(stmp3xxx_wdt_exit);
+module_platform_driver(platform_wdt_driver);
 
 MODULE_DESCRIPTION("STMP3XXX Watchdog Driver");
 MODULE_LICENSE("GPL");
drivers/watchdog/ts72xx_wdt.c +1 -11
index 5a90a4a..1490293 100644
@@ -506,17 +506,7 @@ static struct platform_driver ts72xx_wdt_driver = {
 	},
 };
 
-static __init int ts72xx_wdt_init(void)
-{
-	return platform_driver_register(&ts72xx_wdt_driver);
-}
-module_init(ts72xx_wdt_init);
-
-static __exit void ts72xx_wdt_exit(void)
-{
-	platform_driver_unregister(&ts72xx_wdt_driver);
-}
-module_exit(ts72xx_wdt_exit);
+module_platform_driver(ts72xx_wdt_driver);
 
 MODULE_AUTHOR("Mika Westerberg <[email protected]>");
 MODULE_DESCRIPTION("TS-72xx SBC Watchdog");
drivers/watchdog/twl4030_wdt.c +1 -11
index b5045ca..0764c62 100644
@@ -256,17 +256,7 @@ static struct platform_driver twl4030_wdt_driver = {
 	},
 };
 
-static int __devinit twl4030_wdt_init(void)
-{
-	return platform_driver_register(&twl4030_wdt_driver);
-}
-module_init(twl4030_wdt_init);
-
-static void __devexit twl4030_wdt_exit(void)
-{
-	platform_driver_unregister(&twl4030_wdt_driver);
-}
-module_exit(twl4030_wdt_exit);
+module_platform_driver(twl4030_wdt_driver);
 
 MODULE_AUTHOR("Nokia Corporation");
 MODULE_LICENSE("GPL");
drivers/watchdog/via_wdt.c new file +267 -0

267 lines not on this page · raw message

drivers/watchdog/wm831x_wdt.c +5 -18
index e789a47..263c883 100644
@@ -199,7 +199,8 @@ static int __devinit wm831x_wdt_probe(struct platform_device *pdev)
 	if (reg & WM831X_WDOG_DEBUG)
 		dev_warn(wm831x->dev, "Watchdog is paused\n");
 
-	driver_data = kzalloc(sizeof(*driver_data), GFP_KERNEL);
+	driver_data = devm_kzalloc(&pdev->dev, sizeof(*driver_data),
+				   GFP_KERNEL);
 	if (!driver_data) {
 		dev_err(wm831x->dev, "Unable to alloacate watchdog device\n");
 		ret = -ENOMEM;
@@ -213,11 +214,9 @@ static int __devinit wm831x_wdt_probe(struct platform_device *pdev)
 
 	wm831x_wdt->info = &wm831x_wdt_info;
 	wm831x_wdt->ops = &wm831x_wdt_ops;
+	watchdog_set_nowayout(wm831x_wdt, nowayout);
 	watchdog_set_drvdata(wm831x_wdt, driver_data);
 
-	if (nowayout)
-		wm831x_wdt->status |= WDOG_NO_WAY_OUT;
-
 	reg = wm831x_reg_read(wm831x, WM831X_WATCHDOG);
 	reg &= WM831X_WDOG_TO_MASK;
 	for (i = 0; i < ARRAY_SIZE(wm831x_wdt_cfgs); i++)
@@ -252,7 +251,7 @@ static int __devinit wm831x_wdt_probe(struct platform_device *pdev)
 				dev_err(wm831x->dev,
 					"Failed to request update GPIO: %d\n",
 					ret);
-				goto err_alloc;
+				goto err;
 			}
 
 			ret = gpio_direction_output(pdata->update_gpio, 0);
@@ -294,8 +293,6 @@ static int __devinit wm831x_wdt_probe(struct platform_device *pdev)
 err_gpio:
 	if (driver_data->update_gpio)
 		gpio_free(driver_data->update_gpio);
-err_alloc:
-	kfree(driver_data);
 err:
 	return ret;
 }
@@ -320,17 +317,7 @@ static struct platform_driver wm831x_wdt_driver = {
 	},
 };
 
-static int __init wm831x_wdt_init(void)
-{
-	return platform_driver_register(&wm831x_wdt_driver);
-}
-module_init(wm831x_wdt_init);
-
-static void __exit wm831x_wdt_exit(void)
-{
-	platform_driver_unregister(&wm831x_wdt_driver);
-}
-module_exit(wm831x_wdt_exit);
+module_platform_driver(wm831x_wdt_driver);
 
 MODULE_AUTHOR("Mark Brown");
 MODULE_DESCRIPTION("WM831x Watchdog");
drivers/watchdog/wm8350_wdt.c +1 -11
index b68d928..909c786 100644
@@ -311,17 +311,7 @@ static struct platform_driver wm8350_wdt_driver = {
 	},
 };
 
-static int __init wm8350_wdt_init(void)
-{
-	return platform_driver_register(&wm8350_wdt_driver);
-}
-module_init(wm8350_wdt_init);
-
-static void __exit wm8350_wdt_exit(void)
-{
-	platform_driver_unregister(&wm8350_wdt_driver);
-}
-module_exit(wm8350_wdt_exit);
+module_platform_driver(wm8350_wdt_driver);
 
 MODULE_AUTHOR("Mark Brown");
 MODULE_DESCRIPTION("WM8350 Watchdog");
include/linux/watchdog.h +16 -5
index 111843f..43ba5b3 100644
@@ -53,11 +53,7 @@ struct watchdog_info {
 
 #ifdef __KERNEL__
 
-#ifdef CONFIG_WATCHDOG_NOWAYOUT
-#define WATCHDOG_NOWAYOUT	1
-#else
-#define WATCHDOG_NOWAYOUT	0
-#endif
+#include <linux/bitops.h>
 
 struct watchdog_ops;
 struct watchdog_device;
@@ -122,6 +118,21 @@ struct watchdog_device {
 #define WDOG_NO_WAY_OUT		3	/* Is 'nowayout' feature set ? */
 };
 
+#ifdef CONFIG_WATCHDOG_NOWAYOUT
+#define WATCHDOG_NOWAYOUT		1
+#define WATCHDOG_NOWAYOUT_INIT_STATUS	(1 << WDOG_NO_WAY_OUT)
+#else
+#define WATCHDOG_NOWAYOUT		0
+#define WATCHDOG_NOWAYOUT_INIT_STATUS	0
+#endif
+
+/* Use the following function to set the nowayout feature */
+static inline void watchdog_set_nowayout(struct watchdog_device *wdd, int nowayout)
+{
+	if (nowayout)
+		set_bit(WDOG_NO_WAY_OUT, &wdd->status);
+}
+
 /* Use the following functions to manipulate watchdog driver specific data */
 static inline void watchdog_set_drvdata(struct watchdog_device *wdd, void *data)
 {