public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ryan Mallon <ryan@bluewatersys.com>
To: David Brownell <david-b@pacbell.net>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"David Brownell" <dbrownell@users.sourceforge.net>,
	gregkh@suse.de, "linux kernel" <linux-kernel@vger.kernel.org>,
	ext-jani.1.nikula@nokia.com,
	"Andrew Morton" <akpm@linux-foundation.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [RFC PATCH] Rework gpio cansleep (was Re: gpiolib and sleeping gpios)
Date: Thu, 24 Jun 2010 07:12:50 +1200	[thread overview]
Message-ID: <4C225CB2.6090407@bluewatersys.com> (raw)
In-Reply-To: <728731.73469.qm@web180307.mail.gq1.yahoo.com>

David Brownell wrote:
> 
> --- On Tue, 6/22/10, Ryan Mallon <ryan@bluewatersys.com> wrote:
> 
>>> --- On Tue, 6/22/10, Ryan Mallon <ryan@bluewatersys.com>
>> wrote:

>>>> 'Can sleep' for a gpio has two different meanings
>> depending
>>>> on context
>>> NO; for the GPIO itself it's only ever had one
>>> meaning, regardless of context.
>>>
>>> You're trying to conflate the GPIO and one
>>> of the contexts in which it's used.  That's
>>> the problem you seem to be struggling with.
>>>
>>> Please stop conflating/confusing
>>> those two disparate concepts...
>> I'm not. 
> 
> BUT Your "counter" example below is solid
> proof that you are:  it shows exactly the
> confusion I pointed out:  call context versus
> the GPIO itself.  There's no way I can read
> that as anything except "you are"...
> 
>  
> Your intent here seems perhaps more to
> be a troll than to address any real
> technical issues.  I don't see much
> point participating any further.
> 
> 
>  Some gpios, such as those on io expanders, may
>> sleep in their
>> implementations of the gpio_(set/get) functions.
>>
> 
> Such GPIOs have a "cansleep" attribute, in short.
> 
> 
>> Drivers, which use a gpio, may call gpio_(set/get)
>> functions for a given
>> gpio from a context where it is not safe to sleep.
> 
> And that's the call dontext
> (in this case, from a driver).

Yes.

>   QED.  You are confusing two disparate concepts.

We are saying exactly the same thing.

> 
>  In this
>> case, a gpio
>> which may sleep (ie one on an i2c io-expander) cannot be
>> used with this
>> driver. The gpio_request will succeed, but any call to
>> gpio_(set/get)_value will produce a warning.
>>
>>>> example, if a driver calls gpio_get_value(gpio)
>> from an
>>>> interupt handler
> 
> 
> (YOU introduce interrupt/IRQ handlers...)
> 
>>>> then the gpio must not be a sleeping gpio.
>>> In a threaded IRQ handler it's OK to use
>>> the get_value_cansleep() option..
>> Ugh, you are really twisting my words.
> 
> 
> You said IRQ handler, so did I.  In what csense could I
> possibly be "twisting" your words"???
> 
> 
> STOP TROLLING.

Okay, I messed up the wording an used 'interrupt handler' as an example
of a non-sleep safe context. If I had said 'atomic' or 'spinlock'
context you would probably be telling me off for missing some other
non-sleep safe contexts.

The point is that we are discussing the issue of calls which may sleep.
Even if I was not entirely clear by getting the wording wrong, you _do_
know what I am talking about. You could correct on the bits on I get
wrong instead of labeling me a troll.

If we strip my patch back to just introducing gpio_request_cansleep,
which would be used in any driver where all of the calls are
gpio_(set/get)_cansleep, and make gpio_request only allow non-sleeping
gpios then incorrect use of gpios would be caught at request time and
returned to the caller as an error.

~Ryan



  reply	other threads:[~2010-06-23 19:12 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-17 21:47 gpiolib and sleeping gpios Ryan Mallon
2010-06-18  5:27 ` Uwe Kleine-König
2010-06-18  6:16 ` David Brownell
2010-06-18 22:01   ` Ryan Mallon
2010-06-19  6:21     ` David Brownell
2010-06-20 21:31       ` Ryan Mallon
2010-06-21  2:40         ` David Brownell
2010-06-21  5:09           ` Uwe Kleine-König
2010-06-23  1:59             ` [RFC PATCH] Rework gpio cansleep (was Re: gpiolib and sleeping gpios) Ryan Mallon
2010-06-23  4:37               ` David Brownell
2010-06-23  4:58                 ` Eric Miao
2010-06-23  9:51                   ` David Brownell
2010-06-23  5:02                 ` Ryan Mallon
2010-06-23  5:26                   ` Eric Miao
2010-06-23  9:39                   ` David Brownell
2010-06-23 19:12                     ` Ryan Mallon [this message]
2010-06-24  4:46                       ` [RFC PATCH] Rework gpio cansleep (was Re: gpiolib and sleepinggpios) Jon Povey
2010-06-24  8:20                         ` Lars-Peter Clausen
2010-06-24  8:29                         ` Jani Nikula
2010-06-24 10:31                           ` Lars-Peter Clausen
2010-06-24  6:41                       ` [RFC PATCH] Rework gpio cansleep (was Re: gpiolib and sleeping gpios) Uwe Kleine-König
2010-06-23 22:53                   ` Jamie Lokier
2010-06-23 23:06                     ` Ryan Mallon
2010-06-24  0:04                       ` Jamie Lokier
2010-06-24  0:10                         ` Ryan Mallon
2010-06-25  7:19                           ` David Brownell
2010-06-24  4:33                         ` [RFC PATCH] Rework gpio cansleep (was Re: gpiolib and sleepinggpios) Jon Povey
2010-06-29  8:29         ` gpiolib and sleeping gpios CoffBeta
2010-06-23 11:53       ` Jani Nikula
2010-06-23 12:40         ` David Brownell
2010-06-23 13:22           ` Jani Nikula
2010-06-23 13:39             ` David Brownell

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=4C225CB2.6090407@bluewatersys.com \
    --to=ryan@bluewatersys.com \
    --cc=akpm@linux-foundation.org \
    --cc=david-b@pacbell.net \
    --cc=dbrownell@users.sourceforge.net \
    --cc=ext-jani.1.nikula@nokia.com \
    --cc=gregkh@suse.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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