Skip to content

Commit f58c91b

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 216bde1 commit f58c91b

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
@@ -1092,7 +1092,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
10921092
first_dynamic_gpiochip_num = (id >= 0) ? (id + 1) : 0;
10931093
}
10941094

1095-
id = of_alias_get_id(gdev->dev.of_node, "gpiochip");
1095+
id = of_alias_get_id(to_of_node(gpiochip_choose_fwnode(gc)), "gpiochip");
10961096
if (id < 0)
10971097
id = first_dynamic_gpiochip_num;
10981098

0 commit comments

Comments
 (0)