summaryrefslogtreecommitdiff
path: root/drivers/input/keyboard/gpio_keys_polled.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/keyboard/gpio_keys_polled.c')
-rw-r--r--drivers/input/keyboard/gpio_keys_polled.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c
index bed4f2086158..edc7262103b9 100644
--- a/drivers/input/keyboard/gpio_keys_polled.c
+++ b/drivers/input/keyboard/gpio_keys_polled.c
@@ -252,13 +252,13 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
size = sizeof(struct gpio_keys_polled_dev) +
pdata->nbuttons * sizeof(struct gpio_keys_button_data);
- bdev = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
+ bdev = devm_kzalloc(dev, size, GFP_KERNEL);
if (!bdev) {
dev_err(dev, "no memory for private data\n");
return -ENOMEM;
}
- poll_dev = devm_input_allocate_polled_device(&pdev->dev);
+ poll_dev = devm_input_allocate_polled_device(dev);
if (!poll_dev) {
dev_err(dev, "no memory for polled device\n");
return -ENOMEM;
@@ -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
@@ -332,7 +326,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
if (button->active_low)
flags |= GPIOF_ACTIVE_LOW;
- error = devm_gpio_request_one(&pdev->dev, button->gpio,
+ error = devm_gpio_request_one(dev, button->gpio,
flags, button->desc ? : DRV_NAME);
if (error) {
dev_err(dev,
@@ -365,7 +359,6 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
bdev->poll_dev = poll_dev;
bdev->dev = dev;
bdev->pdata = pdata;
- platform_set_drvdata(pdev, bdev);
error = input_register_polled_device(poll_dev);
if (error) {