diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-12-26 21:17:18 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-12-26 21:17:18 -0500 |
commit | e2a930071d9abf6dccd5442ef499184c963f5df1 (patch) | |
tree | 8a69a96379f527d793bce01bf8b2ee5a18778403 /drivers | |
parent | 464e1d5f23cca236b930ef068c328a64cab78fb1 (diff) | |
parent | 822703354774ec935169cbbc8d503236bcb54fda (diff) |
Merge tag 'gpio-v4.15-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO fixes from Linus Walleij:
"Two fixes. They are both kind of important, so why not send a pull
request on christmas eve.
- Fix a build problem in the gpio single register created by
refactorings.
- Fix assignment of GPIO line names, something that was mangled by
another patch"
* tag 'gpio-v4.15-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
gpio: fix "gpio-line-names" property retrieval
gpio: gpio-reg: fix build
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpio/gpio-reg.c | 4 | ||||
-rw-r--r-- | drivers/gpio/gpiolib-acpi.c | 2 | ||||
-rw-r--r-- | drivers/gpio/gpiolib-devprop.c | 17 | ||||
-rw-r--r-- | drivers/gpio/gpiolib-of.c | 3 | ||||
-rw-r--r-- | drivers/gpio/gpiolib.h | 3 |
5 files changed, 14 insertions, 15 deletions
diff --git a/drivers/gpio/gpio-reg.c b/drivers/gpio/gpio-reg.c index 23e771dba4c1..e85903eddc68 100644 --- a/drivers/gpio/gpio-reg.c +++ b/drivers/gpio/gpio-reg.c | |||
@@ -103,8 +103,8 @@ static int gpio_reg_to_irq(struct gpio_chip *gc, unsigned offset) | |||
103 | struct gpio_reg *r = to_gpio_reg(gc); | 103 | struct gpio_reg *r = to_gpio_reg(gc); |
104 | int irq = r->irqs[offset]; | 104 | int irq = r->irqs[offset]; |
105 | 105 | ||
106 | if (irq >= 0 && r->irq.domain) | 106 | if (irq >= 0 && r->irqdomain) |
107 | irq = irq_find_mapping(r->irq.domain, irq); | 107 | irq = irq_find_mapping(r->irqdomain, irq); |
108 | 108 | ||
109 | return irq; | 109 | return irq; |
110 | } | 110 | } |
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index eb4528c87c0b..d6f3d9ee1350 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c | |||
@@ -1074,7 +1074,7 @@ void acpi_gpiochip_add(struct gpio_chip *chip) | |||
1074 | } | 1074 | } |
1075 | 1075 | ||
1076 | if (!chip->names) | 1076 | if (!chip->names) |
1077 | devprop_gpiochip_set_names(chip); | 1077 | devprop_gpiochip_set_names(chip, dev_fwnode(chip->parent)); |
1078 | 1078 | ||
1079 | acpi_gpiochip_request_regions(acpi_gpio); | 1079 | acpi_gpiochip_request_regions(acpi_gpio); |
1080 | acpi_gpiochip_scan_gpios(acpi_gpio); | 1080 | acpi_gpiochip_scan_gpios(acpi_gpio); |
diff --git a/drivers/gpio/gpiolib-devprop.c b/drivers/gpio/gpiolib-devprop.c index 27f383bda7d9..f748aa3e77f7 100644 --- a/drivers/gpio/gpiolib-devprop.c +++ b/drivers/gpio/gpiolib-devprop.c | |||
@@ -19,30 +19,27 @@ | |||
19 | /** | 19 | /** |
20 | * devprop_gpiochip_set_names - Set GPIO line names using device properties | 20 | * devprop_gpiochip_set_names - Set GPIO line names using device properties |
21 | * @chip: GPIO chip whose lines should be named, if possible | 21 | * @chip: GPIO chip whose lines should be named, if possible |
22 | * @fwnode: Property Node containing the gpio-line-names property | ||
22 | * | 23 | * |
23 | * Looks for device property "gpio-line-names" and if it exists assigns | 24 | * Looks for device property "gpio-line-names" and if it exists assigns |
24 | * GPIO line names for the chip. The memory allocated for the assigned | 25 | * GPIO line names for the chip. The memory allocated for the assigned |
25 | * names belong to the underlying firmware node and should not be released | 26 | * names belong to the underlying firmware node and should not be released |
26 | * by the caller. | 27 | * by the caller. |
27 | */ | 28 | */ |
28 | void devprop_gpiochip_set_names(struct gpio_chip *chip) | 29 | void devprop_gpiochip_set_names(struct gpio_chip *chip, |
30 | const struct fwnode_handle *fwnode) | ||
29 | { | 31 | { |
30 | struct gpio_device *gdev = chip->gpiodev; | 32 | struct gpio_device *gdev = chip->gpiodev; |
31 | const char **names; | 33 | const char **names; |
32 | int ret, i; | 34 | int ret, i; |
33 | 35 | ||
34 | if (!chip->parent) { | 36 | ret = fwnode_property_read_string_array(fwnode, "gpio-line-names", |
35 | dev_warn(&gdev->dev, "GPIO chip parent is NULL\n"); | ||
36 | return; | ||
37 | } | ||
38 | |||
39 | ret = device_property_read_string_array(chip->parent, "gpio-line-names", | ||
40 | NULL, 0); | 37 | NULL, 0); |
41 | if (ret < 0) | 38 | if (ret < 0) |
42 | return; | 39 | return; |
43 | 40 | ||
44 | if (ret != gdev->ngpio) { | 41 | if (ret != gdev->ngpio) { |
45 | dev_warn(chip->parent, | 42 | dev_warn(&gdev->dev, |
46 | "names %d do not match number of GPIOs %d\n", ret, | 43 | "names %d do not match number of GPIOs %d\n", ret, |
47 | gdev->ngpio); | 44 | gdev->ngpio); |
48 | return; | 45 | return; |
@@ -52,10 +49,10 @@ void devprop_gpiochip_set_names(struct gpio_chip *chip) | |||
52 | if (!names) | 49 | if (!names) |
53 | return; | 50 | return; |
54 | 51 | ||
55 | ret = device_property_read_string_array(chip->parent, "gpio-line-names", | 52 | ret = fwnode_property_read_string_array(fwnode, "gpio-line-names", |
56 | names, gdev->ngpio); | 53 | names, gdev->ngpio); |
57 | if (ret < 0) { | 54 | if (ret < 0) { |
58 | dev_warn(chip->parent, "failed to read GPIO line names\n"); | 55 | dev_warn(&gdev->dev, "failed to read GPIO line names\n"); |
59 | kfree(names); | 56 | kfree(names); |
60 | return; | 57 | return; |
61 | } | 58 | } |
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index e0d59e61b52f..72a0695d2ac3 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c | |||
@@ -493,7 +493,8 @@ int of_gpiochip_add(struct gpio_chip *chip) | |||
493 | 493 | ||
494 | /* If the chip defines names itself, these take precedence */ | 494 | /* If the chip defines names itself, these take precedence */ |
495 | if (!chip->names) | 495 | if (!chip->names) |
496 | devprop_gpiochip_set_names(chip); | 496 | devprop_gpiochip_set_names(chip, |
497 | of_fwnode_handle(chip->of_node)); | ||
497 | 498 | ||
498 | of_node_get(chip->of_node); | 499 | of_node_get(chip->of_node); |
499 | 500 | ||
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index af48322839c3..6c44d1652139 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h | |||
@@ -228,7 +228,8 @@ static inline int gpio_chip_hwgpio(const struct gpio_desc *desc) | |||
228 | return desc - &desc->gdev->descs[0]; | 228 | return desc - &desc->gdev->descs[0]; |
229 | } | 229 | } |
230 | 230 | ||
231 | void devprop_gpiochip_set_names(struct gpio_chip *chip); | 231 | void devprop_gpiochip_set_names(struct gpio_chip *chip, |
232 | const struct fwnode_handle *fwnode); | ||
232 | 233 | ||
233 | /* With descriptor prefix */ | 234 | /* With descriptor prefix */ |
234 | 235 | ||