[PATCH 11/11] input: gpio-keys: request with label in DT if available

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



gpio-keys may have optional label properties, which we so far ignored.
Let's use them instead of generating a label from the device name
should they be available.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 drivers/input/gpio_keys.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/input/gpio_keys.c b/drivers/input/gpio_keys.c
index 3701817788ca..b52738f5ccb2 100644
--- a/drivers/input/gpio_keys.c
+++ b/drivers/input/gpio_keys.c
@@ -112,10 +112,13 @@ static int gpio_keys_probe_dt(struct gpio_keys *gk, struct device *dev)
 	gk->buttons = xzalloc(gk->nbuttons * sizeof(*gk->buttons));
 
 	for_each_child_of_node(np, npkey) {
+		const char *label = NULL;
 		struct gpio_desc *gpio;
 		uint32_t keycode;
 
-		gpio = dev_gpiod_get(dev, npkey, "gpios", GPIOD_IN, NULL);
+		of_property_read_string(npkey, "label", &label);
+
+		gpio = dev_gpiod_get(dev, npkey, NULL, GPIOD_IN, label);
 		if (IS_ERR(gpio)) {
 			pr_err("gpio_keys: gpio #%d can not be requested\n", i);
 			return PTR_ERR(gpio);
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux