Patch "device property: Introduce device_for_each_child_node_scoped()" has been added to the 6.6-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    device property: Introduce device_for_each_child_node_scoped()

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     device-property-introduce-device_for_each_child_node.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 3b50555c434bca551d8c84cc358de5728808e287
Author: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
Date:   Sat Feb 17 16:42:38 2024 +0000

    device property: Introduce device_for_each_child_node_scoped()
    
    [ Upstream commit 365130fd47af6d4317aa16a407874b699ab8d8cb ]
    
    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.
    
    Acked-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Reviewed-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240217164249.921878-5-jic23@xxxxxxxxxx
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
    Stable-dep-of: 61cbfb5368dd ("iio: adc: ad7124: fix DT configuration parsing")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/linux/property.h b/include/linux/property.h
index 909416c701b8..d32b8052e086 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -168,6 +168,11 @@ struct fwnode_handle *device_get_next_child_node(const struct device *dev,
 	for (child = device_get_next_child_node(dev, NULL); child;	\
 	     child = device_get_next_child_node(dev, child))
 
+#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))
+
 struct fwnode_handle *fwnode_get_named_child_node(const struct fwnode_handle *fwnode,
 						  const char *childname);
 struct fwnode_handle *device_get_named_child_node(const struct device *dev,




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux