Re: [PATCH v2] add SBC-FITPC2 watchdog driver

From: Andrew Morton
Date: Mon Jul 27 2009 - 17:13:19 EST


On Tue, 21 Jul 2009 13:13:29 +0300
Mike Rapoport <mike@xxxxxxxxxxxxxx> wrote:

> > From: Denis Turischev <denis@xxxxxxxxxxxxxx>
>
> This patch adds support for watchdog found on SBC-FITPC2 board.
>
> +/*
> + * Watchdog driver for SBC-FITPC2 board
> + *
> + * Author: Denis Turischev <denis@xxxxxxxxxxxxxx>
> + *
> + * Adapted from the IXP2000 watchdog driver by Deepak Saxena.
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2. This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +#define pr_fmt(fmt) KBUILD_MODNAME " WATCHDOG: " fmt
> +
> +#include <linux/module.h>
> +#include <linux/types.h>
> +#include <linux/miscdevice.h>
> +#include <linux/watchdog.h>
> +#include <linux/ioport.h>
> +#include <linux/delay.h>
> +#include <linux/notifier.h>
> +#include <linux/fs.h>
> +#include <linux/reboot.h>
> +#include <linux/init.h>
> +#include <linux/moduleparam.h>
> +#include <linux/dmi.h>
> +
> +#include <linux/io.h>
> +#include <linux/uaccess.h>
> +#include <asm/system.h>
> +
> +static int nowayout = WATCHDOG_NOWAYOUT;
> +static unsigned int margin = 60; /* (secs) Default is 1 minute */
> +static unsigned long wdt_status;
> +static spinlock_t wdt_lock;

You forgot to initialise the spinlock.

--- a/drivers/watchdog/sbc_fitpc2_wdt.c~watchdog-add-sbc-fitpc2-watchdog-driver-fix
+++ a/drivers/watchdog/sbc_fitpc2_wdt.c
@@ -32,7 +32,7 @@
static int nowayout = WATCHDOG_NOWAYOUT;
static unsigned int margin = 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
_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/