Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c7dfd0cc authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Wim Van Sebroeck
Browse files

[WATCHDOG] spin_lock_init() fixes



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: default avatarAlexey Dobriyan <adobriyan@sw.ru>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 2ba7d7b3
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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;
+1 −3
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@

static int heartbeat = DEFAULT_HEARTBEAT;

static spinlock_t io_lock;
static DEFINE_SPINLOCK(io_lock);
static unsigned long wdt_status;
#define WDT_IN_USE        0
#define WDT_OK_TO_CLOSE   1
@@ -200,8 +200,6 @@ static int davinci_wdt_probe(struct platform_device *pdev)
	int ret = 0, size;
	struct resource *res;

	spin_lock_init(&io_lock);

	if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT)
		heartbeat = DEFAULT_HEARTBEAT;

+1 −3
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@

/* internal variables */
static void __iomem *BASEADDR;
static spinlock_t esb_lock; /* Guards the hardware */
static DEFINE_SPINLOCK(esb_lock); /* Guards the hardware */
static unsigned long timer_alive;
static struct pci_dev *esb_pci;
static unsigned short triggered; /* The status of the watchdog upon boot */
@@ -456,8 +456,6 @@ static int __init watchdog_init (void)
{
        int ret;

        spin_lock_init(&esb_lock);

        /* Check whether or not the hardware watchdog is there */
        if (!esb_getdevice () || esb_pci == NULL)
                return -ENODEV;
+1 −3
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@

static struct platform_device *ibwdt_platform_device;
static unsigned long ibwdt_is_open;
static spinlock_t ibwdt_lock;
static DEFINE_SPINLOCK(ibwdt_lock);
static char expect_close;

/* Module information */
@@ -308,8 +308,6 @@ static int __devinit ibwdt_probe(struct platform_device *dev)
{
	int res;

	spin_lock_init(&ibwdt_lock);

#if WDT_START != WDT_STOP
	if (!request_region(WDT_STOP, 1, "IB700 WDT")) {
		printk (KERN_ERR PFX "STOP method I/O %X is not available.\n", WDT_STOP);
+2 −5
Original line number Diff line number Diff line
@@ -123,8 +123,8 @@ static void zf_ping(unsigned long data);
static int zf_action = GEN_RESET;
static unsigned long zf_is_open;
static char zf_expect_close;
static spinlock_t zf_lock;
static spinlock_t zf_port_lock;
static DEFINE_SPINLOCK(zf_lock);
static DEFINE_SPINLOCK(zf_port_lock);
static DEFINE_TIMER(zf_timer, zf_ping, 0, 0);
static unsigned long next_heartbeat = 0;

@@ -438,9 +438,6 @@ static int __init zf_init(void)

	zf_show_action(action);

	spin_lock_init(&zf_lock);
	spin_lock_init(&zf_port_lock);

	if(!request_region(ZF_IOBASE, 3, "MachZ ZFL WDT")){
		printk(KERN_ERR "cannot reserve I/O ports at %d\n",
							ZF_IOBASE);
Loading