[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111115172053.GB9581@n2100.arm.linux.org.uk>
Date: Tue, 15 Nov 2011 17:20:53 +0000
From: Russell King - ARM Linux <linux@....linux.org.uk>
To: Mark Brown <broonie@...nsource.wolfsonmicro.com>
Cc: Patrick Combes <p-combes@...com>, grant.likely@...retlab.ca,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
Hugo Dupras <h-dupras@...com>
Subject: Re: [RFC][PATCH] gpiolib: add irq_wake (power-management) sysfs
file
On Tue, Nov 15, 2011 at 01:16:37PM +0000, Mark Brown wrote:
> On Fri, Nov 11, 2011 at 10:40:06AM +0100, Patrick Combes wrote:
> > + else if (sysfs_streq(buf, "enable") || sysfs_streq(buf, "1"))
> > + status = enable_irq_wake(gpio_to_irq(gpio));
> > + else if (sysfs_streq(buf, "disable") || sysfs_streq(buf, "0"))
> > + status = disable_irq_wake(gpio_to_irq(gpio));
> > + else
> > + status = -EINVAL;
>
> ...this doesn't do anything to stop userspace doing multiple enables and
> disables.
It doesn't check whether gpio_to_irq(gpio) returns something sane either.
It should be doing something like this before taking the mutex:
irq = gpio_to_irq(gpio);
if (irq <= 0)
return irq < 0 ? irq : -EINVAL;
and then doing (enable|disable)_irq_wake() on irq.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists