Skip to content

Commit e2a9300

Browse files
committed
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
2 parents 464e1d5 + 8227033 commit e2a9300

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

drivers/gpio/gpio-reg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ static int gpio_reg_to_irq(struct gpio_chip *gc, unsigned offset)
103103
struct gpio_reg *r = to_gpio_reg(gc);
104104
int irq = r->irqs[offset];
105105

106-
if (irq >= 0 && r->irq.domain)
107-
irq = irq_find_mapping(r->irq.domain, irq);
106+
if (irq >= 0 && r->irqdomain)
107+
irq = irq_find_mapping(r->irqdomain, irq);
108108

109109
return irq;
110110
}

drivers/gpio/gpiolib-acpi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ void acpi_gpiochip_add(struct gpio_chip *chip)
10741074
}
10751075

10761076
if (!chip->names)
1077-
devprop_gpiochip_set_names(chip);
1077+
devprop_gpiochip_set_names(chip, dev_fwnode(chip->parent));
10781078

10791079
acpi_gpiochip_request_regions(acpi_gpio);
10801080
acpi_gpiochip_scan_gpios(acpi_gpio);

drivers/gpio/gpiolib-devprop.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,27 @@
1919
/**
2020
* devprop_gpiochip_set_names - Set GPIO line names using device properties
2121
* @chip: GPIO chip whose lines should be named, if possible
22+
* @fwnode: Property Node containing the gpio-line-names property
2223
*
2324
* Looks for device property "gpio-line-names" and if it exists assigns
2425
* GPIO line names for the chip. The memory allocated for the assigned
2526
* names belong to the underlying firmware node and should not be released
2627
* by the caller.
2728
*/
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)
2931
{
3032
struct gpio_device *gdev = chip->gpiodev;
3133
const char **names;
3234
int ret, i;
3335

34-
if (!chip->parent) {
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",
36+
ret = fwnode_property_read_string_array(fwnode, "gpio-line-names",
4037
NULL, 0);
4138
if (ret < 0)
4239
return;
4340

4441
if (ret != gdev->ngpio) {
45-
dev_warn(chip->parent,
42+
dev_warn(&gdev->dev,
4643
"names %d do not match number of GPIOs %d\n", ret,
4744
gdev->ngpio);
4845
return;
@@ -52,10 +49,10 @@ void devprop_gpiochip_set_names(struct gpio_chip *chip)
5249
if (!names)
5350
return;
5451

55-
ret = device_property_read_string_array(chip->parent, "gpio-line-names",
52+
ret = fwnode_property_read_string_array(fwnode, "gpio-line-names",
5653
names, gdev->ngpio);
5754
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");
5956
kfree(names);
6057
return;
6158
}

drivers/gpio/gpiolib-of.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,8 @@ int of_gpiochip_add(struct gpio_chip *chip)
493493

494494
/* If the chip defines names itself, these take precedence */
495495
if (!chip->names)
496-
devprop_gpiochip_set_names(chip);
496+
devprop_gpiochip_set_names(chip,
497+
of_fwnode_handle(chip->of_node));
497498

498499
of_node_get(chip->of_node);
499500

drivers/gpio/gpiolib.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ static inline int gpio_chip_hwgpio(const struct gpio_desc *desc)
228228
return desc - &desc->gdev->descs[0];
229229
}
230230

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);
232233

233234
/* With descriptor prefix */
234235

0 commit comments

Comments
 (0)