Re: [PATCH] powerpc: Add support for the MPC83xx watchdog

From: Marcelo Tosatti
Date: Mon Jan 16 2006 - 19:47:54 EST


> +static unsigned long wdt_is_open;
> +static spinlock_t wdt_spinlock;
> +
> +static void mpc83xx_wdt_keepalive(void)
> +{
> + /* Ping the WDT */
> + spin_lock(&wdt_spinlock);
> + out_be16(&wd_base->swsrr, 0x556c);
> + out_be16(&wd_base->swsrr, 0xaa39);
> + spin_unlock(&wdt_spinlock);
> +}
> +
> +static ssize_t mpc83xx_wdt_write(struct file * file, const char __user * buf,
> + size_t count, loff_t * ppos)
> +{
> + if(count)
> + mpc83xx_wdt_keepalive();
> + return count;
> +}
> +
> +static int mpc83xx_wdt_open(struct inode * inode, struct file * file)
> +{
> + u32 tmp = SWCRR_SWEN;
> + if (test_and_set_bit(0, &wdt_is_open))
> + return -EBUSY;

Hi Kumar,

What do you need the spinlock for if the device can't be opened
by more than one process?

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