@@ -29,6 +29,7 @@
#include <linux/of_platform.h>
#include <linux/of_gpio.h>
#include <linux/spinlock.h>
+#include <linux/pinctrl/consumer.h>
struct gpio_button_data {
const struct gpio_keys_button *button;
@@ -666,6 +667,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
struct input_dev *input;
int i, error;
int wakeup = 0;
+ struct pinctrl *pinctrl;
if (!pdata) {
pdata = gpio_keys_get_devtree_pdata(dev);
@@ -673,6 +675,15 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
return PTR_ERR(pdata);
}
+ pinctrl = devm_pinctrl_get_select_default(dev);
+ if (IS_ERR(pinctrl)) {
+ error = PTR_ERR(pinctrl);
+ if (error == -EPROBE_DEFER)
+ return error;
+
+ dev_warn(dev, "No pinctrl provided\n");
+ }
+
ddata = kzalloc(sizeof(struct gpio_keys_drvdata) +
pdata->nbuttons * sizeof(struct gpio_button_data),
GFP_KERNEL);
If no pinctrl available just report a warning as some architecture may not need to do anything. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: linux-input@vger.kernel.org --- drivers/input/keyboard/gpio_keys.c | 11 +++++++++++ 1 file changed, 11 insertions(+)