diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2020-11-09 22:53:21 +0200 |
---|---|---|
committer | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2020-11-16 14:14:34 +0200 |
commit | 6aa32ad70759a9e4f6ceee137b06ac55d36a71e3 (patch) | |
tree | c4fbd37cb34c0f145d1d08f260c55ecc5e09edcb /drivers/gpio | |
parent | 0c4d86663ba134cfe216eec5dd2c1ed3d52767e6 (diff) |
gpiolib: move bias related code from gpio_set_config() to gpio_set_bias()
Move bias related code from gpio_set_config() to gpio_set_bias().
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 | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index df9f6ed96b64..7e40c827bd48 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2106,25 +2106,13 @@ static int gpio_set_config_with_argument(struct gpio_desc *desc, static int gpio_set_config(struct gpio_desc *desc, enum pin_config_param mode) { - unsigned int arg; - - switch (mode) { - case PIN_CONFIG_BIAS_PULL_DOWN: - case PIN_CONFIG_BIAS_PULL_UP: - arg = 1; - break; - - default: - arg = 0; - break; - } - - return gpio_set_config_with_argument(desc, mode, arg); + return gpio_set_config_with_argument(desc, mode, 0); } static int gpio_set_bias(struct gpio_desc *desc) { enum pin_config_param bias; + unsigned int arg; int ret; if (test_bit(FLAG_BIAS_DISABLE, &desc->flags)) @@ -2136,7 +2124,18 @@ static int gpio_set_bias(struct gpio_desc *desc) else return 0; - ret = gpio_set_config(desc, bias); + switch (bias) { + case PIN_CONFIG_BIAS_PULL_DOWN: + case PIN_CONFIG_BIAS_PULL_UP: + arg = 1; + break; + + default: + arg = 0; + break; + } + + ret = gpio_set_config_with_argument(desc, bias, arg); if (ret != -ENOTSUPP) return ret; |