Re: [PATCH v3 04/15] device property: Introduce device_for_each_child_node_scoped()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 16 Feb 2024 20:02:49 +0200
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:

> On Fri, Feb 16, 2024 at 05:52:10PM +0000, Jonathan Cameron wrote:
> > From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> > 
> > Similar to recently propose for_each_child_of_node_scoped() this
> > new version of the loop macro instantiates a new local
> > struct fwnode_handle * that uses the __free(fwnode_handle) auto
> > cleanup handling so that if a reference to a node is held on early
> > exit from the loop the reference will be released. If the loop
> > runs to completion, the child pointer will be NULL and no action will
> > be taken.
> > 
> > The reason this is useful is that it removes the need for
> > fwnode_handle_put() on early loop exits.  If there is a need
> > to retain the reference, then return_ptr(child) or no_free_ptr(child)
> > may be used to safely disable the auto cleanup.  
> 
> ...
> 
> > +#define device_for_each_child_node_scoped(dev, child)\
> > +	for (struct fwnode_handle *child __free(fwnode_handle) = \
> > +	     device_get_next_child_node(dev, NULL); child; \
> > +	     child = device_get_next_child_node(dev, child))  
> 
> You haven't changed the indentation of backslashes...
> 

I've managed to send out a stale version as definitely did update
that.  Sorry for the noise!

Ah found it - I managed to commit it on patch 15 not this one.

Will move it and send a v4.




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux