On Mon, Nov 09, 2020 at 10:53:23PM +0200, Andy Shevchenko wrote: > In some cases we would like to have debounce setter which doesn't fail > when feature is not supported by a controller. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> > --- > drivers/gpio/gpiolib.c | 7 +++++++ > drivers/gpio/gpiolib.h | 1 + > 2 files changed, 8 insertions(+) > > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c > index 4558af08df23..9d23fbf1f7cd 100644 > --- a/drivers/gpio/gpiolib.c > +++ b/drivers/gpio/gpiolib.c > @@ -2162,6 +2162,13 @@ static int gpio_set_bias(struct gpio_desc *desc) > return gpio_set_config_with_argument_optional(desc, bias, arg); > } > > +int gpio_set_debounce_timeout(struct gpio_desc *desc, unsigned int debounce) > +{ > + enum pin_config_param mode = PIN_CONFIG_PERSIST_STATE; > + > + return gpio_set_config_with_argument_optional(desc, mode, debounce); Again I think mode variable is pretty useless here and does not improve readability.