public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: David Brownell <david-b@pacbell.net>
Cc: linux-kernel@vger.kernel.org, dg@emlix.com
Subject: Re: [patch 2.6.31-rc7] gpiolib: allow poll() on value
Date: Tue, 1 Sep 2009 13:43:11 -0700	[thread overview]
Message-ID: <20090901134311.95fba3c8.akpm@linux-foundation.org> (raw)
In-Reply-To: <200908271650.59287.david-b@pacbell.net>

On Thu, 27 Aug 2009 16:50:57 -0700
David Brownell <david-b@pacbell.net> wrote:

> From: Daniel Gl__ckner <dg@emlix.com>
> Subject: [PATCH v3] gpiolib: allow poll(2) on gpio value
> 
> Many gpio chips allow to generate interrupts when the value of a pin
> changes. This patch gives usermode application the opportunity to make
> use of this feature by calling poll(2) on the /sys/class/gpio/gpioN/value
> sysfs file. The edge to trigger can be set in the edge file in the same
> directory. Possible values are "none", "rising", "falling", and "both".
> 
> Using level triggers is not possible with current sysfs since nothing
> changes the GPIO value (and the IRQ keeps triggering).  Edge triggering
> will "just work".  Note that if there was an event between read() and
> poll(), the poll() returns immediately.
> 
> Also note that this version only supports true GPIO interrupts.  Some
> later patch might be able to synthesize this behavior by timer-driven
> polling; some systems seem to need that.
>
> ...
>
> +static struct idr pdesc_idr;

There's no locking to protect this tree.  If that isn't a bug then I'd
suggest that a comment be added here explaining why.

> +static irqreturn_t gpio_sysfs_irq(int irq, void *priv)
> +{
> +	struct work_struct	*work = priv;
> +
> +	schedule_work(work);
> +	return IRQ_HANDLED;
> +}

The only place where we explicitly cancel the pending work is in
gpio_setup_irq().  Is that sufficient?  Is there any way in which the
work callback can occur after things have been
freed/closed/deinitialised/etc?



  reply	other threads:[~2009-09-01 20:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-27 23:50 [patch 2.6.31-rc7] gpiolib: allow poll() on value David Brownell
2009-09-01 20:43 ` Andrew Morton [this message]
2009-09-02  1:04   ` 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=20090901134311.95fba3c8.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=david-b@pacbell.net \
    --cc=dg@emlix.com \
    --cc=linux-kernel@vger.kernel.org \
    /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