Commit 1334f32938e46fb321c67a652997d33583257249

Authored by Axel Lin
Committed by Wim Van Sebroeck
1 parent 216f3ad9aa

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>

Showing 11 changed files with 10 additions and 27 deletions Side-by-side Diff

drivers/watchdog/ar7_wdt.c
... ... @@ -70,8 +70,8 @@
70 70 };
71 71  
72 72 static unsigned long wdt_is_open;
73   -static spinlock_t wdt_lock;
74 73 static unsigned expect_close;
  74 +static DEFINE_SPINLOCK(wdt_lock);
75 75  
76 76 /* XXX currently fixed, allows max margin ~68.72 secs */
77 77 #define prescale_value 0xffff
... ... @@ -279,8 +279,6 @@
279 279 static int __devinit ar7_wdt_probe(struct platform_device *pdev)
280 280 {
281 281 int rc;
282   -
283   - spin_lock_init(&wdt_lock);
284 282  
285 283 ar7_regs_wdt =
286 284 platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
drivers/watchdog/cpu5wdt.c
... ... @@ -39,7 +39,7 @@
39 39 static int verbose;
40 40 static int port = 0x91;
41 41 static int ticks = 10000;
42   -static spinlock_t cpu5wdt_lock;
  42 +static DEFINE_SPINLOCK(cpu5wdt_lock);
43 43  
44 44 #define PFX "cpu5wdt: "
45 45  
... ... @@ -223,7 +223,6 @@
223 223 "port=0x%x, verbose=%i\n", port, verbose);
224 224  
225 225 init_completion(&cpu5wdt_device.stop);
226   - spin_lock_init(&cpu5wdt_lock);
227 226 cpu5wdt_device.queue = 0;
228 227 setup_timer(&cpu5wdt_device.timer, cpu5wdt_trigger, 0);
229 228 cpu5wdt_device.default_ticks = ticks;
drivers/watchdog/eurotechwdt.c
... ... @@ -64,7 +64,7 @@
64 64 static unsigned long eurwdt_is_open;
65 65 static int eurwdt_timeout;
66 66 static char eur_expect_close;
67   -static spinlock_t eurwdt_lock;
  67 +static DEFINE_SPINLOCK(eurwdt_lock);
68 68  
69 69 /*
70 70 * You must set these - there is no sane way to probe for this board.
... ... @@ -445,8 +445,6 @@
445 445 "eurwdt: can't register reboot notifier (err=%d)\n", ret);
446 446 goto outreg;
447 447 }
448   -
449   - spin_lock_init(&eurwdt_lock);
450 448  
451 449 ret = misc_register(&eurwdt_miscdev);
452 450 if (ret) {
drivers/watchdog/ibmasr.c
... ... @@ -68,7 +68,7 @@
68 68 static unsigned int asr_type, asr_base, asr_length;
69 69 static unsigned int asr_read_addr, asr_write_addr;
70 70 static unsigned char asr_toggle_mask, asr_disable_mask;
71   -static spinlock_t asr_lock;
  71 +static DEFINE_SPINLOCK(asr_lock);
72 72  
73 73 static void __asr_toggle(void)
74 74 {
... ... @@ -385,8 +385,6 @@
385 385  
386 386 if (!asr_type)
387 387 return -ENODEV;
388   -
389   - spin_lock_init(&asr_lock);
390 388  
391 389 rc = asr_get_base_address();
392 390 if (rc)
drivers/watchdog/indydog.c
... ... @@ -28,7 +28,7 @@
28 28  
29 29 #define PFX "indydog: "
30 30 static unsigned long indydog_alive;
31   -static spinlock_t indydog_lock;
  31 +static DEFINE_SPINLOCK(indydog_lock);
32 32  
33 33 #define WATCHDOG_TIMEOUT 30 /* 30 sec default timeout */
34 34  
... ... @@ -184,8 +184,6 @@
184 184 static int __init watchdog_init(void)
185 185 {
186 186 int ret;
187   -
188   - spin_lock_init(&indydog_lock);
189 187  
190 188 ret = register_reboot_notifier(&indydog_notifier);
191 189 if (ret) {
drivers/watchdog/iop_wdt.c
... ... @@ -37,7 +37,7 @@
37 37 static int nowayout = WATCHDOG_NOWAYOUT;
38 38 static unsigned long wdt_status;
39 39 static unsigned long boot_status;
40   -static spinlock_t wdt_lock;
  40 +static DEFINE_SPINLOCK(wdt_lock);
41 41  
42 42 #define WDT_IN_USE 0
43 43 #define WDT_OK_TO_CLOSE 1
... ... @@ -225,9 +225,6 @@
225 225 static int __init iop_wdt_init(void)
226 226 {
227 227 int ret;
228   -
229   - spin_lock_init(&wdt_lock);
230   -
231 228  
232 229 /* check if the reset was caused by the watchdog timer */
233 230 boot_status = (read_rcsr() & IOP_RCSR_WDT) ? WDIOF_CARDRESET : 0;
drivers/watchdog/ixp2000_wdt.c
... ... @@ -32,7 +32,7 @@
32 32 static int nowayout = WATCHDOG_NOWAYOUT;
33 33 static unsigned int heartbeat = 60; /* (secs) Default is 1 minute */
34 34 static unsigned long wdt_status;
35   -static spinlock_t wdt_lock;
  35 +static DEFINE_SPINLOCK(wdt_lock);
36 36  
37 37 #define WDT_IN_USE 0
38 38 #define WDT_OK_TO_CLOSE 1
... ... @@ -189,7 +189,6 @@
189 189 return -EIO;
190 190 }
191 191 wdt_tick_rate = (*IXP2000_T1_CLD * HZ) / 256;
192   - spin_lock_init(&wdt_lock);
193 192 return misc_register(&ixp2000_wdt_miscdev);
194 193 }
195 194  
drivers/watchdog/ixp4xx_wdt.c
... ... @@ -181,7 +181,6 @@
181 181  
182 182 return -ENODEV;
183 183 }
184   - spin_lock_init(&wdt_lock);
185 184 boot_status = (*IXP4XX_OSST & IXP4XX_OSST_TIMER_WARM_RESET) ?
186 185 WDIOF_CARDRESET : 0;
187 186 ret = misc_register(&ixp4xx_wdt_miscdev);
drivers/watchdog/ks8695_wdt.c
... ... @@ -42,7 +42,7 @@
42 42  
43 43  
44 44 static unsigned long ks8695wdt_busy;
45   -static spinlock_t ks8695_lock;
  45 +static DEFINE_SPINLOCK(ks8695_lock);
46 46  
47 47 /* ......................................................................... */
48 48  
... ... @@ -288,7 +288,6 @@
288 288  
289 289 static int __init ks8695_wdt_init(void)
290 290 {
291   - spin_lock_init(&ks8695_lock);
292 291 /* Check that the heartbeat value is within range;
293 292 if not reset to the default */
294 293 if (ks8695_wdt_settimeout(wdt_time)) {
drivers/watchdog/omap_wdt.c
... ... @@ -55,7 +55,7 @@
55 55 MODULE_PARM_DESC(timer_margin, "initial watchdog timeout (in seconds)");
56 56  
57 57 static unsigned int wdt_trgr_pattern = 0x1234;
58   -static spinlock_t wdt_lock;
  58 +static DEFINE_SPINLOCK(wdt_lock);
59 59  
60 60 struct omap_wdt_dev {
61 61 void __iomem *base; /* physical */
... ... @@ -439,7 +439,6 @@
439 439  
440 440 static int __init omap_wdt_init(void)
441 441 {
442   - spin_lock_init(&wdt_lock);
443 442 return platform_driver_register(&omap_wdt_driver);
444 443 }
445 444  
drivers/watchdog/orion_wdt.c
... ... @@ -41,7 +41,7 @@
41 41 static unsigned int wdt_max_duration; /* (seconds) */
42 42 static unsigned int wdt_tclk;
43 43 static unsigned long wdt_status;
44   -static spinlock_t wdt_lock;
  44 +static DEFINE_SPINLOCK(wdt_lock);
45 45  
46 46 static void orion_wdt_ping(void)
47 47 {
... ... @@ -296,7 +296,6 @@
296 296  
297 297 static int __init orion_wdt_init(void)
298 298 {
299   - spin_lock_init(&wdt_lock);
300 299 return platform_driver_register(&orion_wdt_driver);
301 300 }
302 301