]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.34/gpio-label-descriptors-using-the-device-name.patch
Linux 4.14.95
[thirdparty/kernel/stable-queue.git] / releases / 4.14.34 / gpio-label-descriptors-using-the-device-name.patch
1 From foo@baz Mon Apr 9 13:58:16 CEST 2018
2 From: Linus Walleij <linus.walleij@linaro.org>
3 Date: Thu, 4 Jan 2018 22:31:11 +0100
4 Subject: gpio: label descriptors using the device name
5
6 From: Linus Walleij <linus.walleij@linaro.org>
7
8
9 [ Upstream commit 24e78079bf2250874e33da2e7cfbb6db72d3caf4 ]
10
11 Some GPIO lines appear named "?" in the lsgpio dump due to their
12 requesting drivers not passing a reasonable label.
13
14 Most typically this happens if a device tree node just defines
15 gpios = <...> and not foo-gpios = <...>, the former gets named
16 "foo" and the latter gets named "?".
17
18 However the struct device passed in is always valid so let's
19 just label the GPIO with dev_name() on the device if no proper
20 label was passed.
21
22 Cc: Reported-by: Jason Kridner <jkridner@beagleboard.org>
23 Reported-by: Jason Kridner <jkridner@beagleboard.org>
24 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
25 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
26 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27 ---
28 drivers/gpio/gpiolib.c | 3 ++-
29 1 file changed, 2 insertions(+), 1 deletion(-)
30
31 --- a/drivers/gpio/gpiolib.c
32 +++ b/drivers/gpio/gpiolib.c
33 @@ -3340,7 +3340,8 @@ struct gpio_desc *__must_check gpiod_get
34 return desc;
35 }
36
37 - status = gpiod_request(desc, con_id);
38 + /* If a connection label was passed use that, else use the device name as label */
39 + status = gpiod_request(desc, con_id ? con_id : dev_name(dev));
40 if (status < 0)
41 return ERR_PTR(status);
42