public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Handling multiple watchdogs
@ 2009-07-22 15:09 Simon Braunschmidt
  2009-07-22 16:19 ` Alan Cox
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Braunschmidt @ 2009-07-22 15:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: wim

Hi

I have two watchdogs on my board that I both want to handle. What would 
be the proper approach in this case?

What I can see currently is that most (all?) watchdogs register as 
chardev 10:130, that breaks when registering more than one.

I work around this in my private tree by something like:

-------8<-----------------

#ifndef WATCHDOG_MINOR
	#define WATCHDOG_MINOR 130
#endif
#define WATCHDOG0_MINOR 212
#define WATCHDOG_NUMDEVS 2

static struct watchdog_dev_id watchdog_possible_devs[] = {
	[0] = {
		.minor = WATCHDOG_MINOR,
		.name = "watchdog",
	},
	[1] = {
		.minor = WATCHDOG0_MINOR,
		.name = "watchdog0",
	},
};

/* watchdogs can also use unusual minor numbers, try them when we fail*/
for (i = 0; i < WATCHDOG_NUMDEVS; i++) {
	wdt_miscdev.minor=watchdog_possible_devs[i].minor;
	wdt_miscdev.name=watchdog_possible_devs[i].name;
	ret = misc_register(&wdt_miscdev);
	if (ret == 0) break;
	printk(KERN_INFO PFX
		"failed to register miscdev on minor=%d (err=%d)\n",
				wdt_miscdev.minor, ret);
}
if (ret != 0) {
	goto unreg_reboot;
}

----------------->8---------

Which gives me an additional watchdog chardevice on 10:212.

This approach is probably not the best, so i am not asking for inclusion 
of such a change. One solution would be to expose the watchdogs 
individually like
/dev/watchdog0, /dev/watchdog1 and so on and to expose a combined 
interface under /dev/watchdog.

I have searched the list and found some related discussion like
http://article.gmane.org/gmane.linux.kernel/398831/match=watchdogs
other threads and
http://git.kernel.org/?p=linux/kernel/git/wim/linux-2.6-watchdog-experimental.git;a=summary

, yet it does not seem like this reached mainline so far.

Any sharing of thoughts on the subject would be welcome.

Best Regards
Simon Braunschmidt

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-23  7:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-22 15:09 Handling multiple watchdogs Simon Braunschmidt
2009-07-22 16:19 ` Alan Cox
2009-07-22 18:52   ` Wim Van Sebroeck
2011-02-02 11:15     ` Alan Cox
2011-02-23  7:55       ` Wim Van Sebroeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox