gpio_set_debounce return value specification

From: Brendan Moran
Date: Thu Jul 21 2011 - 16:53:16 EST

Regarding gpio_set_debounce, declared in include/linux/gpio.h, defined in drivers/gpio/gpiolib.c

The return value for gpio_set_debounce isn't clearly specified.  The current use of the return value appears to be 0 on success, <0 on error.  Because many hardware implementations allow only specific debounce intervals, the actual debounce setting after calling gpio_set_debounce is unlikely to be the argument with which it was called.

I suggest that on success, the return value should be a positive integer indicating, in microseconds, the actual debounce interval which has been applied.  A value of 0 would indicate that the debounce was applied successfully, but the driver does not support this reporting.

The current code in gpiolib.c would support this without change.   A documentation change to gpiolib.c and gpio.h would be necessary.

Brendan Moran

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at