Hello Yegor, On Thu, May 8, 2014 at 10:19 AM, Yegor Yefremov <yegorslists@xxxxxxxxxxxxxx> wrote: > 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. > Is this the proper way (invoke read() before poll()) to work with > GPIOs from user space, so that this approach should be incorporated > into such libraries as libsoc [3] > I don't think that this should be an expected behavior, it seems that this is either a bug on gpiolib sysfs interface or gpio-omap.c and gpio-pca953x.c drivers (most probably the later than the former). The question is what side effect has to do a read(2) syscall before a poll(2) to make it succeed. I looked at drivers/gpio/gpiolib.c:gpio_value_show() but didn't find anything relevant. I didn't have time to dig futher on this but I'll try to take a look this weekend when I've more time. But for now I've added to Linus and Alexandre in cc in case they have an idea of what's going on. > Yegor > > [1] https://developer.ridgerun.com/wiki/index.php/Gpio-int-test.c > [2] http://comments.gmane.org/gmane.linux.distributions.gumstix.general/61286 > [3] https://github.com/jackmitch/libsoc Best regards, Javier -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html