From: Andy Shevchenko Date: Mon, 9 Nov 2020 20:53:20 +0000 (+0200) Subject: gpiolib: Extract gpio_set_config_with_argument() for future use X-Git-Tag: accepted/tizen/unified/20230118.172025~8222^2~33^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0c4d86663ba134cfe216eec5dd2c1ed3d52767e6;p=platform%2Fkernel%2Flinux-rpi.git gpiolib: Extract gpio_set_config_with_argument() for future use In the future we will need to have a separate function that takes an arbitrary argument value. Extract gpio_set_config_with_argument() for that purpose. Signed-off-by: Andy Shevchenko Acked-by: Linus Walleij Reviewed-by: Hans de Goede Reviewed-by: Mika Westerberg --- diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 13653bb..df9f6ed 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2093,10 +2093,19 @@ static int gpio_do_set_config(struct gpio_chip *gc, unsigned int offset, return gc->set_config(gc, offset, config); } -static int gpio_set_config(struct gpio_desc *desc, enum pin_config_param mode) +static int gpio_set_config_with_argument(struct gpio_desc *desc, + enum pin_config_param mode, + u32 argument) { struct gpio_chip *gc = desc->gdev->chip; unsigned long config; + + config = pinconf_to_config_packed(mode, argument); + return gpio_do_set_config(gc, gpio_chip_hwgpio(desc), config); +} + +static int gpio_set_config(struct gpio_desc *desc, enum pin_config_param mode) +{ unsigned int arg; switch (mode) { @@ -2110,8 +2119,7 @@ static int gpio_set_config(struct gpio_desc *desc, enum pin_config_param mode) break; } - config = pinconf_to_config_packed(mode, arg); - return gpio_do_set_config(gc, gpio_chip_hwgpio(desc), config); + return gpio_set_config_with_argument(desc, mode, arg); } static int gpio_set_bias(struct gpio_desc *desc)