[lm-sensors] [PATCH 1/3] watchdog_dev: Add support for having more then 1 watchdog

Alan Cox alan at lxorguk.ukuu.org.uk
Thu Mar 15 14:11:31 CET 2012


> Also having this support in watchdog_dev makes developing watchdog drivers
> for watchdog hardware which happens to often be found on systems with
> multiple watchdogs a lot easier.

See the patches I posted. I (biased as ever ;)) think they way I've done
it is better, but its also produced no feedback so I'll resend them again
shortly if others also need them.

For x86 we need them as some systems can have both a TCO timer and a
management engine timer.


> +static struct miscdevice watchdog_miscdev[MAX_WATCHDOGS] = { {
> +	.minor		= WATCHDOG_MINOR,
> +	.name		= "watchdog",
> +	.fops		= &watchdog_fops,
> +}, {

The way I did it was to support a legacy /dev/watchdog and a proper range
of watchdogs on their own dynamic major.

> +	.minor		= 212,
> +	.name		= "watchdog1",

Also for submitted patches please don't go taking minor numbers from
miscdev which are statically allocating them without properly registering
them first...


> +	/* Find our watchdog_device */
> +	for (idx = 0; idx < MAX_WATCHDOGS; idx++)
> +		if (watchdog_miscdev[idx].minor == iminor(inode)) {
> +			wdd = wdd_list[idx];
> +			break;
> +		}

Locking model ?


> +	/* No need to lock */
> +	for (idx = 0; idx < MAX_WATCHDOGS; idx++)
> +		if (wdd_list[idx] == watchdog)
> +			break;

What about a parallel open ?

Alan




More information about the lm-sensors mailing list