diff options
author | Enrico Weigelt, metux IT consult <info@metux.net> | 2019-07-07 01:55:46 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2019-07-07 02:12:29 -0400 |
commit | 593fdd4fb44ef2cbf4ec53ec2c6eb60eb079bb4c (patch) | |
tree | 36f6b6f6b068c58732a5e99bd3ba8e18b39f20e6 | |
parent | 17b92927f8531d1ceb7e4f10b75fc4b066ac77fc (diff) |
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>
-rw-r--r-- | drivers/input/keyboard/gpio_keys_polled.c | 4 |
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) | |||
168 | pdata->rep = device_property_present(dev, "autorepeat"); | 168 | pdata->rep = device_property_present(dev, "autorepeat"); |
169 | device_property_read_u32(dev, "poll-interval", &pdata->poll_interval); | 169 | device_property_read_u32(dev, "poll-interval", &pdata->poll_interval); |
170 | 170 | ||
171 | device_property_read_string(dev, "label", &pdata->name); | ||
172 | |||
171 | device_for_each_child_node(dev, child) { | 173 | device_for_each_child_node(dev, child) { |
172 | if (fwnode_property_read_u32(child, "linux,code", | 174 | if (fwnode_property_read_u32(child, "linux,code", |
173 | &button->code)) { | 175 | &button->code)) { |
@@ -270,7 +272,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev) | |||
270 | 272 | ||
271 | input = poll_dev->input; | 273 | input = poll_dev->input; |
272 | 274 | ||
273 | input->name = pdev->name; | 275 | input->name = pdata->name ?: pdev->name; |
274 | input->phys = DRV_NAME"/input0"; | 276 | input->phys = DRV_NAME"/input0"; |
275 | 277 | ||
276 | input->id.bustype = BUS_HOST; | 278 | input->id.bustype = BUS_HOST; |