Re: [PATCH] watchdog: Add support for the WM8350 watchdog

From: Andrew Morton
Date: Thu Oct 30 2008 - 18:19:23 EST


On Mon, 27 Oct 2008 15:31:56 +0000
Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

> This driver implements support for the watchdog functionality provided
> by the Wolfson Microelectronics WM8350, a multi-function audio and
> power management subsystem intended for use in embedded systems. It is
> based on a driver originally written by Graeme Gregory, though it has
> been extensively modified since then.
>
> Use of a GPIO to kick the watchdog is not yet supported.
>
> ...
>
> +
> +static int wm8350_wdt_set_timeout(struct wm8350 *wm8350, u16 value)
> +{
> + int ret;
> + u16 reg;
> +
> + mutex_lock(&wdt_mutex);
> + wm8350_reg_unlock(wm8350);
> +
> + reg = wm8350_reg_read(wm8350, WM8350_SYSTEM_CONTROL_2);
> + reg &= ~WM8350_WDOG_TO_MASK;
> + reg |= value;
> + ret = wm8350_reg_write(wm8350, WM8350_SYSTEM_CONTROL_2, reg);
> +
> + wm8350_reg_lock(wm8350);

I was curious about this wm8350_reg_lock/wm8350_reg_unlock thing, so I
went to have a look at it. Nothing. Obviously its authors felt there
was no benefit in having anyone else understand what it does.

> + mutex_unlock(&wdt_mutex);
> +
> + return ret;
> +}
>
> ...
>
> +static int wm8350_wdt_open(struct inode *inode, struct file *file)
> +{
> + struct wm8350 *wm8350 = get_wm8350();
> + int ret;
> +
> + if (!wm8350)
> + return -ENODEV;
> +
> + if (test_and_set_bit(1, &wm8350_wdt_users))

It's odd that the driver uses bit 1 rather than bit 0.

--
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/