Message ID | 20220920103108.23074-12-jay.xu@rock-chips.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Rockchip pinctrl/GPIO support ACPI | expand |
On Tue, Sep 20, 2022 at 12:31 PM Jianqun Xu <jay.xu@rock-chips.com> wrote: > The Rockchip GPIO driver will probe before pinctrl and has no parent dt > node, lack of the of_node will cause the driver probe failure. > > Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com> > +#ifdef CONFIG_OF_GPIO > + gc->of_node = of_node_get(bank->dev->of_node); > +#endif Any introduction of of_node_get() needs to be balanced with a corresponding of_node_put(). Yours, Linus Walleij
On Tue, Oct 04, 2022 at 09:14:38AM +0200, Linus Walleij wrote: > On Tue, Sep 20, 2022 at 12:31 PM Jianqun Xu <jay.xu@rock-chips.com> wrote: > > The Rockchip GPIO driver will probe before pinctrl and has no parent dt > > node, lack of the of_node will cause the driver probe failure. > > > > Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com> > > > +#ifdef CONFIG_OF_GPIO > > + gc->of_node = of_node_get(bank->dev->of_node); > > +#endif > > Any introduction of of_node_get() needs to be balanced with a > corresponding of_node_put(). No, this code should not have been existed in the first place. We don't allow anymore any of of_node usage in the GPIO drivers. There is an fwnode and parent and logic to retrieve fwnode from parent in the GPIO library for the most of the cases.
On Tue, Oct 4, 2022 at 10:30 AM Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > On Tue, Oct 04, 2022 at 09:14:38AM +0200, Linus Walleij wrote: > > On Tue, Sep 20, 2022 at 12:31 PM Jianqun Xu <jay.xu@rock-chips.com> wrote: > > > The Rockchip GPIO driver will probe before pinctrl and has no parent dt > > > node, lack of the of_node will cause the driver probe failure. > > > > > > Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com> > > > > > +#ifdef CONFIG_OF_GPIO > > > + gc->of_node = of_node_get(bank->dev->of_node); > > > +#endif > > > > Any introduction of of_node_get() needs to be balanced with a > > corresponding of_node_put(). > > No, this code should not have been existed in the first place. We don't allow > anymore any of of_node usage in the GPIO drivers. There is an fwnode and parent > and logic to retrieve fwnode from parent in the GPIO library for the most of > the cases. Hm yeah given that the series want to introduce ACPI as well it makes a lot of sense. Yours, Linus Walleij
Hi walleij Thanks for revewing, i have got your reivews, and will update after heiko's review to avoid too much patchset vision. the gc->of_node is a fix for my patch serial, without this the gpiochip will fail to register. BR -------------- jay.xu@rock-chips.com >On Tue, Oct 4, 2022 at 10:30 AM Andy Shevchenko ><andriy.shevchenko@linux.intel.com> wrote: >> On Tue, Oct 04, 2022 at 09:14:38AM +0200, Linus Walleij wrote: >> > On Tue, Sep 20, 2022 at 12:31 PM Jianqun Xu <jay.xu@rock-chips.com> wrote: >> > > The Rockchip GPIO driver will probe before pinctrl and has no parent dt >> > > node, lack of the of_node will cause the driver probe failure. >> > > >> > > Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com> >> > >> > > +#ifdef CONFIG_OF_GPIO >> > > + gc->of_node = of_node_get(bank->dev->of_node); >> > > +#endif >> > >> > Any introduction of of_node_get() needs to be balanced with a >> > corresponding of_node_put(). >> >> No, this code should not have been existed in the first place. We don't allow >> anymore any of of_node usage in the GPIO drivers. There is an fwnode and parent >> and logic to retrieve fwnode from parent in the GPIO library for the most of >> the cases. > >Hm yeah given that the series want to introduce ACPI as well it makes >a lot of sense. > >Yours, >Linus Walleij
On Sat, Oct 08, 2022 at 02:19:28PM +0800, jay.xu@rock-chips.com wrote:
...
> the gc->of_node is a fix for my patch serial, without this the gpiochip will fail to register.
Do not use of_node. We have parent and fwnode members, use them according to your needs.
diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c index b294ef009daf..e36cdbd4bbef 100644 --- a/drivers/gpio/gpio-rockchip.c +++ b/drivers/gpio/gpio-rockchip.c @@ -588,6 +588,10 @@ static int rockchip_gpiolib_register(struct rockchip_pin_bank *bank) if (!gc->label) return -ENOMEM; +#ifdef CONFIG_OF_GPIO + gc->of_node = of_node_get(bank->dev->of_node); +#endif + ret = gpiochip_add_data(gc, bank); if (ret) { dev_err(bank->dev, "failed to add gpiochip %s, %d\n",
The Rockchip GPIO driver will probe before pinctrl and has no parent dt node, lack of the of_node will cause the driver probe failure. Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com> --- drivers/gpio/gpio-rockchip.c | 4 ++++ 1 file changed, 4 insertions(+)