Skip to content

Commit 593fdd4

Browse files
metuxdtor
authored andcommitted
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 <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 17b9292 commit 593fdd4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/input/keyboard/gpio_keys_polled.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ gpio_keys_polled_get_devtree_pdata(struct device *dev)
168168
pdata->rep = device_property_present(dev, "autorepeat");
169169
device_property_read_u32(dev, "poll-interval", &pdata->poll_interval);
170170

171+
device_property_read_string(dev, "label", &pdata->name);
172+
171173
device_for_each_child_node(dev, child) {
172174
if (fwnode_property_read_u32(child, "linux,code",
173175
&button->code)) {
@@ -270,7 +272,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
270272

271273
input = poll_dev->input;
272274

273-
input->name = pdev->name;
275+
input->name = pdata->name ?: pdev->name;
274276
input->phys = DRV_NAME"/input0";
275277

276278
input->id.bustype = BUS_HOST;

0 commit comments

Comments
 (0)