gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO
Make fwnode_get_named_gpiod() consistent with the rest of gpiod_get() like API, i.e. configure GPIO pin immediately after request. Besides obvious clean up it will help to configure pins based on firmware provided resources. Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
committed by
Linus Walleij
parent
7ce7d89f48
commit
a264d10ff4
@ -481,7 +481,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
|
||||
spin_lock_init(&bdata->lock);
|
||||
|
||||
if (child) {
|
||||
bdata->gpiod = devm_get_gpiod_from_child(dev, NULL, child);
|
||||
bdata->gpiod = devm_get_gpiod_from_child(dev, NULL, child, GPIOD_IN);
|
||||
if (IS_ERR(bdata->gpiod)) {
|
||||
error = PTR_ERR(bdata->gpiod);
|
||||
if (error == -ENOENT) {
|
||||
@ -496,13 +496,6 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
} else {
|
||||
error = gpiod_direction_input(bdata->gpiod);
|
||||
if (error) {
|
||||
dev_err(dev, "Failed to configure GPIO %d as input: %d\n",
|
||||
desc_to_gpio(bdata->gpiod), error);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
} else if (gpio_is_valid(button->gpio)) {
|
||||
/*
|
||||
|
Reference in New Issue
Block a user