public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Simon Braunschmidt <sb@emlix.com>
To: linux-kernel@vger.kernel.org
Cc: wim@iguana.be
Subject: Handling multiple watchdogs
Date: Wed, 22 Jul 2009 17:09:11 +0200	[thread overview]
Message-ID: <4A672B97.1070704@emlix.com> (raw)

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

             reply	other threads:[~2009-07-22 15:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-22 15:09 Simon Braunschmidt [this message]
2009-07-22 16:19 ` Handling multiple watchdogs 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A672B97.1070704@emlix.com \
    --to=sb@emlix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wim@iguana.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox