linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Waychison <mikew@google.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Wim Van Sebroeck <wim@iguana.be>,
	Nat Gurumoorthy <natg@google.com>,
	Jean Delvare <khali@linux-fr.org>,
	Guenter Roeck <guenter.roeck@ericsson.com>,
	lm-sensors@lm-sensors.org, linux-kernel@vger.kernel.org,
	linux-watchdog@vger.kernel.org
Subject: Re: [PATCH v5 1/2] Use "request_muxed_region" in it87 watchdog drivers
Date: Thu, 14 Apr 2011 14:00:49 -0500	[thread overview]
Message-ID: <BANLkTinR53LO7HWMWoquKY5D+Aprs2OEWw@mail.gmail.com> (raw)
In-Reply-To: <20110413102947.3bf1cc88@lxorguk.ukuu.org.uk>

On Wed, Apr 13, 2011 at 4:29 AM, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> On Wed, 13 Apr 2011 09:03:00 +0200
> Wim Van Sebroeck <wim@iguana.be> wrote:
>
>> Hi Nat,
>>
>> > +   (void) request_muxed_region(REG, 2, NAME);
>>
>> Why do we need to typecast this? Can't we just use
>> +     request_muxed_region(REG, 2, NAME);
>
> We really ought to use
>
>        if ()
>
> in theory the request can fail if someone has hogged the resource and not
> muxed it. I'm not clear what the right thing to do in that case is -
> given it should never happen I guess log an error and bail out but that's
> a rather bigger change and perhaps should be a follow up patch ?
>

request_muxed_region() is sorta gross:  it's essentially acting like a
lock, meant to be used for short periods of time, but it can fail if
someone else decides it should.

Would it make more sense to have drivers that need to use the current
request_muxed_region() be able to force a region into a mux-only state
at driver init?  That would lead to much less contorted code to handle
the off-chance that the request_muxed_region() fails.

Ie:

Driver init:

if (!request_muxed_region(base, size, DRV_NAME))
   goto cleanup_driver_init_failed;

Driver cleanup

release_muxed_region(base, size); /* returns void */

And then within drivers:

use_muxed_region(base, size); /* sleeps until region is usable --
returns void */
/* Do stuff */
unuse_muxed_region(base, size); /* returns void */



I realize the above example re-uses the 'request_muxed_region()' name,
but at least this would be much more consistent with how
request_region is used in other drivers.

  reply	other threads:[~2011-04-14 19:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-12 20:48 [PATCH v5 0/2] Make all it87 drivers SMP safe Nat Gurumoorthy
2011-04-12 20:49 ` [PATCH v5 1/2] Use "request_muxed_region" in it87 watchdog drivers Nat Gurumoorthy
2011-04-13  6:50   ` [lm-sensors] " Hans de Goede
2011-04-13  8:05     ` Natarajan Gurumoorthy
2011-04-13  8:34       ` Jean Delvare
2011-04-13 17:59         ` Natarajan Gurumoorthy
2011-04-13 20:34           ` Jean Delvare
2011-04-14  9:25           ` Alan Cox
2011-04-14 17:58     ` Guenter Roeck
2011-04-13  7:03   ` Wim Van Sebroeck
2011-04-13  8:15     ` Natarajan Gurumoorthy
2011-04-13  9:29     ` Alan Cox
2011-04-14 19:00       ` Mike Waychison [this message]
2011-04-14 20:41         ` Alan Cox
2011-04-12 20:50 ` [PATCH v5 2/2] Use "request_muxed_region" in it87 hwmon drivers Nat Gurumoorthy

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=BANLkTinR53LO7HWMWoquKY5D+Aprs2OEWw@mail.gmail.com \
    --to=mikew@google.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=guenter.roeck@ericsson.com \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    --cc=natg@google.com \
    --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).