lkml.org 
[lkml]   [2008]   [Oct]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 RESEND] gpiolib: Add pin change notification
From
Date

On Tue, 2008-10-21 at 13:31 -0700, Andrew Morton wrote:
> On Tue, 21 Oct 2008 09:50:06 +1100
> Ben Nizette <bn@niasdigital.com> wrote:
> > +static irqreturn_t gpio_irq_handler(int irq, void *dev_id)
> > +{
> > + struct gpio_desc *desc = dev_id;
> > + int gpio = desc - gpio_desc;
> > + int new, old;
> > +
> > + if (!gpio_is_valid(gpio))
> > + return IRQ_NONE;
> > +
> > + new = gpio_get_value(gpio);
> > + old = desc->val;
> > +
> > + if ((new && !old && test_bit(ASYNC_RISING, &desc->flags)) ||
> > + (!new && old && test_bit(ASYNC_FALLING, &desc->flags)))
> > + sysfs_notify(&desc->dev->kobj, NULL, "value");
>
> eekeekeek! sysfs_notify() does mutex_lock() and will die horridly if
> called from an interrupt handler.
>
> You should have got a storm of warnings when runtime testing this code.
> Please ensure that all debug options are enabled when testing code.
> Documentation/SubmitChecklist has help.

0_o yea that isn't great... Thanks - shall respin and repost shortly.


--Ben.



\
 
 \ /
  Last update: 2008-10-24 02:31    [W:0.064 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site