[PATCH] watchdog: spin_lock_init() fixes

Previous thread: [patch 09/10] Move blktrace to instrumentation directory by Mathieu Desnoyers on Monday, October 29, 2007 - 10:26 am. (1 message)

Next thread: [PATCH v4 0/2] [SCSI] Asynchronous event notification infrastructure by Jeff Garzik on Monday, October 29, 2007 - 10:42 am. (14 messages)
To: <wim@...>
Cc: <linux-kernel@...>, <devel@...>
Date: Monday, October 29, 2007 - 10:40 am

Some watchdog drivers initialize global spinlocks in module's init function
which is tolerable, but some do it in PCI probe function. So, switch to
static initialization to fix theoretical bugs and, more importantly, stop
giving people bad examples.

Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
---

drivers/watchdog/alim1535_wdt.c | 4 +---
drivers/watchdog/davinci_wdt.c | 4 +---
drivers/watchdog/i6300esb.c | 4 +---
drivers/watchdog/ib700wdt.c | 4 +---
drivers/watchdog/machzwd.c | 7 ++-----
drivers/watchdog/mpc83xx_wdt.c | 5 +----
drivers/watchdog/pc87413_wdt.c | 4 +---
drivers/watchdog/pnx4008_wdt.c | 4 +---
drivers/watchdog/sbc8360.c | 3 +--
drivers/watchdog/sc1200wdt.c | 3 +--
drivers/watchdog/sc520_wdt.c | 4 +---
drivers/watchdog/smsc37b787_wdt.c | 4 +---
drivers/watchdog/w83627hf_wdt.c | 4 +---
drivers/watchdog/w83697hf_wdt.c | 4 +---
drivers/watchdog/w83877f_wdt.c | 4 +---
drivers/watchdog/w83977f_wdt.c | 4 +---
drivers/watchdog/wafer5823wdt.c | 4 +---
drivers/watchdog/wdt977.c | 4 +---
drivers/watchdog/wdt_pci.c | 3 +--
19 files changed, 20 insertions(+), 57 deletions(-)

--- a/drivers/watchdog/alim1535_wdt.c
+++ b/drivers/watchdog/alim1535_wdt.c
@@ -31,7 +31,7 @@ static unsigned long ali_is_open;
static char ali_expect_release;
static struct pci_dev *ali_pci;
static u32 ali_timeout_bits; /* stores the computed timeout */
-static spinlock_t ali_lock; /* Guards the hardware */
+static DEFINE_SPINLOCK(ali_lock); /* Guards the hardware */

/* module parameters */
static int timeout = WATCHDOG_TIMEOUT;
@@ -398,8 +398,6 @@ static int __init watchdog_init(void)
{
int ret;

- spin_lock_init(&ali_lock);
-
/* Check whether or not the hardware watchdog is there */
if (ali_find_watchdog() != 0) {
return -ENODEV;
--- a/drivers/watchdog/davinci_wdt.c
+++ b/drivers/watchdog/davinci_wdt.c
@...

Previous thread: [patch 09/10] Move blktrace to instrumentation directory by Mathieu Desnoyers on Monday, October 29, 2007 - 10:26 am. (1 message)

Next thread: [PATCH v4 0/2] [SCSI] Asynchronous event notification infrastructure by Jeff Garzik on Monday, October 29, 2007 - 10:42 am. (14 messages)