summaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorEnrico Weigelt, metux IT consult <info@metux.net>2019-07-07 07:55:46 +0200
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2019-07-07 08:12:29 +0200
commit593fdd4fb44ef2cbf4ec53ec2c6eb60eb079bb4c (patch)
tree36f6b6f6b068c58732a5e99bd3ba8e18b39f20e6 /drivers/input
parentInput: edt-ft5x06 - simplify event reporting code (diff)
downloadlinux-593fdd4fb44ef2cbf4ec53ec2c6eb60eb079bb4c.tar.xz
linux-593fdd4fb44ef2cbf4ec53ec2c6eb60eb079bb4c.zip
Input: gpio_keys_polled - allow specifying name of input device
Instead of hardcoding the input name to the driver name ('gpio-keys-polled'), allow specifying the name of the device via "label" property. If the property is not present (nor name is set in board-supplied platform data), we'll default to the old name. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/keyboard/gpio_keys_polled.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c
index c4087be0c2e0..033655ab5ed0 100644
--- a/drivers/input/keyboard/gpio_keys_polled.c
+++ b/drivers/input/keyboard/gpio_keys_polled.c
@@ -168,6 +168,8 @@ gpio_keys_polled_get_devtree_pdata(struct device *dev)
pdata->rep = device_property_present(dev, "autorepeat");
device_property_read_u32(dev, "poll-interval", &pdata->poll_interval);
+ device_property_read_string(dev, "label", &pdata->name);
+
device_for_each_child_node(dev, child) {
if (fwnode_property_read_u32(child, "linux,code",
&button->code)) {
@@ -270,7 +272,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
input = poll_dev->input;
- input->name = pdev->name;
+ input->name = pdata->name ?: pdev->name;
input->phys = DRV_NAME"/input0";
input->id.bustype = BUS_HOST;