From: Jonathan McDowell <noodles@earth.li>
To: Wim Van Sebroeck <wim@iguana.be>
Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Cleanup pc87413 watchdog driver to use request_muxed_region for SuperIO area
Date: Fri, 20 May 2011 09:20:54 -0700 [thread overview]
Message-ID: <20110520162054.GI28362@earth.li> (raw)
In-Reply-To: <20110520122129.GT17887@infomag.iguana.be>
On Fri, May 20, 2011 at 02:21:29PM +0200, Wim Van Sebroeck wrote:
> Hi Jonathan,
>
> > > @@ -528,7 +511,8 @@ static int __init pc87413_init(void)
> > > printk(KERN_INFO PFX "Version " VERSION " at io 0x%X\n",
> > > WDT_INDEX_IO_PORT);
> > >
> > > - /* request_region(io, 2, "pc87413"); */
> > > + if (!request_muxed_region(io, 2, MODNAME))
> > > + return -EBUSY;
> > >
> > > ret = register_reboot_notifier(&pc87413_notifier);
> > > if (ret != 0) {
> > > @@ -541,12 +525,32 @@ static int __init pc87413_init(void)
> > > printk(KERN_ERR PFX
> > > "cannot register miscdev on minor=%d (err=%d)\n",
> > > WATCHDOG_MINOR, ret);
> > > - unregister_reboot_notifier(&pc87413_notifier);
> > > - return ret;
> > > + goto reboot_unreg;
> > > }
> > > printk(KERN_INFO PFX "initialized. timeout=%d min \n", timeout);
> > > +
> > > + pc87413_select_wdt_out();
> > > + pc87413_enable_swc();
> > > + pc87413_get_swc_base_addr();
> > > +
> > > + if (!request_region(swc_base_addr, 0x20, MODNAME)) {
> > > + printk(KERN_ERR PFX
> > > + "cannot request SWC region at 0x%x\n", swc_base_addr);
> > > + ret = -EBUSY;
> > > + goto misc_unreg;
> > > + }
> > > +
> > > pc87413_enable();
> > > +
> > > + release_region(io, 2);
> > > return 0;
> > > +
> > > +misc_unreg:
> > > + misc_deregister(&pc87413_miscdev);
> > > +reboot_unreg:
> > > + unregister_reboot_notifier(&pc87413_notifier);
> > > + release_region(io, 2);
> > > + return ret;
> > > }
> > >
> > > /**
> > > @@ -569,7 +573,7 @@ static void __exit pc87413_exit(void)
> > >
> > > misc_deregister(&pc87413_miscdev);
> > > unregister_reboot_notifier(&pc87413_notifier);
> > > - /* release_region(io, 2); */
> > > + release_region(swc_base_addr, 0x20);
> > >
> > > printk(KERN_INFO MODNAME " watchdog component driver removed.\n");
> > > }
> I don't think this is the correct way to do this. You do the
> request_muxed_region only at init and exit of the module.
I do a single request_muxed_region in the init function, and release it
at the end of the init function. It's only necessary to hold the LPC
region while the WDT functionality is enabled and the base address for
the SWC block is retrieved.
After that point all access is via the SWC region, so there's no need to
call request_muxed_region. The call in the exit function releases the
SWC block. We're not holding the LPC region for the entire duration of
the driver being loaded.
J.
--
Hail Eris. All hail Discordia. | .''`. Debian GNU/Linux Developer
Fnord? | : :' : Happy to accept PGP signed
| `. `' or encrypted mail - RSA
| `- key on the keyservers.
next prev parent reply other threads:[~2011-05-20 16:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-14 19:02 [PATCH] Cleanup pc87413 watchdog driver to use request_muxed_region for SuperIO area Jonathan McDowell
2011-04-30 18:25 ` Jonathan McDowell
2011-05-02 19:48 ` Wim Van Sebroeck
2011-05-20 12:21 ` Wim Van Sebroeck
2011-05-20 16:20 ` Jonathan McDowell [this message]
2011-05-24 7:17 ` 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=20110520162054.GI28362@earth.li \
--to=noodles@earth.li \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@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;
as well as URLs for NNTP newsgroup(s).