diff options
author | Andy Shevchenko | 2020-11-09 22:53:20 +0200 |
---|---|---|
committer | Andy Shevchenko | 2020-11-16 14:14:34 +0200 |
commit | 0c4d86663ba134cfe216eec5dd2c1ed3d52767e6 (patch) | |
tree | e01e669ce5647b26bafa23a9db02efe3a51d710a /drivers/gpio | |
parent | 8b69461c2b7c801e37259dc6e71b126c23c3f20d (diff) |
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 <andriy.shevchenko@linux.intel.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpiolib.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 13653bbd5010..df9f6ed96b64 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) |