aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2011-11-29 00:54:01 -0500
committerWim Van Sebroeck <wim@iguana.be>2012-01-06 09:17:17 -0500
commit1334f32938e46fb321c67a652997d33583257249 (patch)
treef296005ef79641ea4733af19cda0f5bf736824b1 /drivers/watchdog
parent216f3ad9aa5731024b9c96e63b676f9f65078dd5 (diff)
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(). Signed-off-by: Axel Lin <axel.lin@gmail.com> Cc: Nicolas Thill <nico@openwrt.org> Cc: Heiko Ronsdorf <hero@ihg.uni-duisburg.de> Cc: Rodolfo Giometti <giometti@ascensit.com> Cc: Andrey Panin <pazke@donpac.ru> Cc: Guido Guenther <agx@sigxcpu.org> Cc: Curt E Bruns <curt.e.bruns@intel.com> Cc: Deepak Saxena <dsaxena@plexity.net> Cc: Andrew Victor <linux@maxim.org.za> Cc: George G. Davis <gdavis@mvista.com> Cc: Sylver Bruneau <sylver.bruneau@googlemail.com> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/ar7_wdt.c4
-rw-r--r--drivers/watchdog/cpu5wdt.c3
-rw-r--r--drivers/watchdog/eurotechwdt.c4
-rw-r--r--drivers/watchdog/ibmasr.c4
-rw-r--r--drivers/watchdog/indydog.c4
-rw-r--r--drivers/watchdog/iop_wdt.c5
-rw-r--r--drivers/watchdog/ixp2000_wdt.c3
-rw-r--r--drivers/watchdog/ixp4xx_wdt.c1
-rw-r--r--drivers/watchdog/ks8695_wdt.c3
-rw-r--r--drivers/watchdog/omap_wdt.c3
-rw-r--r--drivers/watchdog/orion_wdt.c3
11 files changed, 10 insertions, 27 deletions
diff --git a/drivers/watchdog/ar7_wdt.c b/drivers/watchdog/ar7_wdt.c
index b29221783598..b9564c5ddab9 100644
--- a/drivers/watchdog/ar7_wdt.c
+++ b/drivers/watchdog/ar7_wdt.c
@@ -70,8 +70,8 @@ struct ar7_wdt {
70}; 70};
71 71
72static unsigned long wdt_is_open; 72static unsigned long wdt_is_open;
73static spinlock_t wdt_lock;
74static unsigned expect_close; 73static unsigned expect_close;
74static DEFINE_SPINLOCK(wdt_lock);
75 75
76/* XXX currently fixed, allows max margin ~68.72 secs */ 76/* XXX currently fixed, allows max margin ~68.72 secs */
77#define prescale_value 0xffff 77#define prescale_value 0xffff
@@ -280,8 +280,6 @@ static int __devinit ar7_wdt_probe(struct platform_device *pdev)
280{ 280{
281 int rc; 281 int rc;
282 282
283 spin_lock_init(&wdt_lock);
284
285 ar7_regs_wdt = 283 ar7_regs_wdt =
286 platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"); 284 platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
287 if (!ar7_regs_wdt) { 285 if (!ar7_regs_wdt) {
diff --git a/drivers/watchdog/cpu5wdt.c b/drivers/watchdog/cpu5wdt.c
index edd3475f41db..251c863d71dd 100644
--- a/drivers/watchdog/cpu5wdt.c
+++ b/drivers/watchdog/cpu5wdt.c
@@ -39,7 +39,7 @@
39static int verbose; 39static int verbose;
40static int port = 0x91; 40static int port = 0x91;
41static int ticks = 10000; 41static int ticks = 10000;
42static spinlock_t cpu5wdt_lock; 42static DEFINE_SPINLOCK(cpu5wdt_lock);
43 43
44#define PFX "cpu5wdt: " 44#define PFX "cpu5wdt: "
45 45
@@ -223,7 +223,6 @@ static int __devinit cpu5wdt_init(void)
223 "port=0x%x, verbose=%i\n", port, verbose); 223 "port=0x%x, verbose=%i\n", port, verbose);
224 224
225 init_completion(&cpu5wdt_device.stop); 225 init_completion(&cpu5wdt_device.stop);
226 spin_lock_init(&cpu5wdt_lock);
227 cpu5wdt_device.queue = 0; 226 cpu5wdt_device.queue = 0;
228 setup_timer(&cpu5wdt_device.timer, cpu5wdt_trigger, 0); 227 setup_timer(&cpu5wdt_device.timer, cpu5wdt_trigger, 0);
229 cpu5wdt_device.default_ticks = ticks; 228 cpu5wdt_device.default_ticks = ticks;
diff --git a/drivers/watchdog/eurotechwdt.c b/drivers/watchdog/eurotechwdt.c
index 41018d429abb..3946c51099c0 100644
--- a/drivers/watchdog/eurotechwdt.c
+++ b/drivers/watchdog/eurotechwdt.c
@@ -64,7 +64,7 @@
64static unsigned long eurwdt_is_open; 64static unsigned long eurwdt_is_open;
65static int eurwdt_timeout; 65static int eurwdt_timeout;
66static char eur_expect_close; 66static char eur_expect_close;
67static spinlock_t eurwdt_lock; 67static DEFINE_SPINLOCK(eurwdt_lock);
68 68
69/* 69/*
70 * You must set these - there is no sane way to probe for this board. 70 * You must set these - there is no sane way to probe for this board.
@@ -446,8 +446,6 @@ static int __init eurwdt_init(void)
446 goto outreg; 446 goto outreg;
447 } 447 }
448 448
449 spin_lock_init(&eurwdt_lock);
450
451 ret = misc_register(&eurwdt_miscdev); 449 ret = misc_register(&eurwdt_miscdev);
452 if (ret) { 450 if (ret) {
453 printk(KERN_ERR "eurwdt: can't misc_register on minor=%d\n", 451 printk(KERN_ERR "eurwdt: can't misc_register on minor=%d\n",
diff --git a/drivers/watchdog/ibmasr.c b/drivers/watchdog/ibmasr.c
index 195e0f798e76..c7481ad51629 100644
--- a/drivers/watchdog/ibmasr.c
+++ b/drivers/watchdog/ibmasr.c
@@ -68,7 +68,7 @@ static char asr_expect_close;
68static unsigned int asr_type, asr_base, asr_length; 68static unsigned int asr_type, asr_base, asr_length;
69static unsigned int asr_read_addr, asr_write_addr; 69static unsigned int asr_read_addr, asr_write_addr;
70static unsigned char asr_toggle_mask, asr_disable_mask; 70static unsigned char asr_toggle_mask, asr_disable_mask;
71static spinlock_t asr_lock; 71static DEFINE_SPINLOCK(asr_lock);
72 72
73static void __asr_toggle(void) 73static void __asr_toggle(void)
74{ 74{
@@ -386,8 +386,6 @@ static int __init ibmasr_init(void)
386 if (!asr_type) 386 if (!asr_type)
387 return -ENODEV; 387 return -ENODEV;
388 388
389 spin_lock_init(&asr_lock);
390
391 rc = asr_get_base_address(); 389 rc = asr_get_base_address();
392 if (rc) 390 if (rc)
393 return rc; 391 return rc;
diff --git a/drivers/watchdog/indydog.c b/drivers/watchdog/indydog.c
index 1cc5609666d1..1475e09f9af2 100644
--- a/drivers/watchdog/indydog.c
+++ b/drivers/watchdog/indydog.c
@@ -28,7 +28,7 @@
28 28
29#define PFX "indydog: " 29#define PFX "indydog: "
30static unsigned long indydog_alive; 30static unsigned long indydog_alive;
31static spinlock_t indydog_lock; 31static DEFINE_SPINLOCK(indydog_lock);
32 32
33#define WATCHDOG_TIMEOUT 30 /* 30 sec default timeout */ 33#define WATCHDOG_TIMEOUT 30 /* 30 sec default timeout */
34 34
@@ -185,8 +185,6 @@ static int __init watchdog_init(void)
185{ 185{
186 int ret; 186 int ret;
187 187
188 spin_lock_init(&indydog_lock);
189
190 ret = register_reboot_notifier(&indydog_notifier); 188 ret = register_reboot_notifier(&indydog_notifier);
191 if (ret) { 189 if (ret) {
192 printk(KERN_ERR PFX 190 printk(KERN_ERR PFX
diff --git a/drivers/watchdog/iop_wdt.c b/drivers/watchdog/iop_wdt.c
index aef94789019f..82fa7a92a8d2 100644
--- a/drivers/watchdog/iop_wdt.c
+++ b/drivers/watchdog/iop_wdt.c
@@ -37,7 +37,7 @@
37static int nowayout = WATCHDOG_NOWAYOUT; 37static int nowayout = WATCHDOG_NOWAYOUT;
38static unsigned long wdt_status; 38static unsigned long wdt_status;
39static unsigned long boot_status; 39static unsigned long boot_status;
40static spinlock_t wdt_lock; 40static DEFINE_SPINLOCK(wdt_lock);
41 41
42#define WDT_IN_USE 0 42#define WDT_IN_USE 0
43#define WDT_OK_TO_CLOSE 1 43#define WDT_OK_TO_CLOSE 1
@@ -226,9 +226,6 @@ static int __init iop_wdt_init(void)
226{ 226{
227 int ret; 227 int ret;
228 228
229 spin_lock_init(&wdt_lock);
230
231
232 /* check if the reset was caused by the watchdog timer */ 229 /* check if the reset was caused by the watchdog timer */
233 boot_status = (read_rcsr() & IOP_RCSR_WDT) ? WDIOF_CARDRESET : 0; 230 boot_status = (read_rcsr() & IOP_RCSR_WDT) ? WDIOF_CARDRESET : 0;
234 231
diff --git a/drivers/watchdog/ixp2000_wdt.c b/drivers/watchdog/ixp2000_wdt.c
index e86952a7168c..084f71aa855a 100644
--- a/drivers/watchdog/ixp2000_wdt.c
+++ b/drivers/watchdog/ixp2000_wdt.c
@@ -32,7 +32,7 @@
32static int nowayout = WATCHDOG_NOWAYOUT; 32static int nowayout = WATCHDOG_NOWAYOUT;
33static unsigned int heartbeat = 60; /* (secs) Default is 1 minute */ 33static unsigned int heartbeat = 60; /* (secs) Default is 1 minute */
34static unsigned long wdt_status; 34static unsigned long wdt_status;
35static spinlock_t wdt_lock; 35static DEFINE_SPINLOCK(wdt_lock);
36 36
37#define WDT_IN_USE 0 37#define WDT_IN_USE 0
38#define WDT_OK_TO_CLOSE 1 38#define WDT_OK_TO_CLOSE 1
@@ -189,7 +189,6 @@ static int __init ixp2000_wdt_init(void)
189 return -EIO; 189 return -EIO;
190 } 190 }
191 wdt_tick_rate = (*IXP2000_T1_CLD * HZ) / 256; 191 wdt_tick_rate = (*IXP2000_T1_CLD * HZ) / 256;
192 spin_lock_init(&wdt_lock);
193 return misc_register(&ixp2000_wdt_miscdev); 192 return misc_register(&ixp2000_wdt_miscdev);
194} 193}
195 194
diff --git a/drivers/watchdog/ixp4xx_wdt.c b/drivers/watchdog/ixp4xx_wdt.c
index e02c0ecda26b..4fc2e9ac26f7 100644
--- a/drivers/watchdog/ixp4xx_wdt.c
+++ b/drivers/watchdog/ixp4xx_wdt.c
@@ -181,7 +181,6 @@ static int __init ixp4xx_wdt_init(void)
181 181
182 return -ENODEV; 182 return -ENODEV;
183 } 183 }
184 spin_lock_init(&wdt_lock);
185 boot_status = (*IXP4XX_OSST & IXP4XX_OSST_TIMER_WARM_RESET) ? 184 boot_status = (*IXP4XX_OSST & IXP4XX_OSST_TIMER_WARM_RESET) ?
186 WDIOF_CARDRESET : 0; 185 WDIOF_CARDRESET : 0;
187 ret = misc_register(&ixp4xx_wdt_miscdev); 186 ret = misc_register(&ixp4xx_wdt_miscdev);
diff --git a/drivers/watchdog/ks8695_wdt.c b/drivers/watchdog/ks8695_wdt.c
index 811471903e8a..51757a520e8f 100644
--- a/drivers/watchdog/ks8695_wdt.c
+++ b/drivers/watchdog/ks8695_wdt.c
@@ -42,7 +42,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
42 42
43 43
44static unsigned long ks8695wdt_busy; 44static unsigned long ks8695wdt_busy;
45static spinlock_t ks8695_lock; 45static DEFINE_SPINLOCK(ks8695_lock);
46 46
47/* ......................................................................... */ 47/* ......................................................................... */
48 48
@@ -288,7 +288,6 @@ static struct platform_driver ks8695wdt_driver = {
288 288
289static int __init ks8695_wdt_init(void) 289static int __init ks8695_wdt_init(void)
290{ 290{
291 spin_lock_init(&ks8695_lock);
292 /* Check that the heartbeat value is within range; 291 /* Check that the heartbeat value is within range;
293 if not reset to the default */ 292 if not reset to the default */
294 if (ks8695_wdt_settimeout(wdt_time)) { 293 if (ks8695_wdt_settimeout(wdt_time)) {
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 2b4acb86c191..cd269b4574d1 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -55,7 +55,7 @@ module_param(timer_margin, uint, 0);
55MODULE_PARM_DESC(timer_margin, "initial watchdog timeout (in seconds)"); 55MODULE_PARM_DESC(timer_margin, "initial watchdog timeout (in seconds)");
56 56
57static unsigned int wdt_trgr_pattern = 0x1234; 57static unsigned int wdt_trgr_pattern = 0x1234;
58static spinlock_t wdt_lock; 58static DEFINE_SPINLOCK(wdt_lock);
59 59
60struct omap_wdt_dev { 60struct omap_wdt_dev {
61 void __iomem *base; /* physical */ 61 void __iomem *base; /* physical */
@@ -439,7 +439,6 @@ static struct platform_driver omap_wdt_driver = {
439 439
440static int __init omap_wdt_init(void) 440static int __init omap_wdt_init(void)
441{ 441{
442 spin_lock_init(&wdt_lock);
443 return platform_driver_register(&omap_wdt_driver); 442 return platform_driver_register(&omap_wdt_driver);
444} 443}
445 444
diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
index 2d9fb96a9ee9..66bd97f7969a 100644
--- a/drivers/watchdog/orion_wdt.c
+++ b/drivers/watchdog/orion_wdt.c
@@ -41,7 +41,7 @@ static int heartbeat = -1; /* module parameter (seconds) */
41static unsigned int wdt_max_duration; /* (seconds) */ 41static unsigned int wdt_max_duration; /* (seconds) */
42static unsigned int wdt_tclk; 42static unsigned int wdt_tclk;
43static unsigned long wdt_status; 43static unsigned long wdt_status;
44static spinlock_t wdt_lock; 44static DEFINE_SPINLOCK(wdt_lock);
45 45
46static void orion_wdt_ping(void) 46static void orion_wdt_ping(void)
47{ 47{
@@ -296,7 +296,6 @@ static struct platform_driver orion_wdt_driver = {
296 296
297static int __init orion_wdt_init(void) 297static int __init orion_wdt_init(void)
298{ 298{
299 spin_lock_init(&wdt_lock);
300 return platform_driver_register(&orion_wdt_driver); 299 return platform_driver_register(&orion_wdt_driver);
301} 300}
302 301