# Re: \[PATCH v3 01/14\] gpio: regmap: set gpio\_chip of\_node

- From: Michael Walle \<hidden\>
- Date: 2021-03-03 18:52:54 
- List: linux-devicetree
- Page: https://ratatoskr.run/linux-devicetree/2021/03/6287060
- Thread: https://ratatoskr.run/linux-gpio/2021/03/6286942/t.md

```text
Am 2021-03-03 16:27, schrieb Linus Walleij:
> On Wed, Mar 3, 2021 at 3:23 PM Álvaro Fernández Rojas [ref] wrote:
>
>> This is needed for properly registering gpio regmap as a child of a regmap
>> pin controller.
>>
>> Signed-off-by: Álvaro Fernández Rojas <redacted>
>> ---
>>  v3: introduce patch needed for properly parsing gpio-ranges.
>
> Oops a little bug. I suggest that I merge this into the pinctrl tree
> together with the rest of the patches when we are done with review.

Ha, I've just debugged this because it puzzled me why it was working
for me.

I was about to suggesting using the following instead:
chip->of_node = config->of_node ?: dev_of_node(config->parent);

It turns out this is already done in of_gpio_dev_init():
https://elixir.bootlin.com/linux/v5.12-rc1/source/drivers/gpio/gpiolib-of.c#L1043

So config->of_node is still optional. But I'm not sure if we
should add the line above for clarity in gpio-regmap.c.

-michael
```
