Skip to contentSkip to conversation

watchdog: Use DEFINE_SPINLOCK() for static spinlocks

PATCH In review Axel Lin 2 participants 4 messages Nov 29, 2011

Subsystems (7)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/2 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 Wim Van Sebroeck <[email protected]>
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]>

---
This patch was sent on http://www.spinics.net/lists/linux-watchdog/msg00775.html
Here is a resend because next patch depends on this one.
Some module_init functions that only calls spin_lock_init() and platform_driver_register() can be converted to module_platform_driver macro after this patch.

Regards,
Axel

 drivers/watchdog/ar7_wdt.c     |    4 +---
 drivers/watchdog/cpu5wdt.c     |    3 +--
 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/ks8695_wdt.c  |    3 +--
 drivers/watchdog/omap_wdt.c    |    3 +--
 drivers/watchdog/orion_wdt.c   |    3 +--
 11 files changed, 10 insertions(+), 27 deletions(-)
drivers/watchdog/ar7_wdt.c +1 -3
index b292217..b9564c5 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) {
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/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..084f71aa 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/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/omap_wdt.c +1 -2
index 2b4acb8..cd269b4 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 */
@@ -439,7 +439,6 @@ 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);
 }
 
drivers/watchdog/orion_wdt.c +1 -2
index 2d9fb96..66bd97f 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)
 {
@@ -296,7 +296,6 @@ 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);
 }
 
Signature · 1 line
1.7.5.4
author
#1 lore raw

PATCH 2/2 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 Wim Van Sebroeck <[email protected]>
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]>
Cc Mark Brown <[email protected]>
---
 drivers/watchdog/ar7_wdt.c       |   13 +------------
 drivers/watchdog/bcm63xx_wdt.c   |   13 +------------
 drivers/watchdog/cpwd.c          |   13 +------------
 drivers/watchdog/davinci_wdt.c   |   13 +------------
 drivers/watchdog/dw_wdt.c        |   12 +-----------
 drivers/watchdog/jz4740_wdt.c    |   13 +------------
 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      |   13 +------------
 drivers/watchdog/orion_wdt.c     |   13 +------------
 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/stmp3xxx_wdt.c  |   13 +------------
 drivers/watchdog/ts72xx_wdt.c    |   12 +-----------
 drivers/watchdog/twl4030_wdt.c   |   12 +-----------
 drivers/watchdog/wm831x_wdt.c    |   12 +-----------
 drivers/watchdog/wm8350_wdt.c    |   12 +-----------
 21 files changed, 21 insertions(+), 247 deletions(-)
drivers/watchdog/ar7_wdt.c +1 -12
index b9564c5..502773a 100644
@@ -353,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/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/cpwd.c +1 -12
index 1e013e8..1b793dfd 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/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/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 +1 -12
index cd269b4..324f525 100644
@@ -437,18 +437,7 @@ static struct platform_driver omap_wdt_driver = {
 	},
 };
 
-static int __init omap_wdt_init(void)
-{
-	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 +1 -12
index 66bd97f..4ad78f8 100644
@@ -294,18 +294,7 @@ static struct platform_driver orion_wdt_driver = {
 	},
 };
 
-static int __init orion_wdt_init(void)
-{
-	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/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/wm831x_wdt.c +1 -11
index e789a47..beb3ad2 100644
@@ -320,17 +320,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");
Signature · 1 line
1.7.5.4
#2 lore raw

Re: [PATCH 2/2] watchdog: convert drivers/watchdog/* to use module_platform_driver()

Hi Alex,

Quoted 4 lines

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

Quoted 15 lines
Cc Wim Van Sebroeck <[email protected]>
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]>
Cc Mark Brown <[email protected]>

Added to the linux-next branch of the watchdog tree (after stripping the wm*.c drivers out of the diff since Marc allready had a patch for that).

Kind regards,
Wim.

#3 lore raw
In reply to Axel Lin

Hi Alex,

Quoted 4 lines

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().

Quoted 12 lines
Cc Wim Van Sebroeck <[email protected]>
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]>

Added to the linux-next branch of the watchdog tree.

Kind regards,
Wim.