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>
This commit is contained in:
Andy Shevchenko 2020-11-09 22:53:20 +02:00
parent 8b69461c2b
commit 0c4d86663b
1 changed files with 11 additions and 3 deletions

View File

@ -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)