Skip to content

Commit

Permalink
gpiolib: of: make fwnode take precedence in struct gpio_chip
Browse files Browse the repository at this point in the history
If the driver sets the fwnode in struct gpio_chip, let it take
precedence over the of_node. This only affects OF-based systems,
ACPI needs to be converted separately.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Acked-by: Linus Walleij <[email protected]>
  • Loading branch information
brgl committed Dec 17, 2021
1 parent 990f675 commit ac62726
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/gpio/gpiolib-of.c
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,9 @@ void of_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev)
if (gc->parent)
gdev->dev.of_node = gc->parent->of_node;

if (gc->fwnode)
gc->of_node = to_of_node(gc->fwnode);

/* If the gpiochip has an assigned OF node this takes precedence */
if (gc->of_node)
gdev->dev.of_node = gc->of_node;
Expand Down

0 comments on commit ac62726

Please sign in to comment.