Re: [PATCH] gpio: shared: call gpio_chip::of_xlate() if set
From: Bartosz Golaszewski
Date: Tue Mar 17 2026 - 09:45:56 EST
On Tue, Mar 17, 2026 at 1:54 PM Jon Hunter <jonathanh@xxxxxxxxxx> wrote:
>
> >
> > +#if IS_ENABLED(CONFIG_OF)
> > + if (is_of_node(entry->fwnode) && gc->of_xlate) {
> > + /*
> > + * This is the earliest that we can tranlate the
> > + * devicetree offset to the chip offset.
> > + */
> > + struct of_phandle_args gpiospec = { };
> > +
> > + gpiospec.np = to_of_node(entry->fwnode);
> > + gpiospec.args_count = 2;
> > + gpiospec.args[0] = entry->offset;
> > +
> > + ret = gc->of_xlate(gc, &gpiospec, NULL);
> > + if (ret < 0)
> > + return ret;
> > +
> > + entry->offset = ret;
> > + }
> > +#endif /* CONFIG_OF */
>
> Do we need something similar to this in the gpio_device_teardown_shared
> function?
>
No, we adjust the offset here so it'll be correct later.
Bart