Re: [PATCH v5 02/10] property: Add functions to count named child nodes

Andy Shevchenko
2025-03-03T12:00:31Z

On Mon, Mar 03, 2025 at 01:50:13PM +0200, Heikki Krogerus wrote:

...

> > +unsigned int device_get_child_node_count_named(const struct device *dev,
> > + const char *name)
> > +{
> > + const struct fwnode_handle *fwnode = dev_fwnode(dev);
> > +
> > + if (!fwnode)
> > + return -EINVAL;
> > +
> > + if (IS_ERR(fwnode))
> > + return PTR_ERR(fwnode);
> > +
> > + return fwnode_get_child_node_count_named(fwnode, name);
> > +}
> > +EXPORT_SYMBOL_GPL(device_get_child_node_count_named);
>
> Sorry if I missed something in the v4 thread, but why not do all the
> checks in fwnode_get_child_node_count_named(), and make this an inline
> function?

+1, or drop the checks and make it return 0 depending on the follow up use cases.

> static inline unsigned int
> device_get_child_node_count_named(const struct device *dev, const char *name)
> {
> return fwnode_get_child_node_count_named(dev_fwnode(fwnode), name);
> }

--
With Best Regards,
Andy Shevchenko