Skip to content

Commit fa7f314

Browse files
committed
fixup! gpiolib: Override gpiochip numbers with DT aliases
Commit [1] shuffled the initialisation of gpiochips, breaking the downstream patch that sets the chip numbers based on DT aliases. Fix the downstream patch by determining the of_node on the fly, rather than assuming it has already been set. This does result in more calls to gpiochip_choose_fwnode() than are necessary, but it reduces the scope of the patch and makes it more resilient. Signed-off-by: Phil Elwell <phil@raspberrypi.com> [1] 16fdabe ("gpio: Fix resource leaks on errors in gpiochip_add_data_with_key()")
1 parent 8d11ef2 commit fa7f314

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/gpio/gpiolib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
11021102
first_dynamic_gpiochip_num = (id >= 0) ? (id + 1) : 0;
11031103
}
11041104

1105-
id = of_alias_get_id(gdev->dev.of_node, "gpiochip");
1105+
id = of_alias_get_id(to_of_node(gpiochip_choose_fwnode(gc)), "gpiochip");
11061106
if (id < 0)
11071107
id = first_dynamic_gpiochip_num;
11081108

0 commit comments

Comments
 (0)