On Tue, Feb 16, 2016 at 4:35 PM, Alexander Stein <alexander.stein@xxxxxxxxxxxxxxxxxxxxx> wrote: > Well, having a callback get_direction returning a bool would seem really strange. Well maybe an enum would be better. Patches accepted. > Actually the comments on gpiod_get_direction explicitly state GPIOF_DIR_IN and GPIOF_DIR_OUT > as return values which aren't used in that function itself, they come from the callback. Yeah so it is the gpiolib core that need to make sure the right value is propagated back to the API, not the driver. It exploits the fact that driver return a suiting 0/1 that happen to correspond to that. > Also other > dirvers like e.g. gpio-ich return (in ichx_gpio_get_direction) GPIOF_DIR_IN or GPIOF_DIR_OUT. Two wrong doesn't make one right. Patch gpio-ich to return 0/1 if you like, or even better: add a direction enum to <linux/gpio/driver.h> and start patching the callback and drivers to use that. Overall this is a thing that "just works" mostly, but I have had many problems with the driver and consumer API being mixed up (mostly by everyone using <linux/gpio.h> and I don't want to encourage that mess. Drivers should use <linux/gpio/driver.h> and nothing else. Consumers should use <linus/gpio/consumer.h> and nothing else. The latter require that they switch to GPIO descriptors though. I think. Yours, Linus Walleij -- 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