Re: sysfs: wait for GPIO interrupt
From: Linus Walleij <hidden>
Date: 2014-05-13 09:48:21
On Tue, May 13, 2014 at 1:45 AM, Javier Martinez Canillas [off-list ref] wrote:
Hello Yegor, On Thu, May 8, 2014 at 10:19 AM, Yegor Yefremov [off-list ref] wrote:quoted
I've stumbled upon following issue. When waiting for interrupt with poll() like described in this example [1], the program returns from poll() immediately. This thread [2] describes a workaround for this issue via making read() before invoking poll(). My system is am335x, kernel 3.15-rc4 I experience this behavior by both SoC's own GPIO and i2c expander tca6416.I tested with an OMAP3 board which uses the same GPIO driver than the am335x and I was able to reproduce your issue.
At times like this I always want to warn you for using the GPIO sysfs interface which is a scary piece of code. And also to know what you are doing in userspace. Just hammering GPIOs is already a bad idea, reading *interrupts* from GPIOs in userspace is an even worse idea. The basic rule is that the kernel shall handle hardware, and I just get the feeling you are doing some userspace driver that should be in the kernel instead. Yours, Linus Walleij