]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/input/keyboard/gpio_keys_polled.c
Merge tag 'gpio-v4.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[mirror_ubuntu-bionic-kernel.git] / drivers / input / keyboard / gpio_keys_polled.c
index 4fce43a6a0e0c12f851944cbe175de74e1cb53f1..edc7262103b9ac982f1dee130723849a5d6a275f 100644 (file)
@@ -303,8 +303,10 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
                                return -EINVAL;
                        }
 
-                       bdata->gpiod = devm_get_gpiod_from_child(dev, NULL,
-                                                                child);
+                       bdata->gpiod = devm_fwnode_get_gpiod_from_child(dev,
+                                                               NULL, child,
+                                                               GPIOD_IN,
+                                                               button->desc);
                        if (IS_ERR(bdata->gpiod)) {
                                error = PTR_ERR(bdata->gpiod);
                                if (error != -EPROBE_DEFER)
@@ -314,14 +316,6 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
                                fwnode_handle_put(child);
                                return error;
                        }
-
-                       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);
-                               fwnode_handle_put(child);
-                               return error;
-                       }
                } else if (gpio_is_valid(button->gpio)) {
                        /*
                         * Legacy GPIO number so request the GPIO here and