Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

gpio: pca953x: Fix pca953x_gpio_set_pull_up_down()

A previous fix, commit dc87f6dd058a ("gpio: pca953x: Fix
pca953x_gpio_set_config"), identified that pinconf_to_config_param() needed
to be used to isolate the config_param from the pinconf in
pca953x_gpio_set_config(). This fix however did not consider that this
would also be needed in pca953x_gpio_set_pull_up_down() to which it passes
this config.

Perform a similar call in pca953x_gpio_set_pull_up_down() to isolate the
configuration parameter there as well, rather than passing it from
pca953x_gpio_set_config() as the configuration argument may also be needed
in pca953x_gpio_set_pull_up_down() at a later date.

Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>

authored by

Martyn Welch and committed by
Bartosz Golaszewski
b122624a 9f7fed73

+5 -3
+5 -3
drivers/gpio/gpio-pca953x.c
··· 549 549 unsigned int offset, 550 550 unsigned long config) 551 551 { 552 + enum pin_config_param param = pinconf_to_config_param(config); 553 + 552 554 u8 pull_en_reg = pca953x_recalc_addr(chip, PCAL953X_PULL_EN, offset); 553 555 u8 pull_sel_reg = pca953x_recalc_addr(chip, PCAL953X_PULL_SEL, offset); 554 556 u8 bit = BIT(offset % BANK_SZ); ··· 566 564 mutex_lock(&chip->i2c_lock); 567 565 568 566 /* Configure pull-up/pull-down */ 569 - if (config == PIN_CONFIG_BIAS_PULL_UP) 567 + if (param == PIN_CONFIG_BIAS_PULL_UP) 570 568 ret = regmap_write_bits(chip->regmap, pull_sel_reg, bit, bit); 571 - else if (config == PIN_CONFIG_BIAS_PULL_DOWN) 569 + else if (param == PIN_CONFIG_BIAS_PULL_DOWN) 572 570 ret = regmap_write_bits(chip->regmap, pull_sel_reg, bit, 0); 573 571 else 574 572 ret = 0; ··· 576 574 goto exit; 577 575 578 576 /* Disable/Enable pull-up/pull-down */ 579 - if (config == PIN_CONFIG_BIAS_DISABLE) 577 + if (param == PIN_CONFIG_BIAS_DISABLE) 580 578 ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, 0); 581 579 else 582 580 ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, bit);