Re: [PATCH] gpio: Use dev_fwnode()

From: Andy Shevchenko
Date: Wed Jun 11 2025 - 11:23:00 EST


On Wed, Jun 11, 2025 at 12:43:34PM +0200, Jiri Slaby (SUSE) wrote:
> irq_domain_create_simple() takes fwnode as the first argument. It can be
> extracted from the struct device using dev_fwnode() helper instead of
> using of_node with of_fwnode_handle().
>
> So use the dev_fwnode() helper.

Thanks for this change. See my nit-pick below.

...

> @@ -436,10 +436,8 @@ static int brcmstb_gpio_irq_setup(struct platform_device *pdev,
> struct device_node *np = dev->of_node;
> int err;
>
> - priv->irq_domain =
> - irq_domain_create_linear(of_fwnode_handle(np), priv->num_gpios,
> - &brcmstb_gpio_irq_domain_ops,
> - priv);
> + priv->irq_domain = irq_domain_create_linear(dev_fwnode(dev), priv->num_gpios,
> + &brcmstb_gpio_irq_domain_ops, priv);

In cases like this, I would rather see something like

struct fwnode_handle *fwnode = dev_fwnode(dev);

just near to the respective of node extraction. This will help to reduce churn
when converting the rest of the code to use fwnode instead of of_node/np.

> if (!priv->irq_domain) {
> dev_err(dev, "Couldn't allocate IRQ domain\n");
> return -ENXIO;

Other than that I appreciate the series!

--
With Best Regards,
Andy Shevchenko