LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Wim Van Sebroeck <wim@iguana.be>
To: Oliver Schuster <olivers137@aol.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] add watchdog driver IT8716 IT8718 IT8726 IT8712J/K
Date: Thu, 18 Sep 2008 11:08:14 +0200	[thread overview]
Message-ID: <20080918090814.GD22550@infomag.infomag.iguana.be> (raw)
In-Reply-To: <47D72865.1010304@aol.com>

Hi Oliver,

> But first: Add support for it8718, which made the driver slightly more
> complex.
> Now the driver supports it8716, it8718, it8726, it8712-j and it8712-k,
> which are all 16-bit watchdog timer on ITE lpc-super-io-chips.

I added it into my linux-2.6-watchdog-mm tree. I noticed that the initialization
sequence should be done differenly (the misc_device should be registered last
because that opens up userspace to your driver).

Could you therefor test my patch and 2 check if the "misc_register(&wdt_miscdev);"
can be moved after the "/* Initialize CIR to use it as keepalive source */" part
(just before the printk(...)?

Thanks in advance,
Wim.

-------------------------------------------------------------------------------------
commit b8a047e5a678357ef2bc8c79ce539957579965dd
Author: Wim Van Sebroeck <wim@iguana.be>
Date:   Thu Sep 18 08:58:27 2008 +0000

    [WATCHDOG] it87_wdt.c - fix initialization sequence
    
    register_miscdevice gives userspace access to the device (via /dev/watchdog).
    It should therfore be done after the setting og the default value for the timeout
    and after the reboot_notifier registration.
    
    Signed-off-by: Wim Van Sebroeck <wim@iguana.be>

diff --git a/drivers/watchdog/it87_wdt.c b/drivers/watchdog/it87_wdt.c
index cbf5e83..5cd8473 100644
--- a/drivers/watchdog/it87_wdt.c
+++ b/drivers/watchdog/it87_wdt.c
@@ -625,26 +625,26 @@ static int __init it87_wdt_init(void)
 		spin_unlock_irqrestore(&spinlock, flags);
 	}
 
-	rc = misc_register(&wdt_miscdev);
-	if (rc) {
-		printk(KERN_ERR PFX
-		       "Cannot register miscdev on minor=%d (err=%d)\n",
-			wdt_miscdev.minor, rc);
-		goto err_out_region;
+	if (timeout < 1 || timeout > 65535) {
+		timeout = DEFAULT_TIMEOUT;
+		printk(KERN_WARNING PFX
+		       "Timeout value out of range, use default %d sec\n",
+		       DEFAULT_TIMEOUT);
 	}
 
 	rc = register_reboot_notifier(&wdt_notifier);
 	if (rc) {
 		printk(KERN_ERR PFX
 		       "Cannot register reboot notifier (err=%d)\n", rc);
-		goto err_out_miscdev;
+		goto err_out_region;
 	}
 
-	if (timeout < 1 || timeout > 65535) {
-		timeout = DEFAULT_TIMEOUT;
-		printk(KERN_WARNING PFX
-		       "Timeout value out of range, use default %d sec\n",
-		       DEFAULT_TIMEOUT);
+	rc = misc_register(&wdt_miscdev);
+	if (rc) {
+		printk(KERN_ERR PFX
+		       "Cannot register miscdev on minor=%d (err=%d)\n",
+			wdt_miscdev.minor, rc);
+		goto err_out_reboot;
 	}
 
 	/* Initialize CIR to use it as keepalive source */
@@ -665,8 +665,8 @@ static int __init it87_wdt_init(void)
 
 	return 0;
 
-err_out_miscdev:
-	misc_deregister(&wdt_miscdev);
+err_out_reboot:
+	unregister_reboot_notifier(&wdt_notifier);
 err_out_region:
 	release_region(base, test_bit(WDTS_USE_GP, &wdt_status) ? 1 : 8);
 	if (!test_bit(WDTS_USE_GP, &wdt_status)) {

      reply	other threads:[~2008-09-18  9:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-27 14:55 [PATCH] add watchdog driver IT8716 " Oliver Schuster
2008-02-29 23:51 ` Andrew Morton
2008-03-12  0:48   ` [PATCH] add watchdog driver IT8716 IT8718 " Oliver Schuster
2008-09-18  9:08     ` Wim Van Sebroeck [this message]

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=20080918090814.GD22550@infomag.infomag.iguana.be \
    --to=wim@iguana.be \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olivers137@aol.com \
    --subject='Re: [PATCH] add watchdog driver IT8716 IT8718 IT8726 IT8712J/K' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).