[PATCH 3/8] ppc64: add a watchdog driver for rtas

Nathan Lynch ntl at pobox.com
Wed May 18 06:40:29 EST 2005


Arnd Bergmann wrote:
> +static volatile int wdrtas_miscdev_open = 0;
...
> +static int
> +wdrtas_open(struct inode *inode, struct file *file)
> +{
> +	/* only open once */
> +	if (xchg(&wdrtas_miscdev_open,1))
> +		return -EBUSY;

The volatile and xchg strike me as an obscure method for ensuring only
one process at a time can open this file.  Any reason a semaphore
couldn't be used?

> +static int
> +wdrtas_close(struct inode *inode, struct file *file)
> +{
> +	/* only stop watchdog, if this was announced using 'V' before */
> +	if (wdrtas_expect_close == WDRTAS_MAGIC_CHAR)
> +		wdrtas_timer_stop();
> +	else {
> +		printk("wdrtas: got unexpected close. Watchdog "
> +		       "not stopped.\n");

printk's need a valid log level specified.  There are several in this
file that lack them.


Nathan



More information about the Linuxppc64-dev mailing list