On Wed, Sep 04, 2024 at 04:03:47PM +0300, Andy Shevchenko wrote: > On Wed, Sep 04, 2024 at 05:00:04PM +0800, Chen-Yu Tsai wrote: > > There are cases where drivers would go through child device nodes and > > operate on only the ones whose node name starts with a given prefix. > > > > Provide a helper for these users. This will mainly be used in a > > subsequent patch that implements a hardware component prober for I2C > > busses. > > ... > > > +#define for_each_child_of_node_with_prefix_scoped(parent, child, prefix) \ > > + for (struct device_node *child __free(device_node) = \ > > + of_get_next_child_with_prefix(parent, NULL, prefix); \ > > + child != NULL; \ > > + child = of_get_next_child_with_prefix(parent, child, prefix)) > > I'm wondering if we may drop _scoped from day 1. Yeah, probably a bit confusing > as the rest of APIs without that suffix do require reference count handling on > the loop abrupt. Yes, please drop. We have other new ones coming and they don't have "_scoped". I was on the fence, but if you use a scoped one like a non-scoped one (declaring child outside or using it outside the loop) you will get a compiler error. Rob