Align availability checks on fwnode child node enumeration
Subsystems (15)
Sakari Ailus
reviewerv2 cover Align availability checks on fwnode child node enumeration
Hello everyone,
Historically the fwnode property API has enumerated only available device nodes on OF whereas on ACPI, also nodes that haven't been present in the system have been provided. Both OF and ACPI have similar concepts of node availbility, on OF it's the "status" property present on device nodes and on ACPI the _STA object evaluates to device present, enabled and functional bits, of which the present and functional bits are currently being used to determine whether to enumerate a device.
Two additional functions, fwnode_get_next_available_child_node() and fwnode_for_each_available_child_node(), have been provided to enumerate the available nodes only on ACPI, whereas on OF the implementation has been the same on the non-available variants. The motivation for providing these has very likely been to provide fwnode variants of the similarly named functions but the difference isn't justifiable from API consistency viewpoint.
This set switches the users away from the "available" fwnode API functions and later on removes them, aligning the functionality on all fwnode backends.
since v1:
- Move patch "ACPI: property: Make acpi_get_next_subnode() static" as first.
- Add missing parentheses and kernel-doc Return: section in acpi_get_next_present_subnode() documentation and move the Return
section: of fwnode_graph_get_endpoint_by_id() to the end of the documentation section (new patch for the latter).
- Use device_get_next_child_node() instead of fwnode_get_next_child_node() in flash LED driver drivers.
- Rework iterating port nodes in acpi_graph_get_next_endpoint() as suggested by Andy (new patch).
Sakari Ailus (16):
ACPI: property: Make acpi_get_next_subnode() static
ACPI: property: Use ACPI functions in acpi_graph_get_next_endpoint()
only
ACPI: property: Rework acpi_graph_get_next_endpoint()
ACPI: property: Return present device nodes only on fwnode interface
property: Move Return: section of fwnode_graph_get_endpoint_by_id()
down
property: Drop DEVICE_DISABLED flag in
fwnode_graph_get_endpoint_by_id()
property: Drop DEVICE_DISABLED flag in
fwnode_graph_get_endpoint_count()
property: Document that fwnode API returns available nodes driver core: Use fwnode_for_each_child_node() instead
net: lan966x: Use fwnode_for_each_child_node() instead
Input: touch-overlay - Use fwnode_for_each_child_node() instead
media: thp7312: Use fwnode_for_each_child_node() instead
leds: Use fwnode_for_each_child_node() instead
leds: Use fwnode_get_next_child_node() instead
property: Drop functions operating on "available" child nodes
spi: cadence: Remove explicit device node availability check
drivers/acpi/property.c | 42 +++++++++---- drivers/base/core.c | 10 ++-- drivers/base/property.c | 60 ++++--------------- drivers/input/touch-overlay.c | 2 +- drivers/leds/flash/leds-rt4505.c | 2 +- drivers/leds/flash/leds-rt8515.c | 2 +- drivers/leds/flash/leds-sgm3140.c | 3 +- drivers/leds/flash/leds-tps6131x.c | 2 +- drivers/leds/leds-max5970.c | 2 +- drivers/leds/leds-max77705.c | 2 +- drivers/leds/rgb/leds-ktd202x.c | 4 +- drivers/leds/rgb/leds-ncp5623.c | 2 +- drivers/media/i2c/thp7312.c | 2 +- .../ethernet/microchip/lan966x/lan966x_main.c | 2 +- drivers/spi/spi-cadence-xspi.c | 3 - include/linux/acpi.h | 10 ---- include/linux/property.h | 14 +---- 17 files changed, 61 insertions(+), 103 deletions(-)
Signature · 1 line
2.47.3
Sakari Ailus
reviewerPATCH v2 1/16 ACPI: property: Make acpi_get_next_subnode() static
acpi_get_next_subnode() is only used in drivers/acpi/property.c. Remove its prototype from include/linux/acpi.h and make it static.
--- drivers/acpi/property.c | 5 +++-- include/linux/acpi.h | 10 ---------- 2 files changed, 3 insertions(+), 12 deletions(-)
drivers/acpi/property.c +3 -2
@@ -1264,8 +1264,9 @@ static int stop_on_next(struct acpi_device *adev, void *data)* @fwnode: Firmware node to find the next child node for. * @child: Handle to one of the device's child nodes or a null handle. */ -struct fwnode_handle *acpi_get_next_subnode (const struct fwnode_handle *fwnode, -struct fwnode_handle *child) +static struct fwnode_handle * +acpi_get_next_subnode (const struct fwnode_handle *fwnode, +struct fwnode_handle *child) {struct acpi_device *adev =to_acpi_device_node (fwnode);
include/linux/acpi.h +0 -10
@@ -1349,9 +1349,6 @@ acpi_data_add_props(struct acpi_device_data *data, const guid_t *guid,int acpi_node_prop_get (const struct fwnode_handle *fwnode,const char *propname,void **valptr); -struct fwnode_handle *acpi_get_next_subnode (const struct fwnode_handle *fwnode, -struct fwnode_handle *child); -struct acpi_probe_entry ;typedef bool (*acpi_probe_entry_validate_subtbl )(struct acpi_subtable_header *,struct acpi_probe_entry *);
@@ -1450,13 +1447,6 @@ static inline int acpi_node_prop_get(const struct fwnode_handle *fwnode,return -ENXIO ; } -static inline struct fwnode_handle * -acpi_get_next_subnode (const struct fwnode_handle *fwnode, -struct fwnode_handle *child) -{ -return NULL ; -} -static inline struct fwnode_handle *acpi_graph_get_next_endpoint (const struct fwnode_handle *fwnode,struct fwnode_handle *prev)
Signature · 1 line
2.47.3
Re: [PATCH v2 01/16] ACPI: property: Make acpi_get_next_subnode() static
Hi Sakari,
Thank you for the patch.
Quoted 5 lines · Sakari Ailus
acpi_get_next_subnode()is only used indrivers/acpi/property.c. Remove its prototype frominclude/linux/acpi.hand make it static.Signed-off-by Sakari Ailus <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>
Quoted 49 lines
--- drivers/acpi/property.c | 5 +++-- include/linux/acpi.h | 10 ---------- 2 files changed, 3 insertions(+), 12 deletions(-)drivers/acpi/property.c +3
-2@@ -1264,8 +1264,9 @@ static int stop_on_next(struct acpi_device *adev, void *data)* @fwnode: Firmware node to find the next child node for. * @child: Handle to one of the device's child nodes or a null handle. */ -struct fwnode_handle *acpi_get_next_subnode (const struct fwnode_handle *fwnode, -struct fwnode_handle *child) +static struct fwnode_handle * +acpi_get_next_subnode (const struct fwnode_handle *fwnode, +struct fwnode_handle *child) {struct acpi_device *adev =to_acpi_device_node (fwnode);include/linux/acpi.h +0
-10@@ -1349,9 +1349,6 @@ acpi_data_add_props(struct acpi_device_data *data, const guid_t *guid,int acpi_node_prop_get (const struct fwnode_handle *fwnode,const char *propname,void **valptr); -struct fwnode_handle *acpi_get_next_subnode (const struct fwnode_handle *fwnode, -struct fwnode_handle *child); -struct acpi_probe_entry ;typedef bool (*acpi_probe_entry_validate_subtbl )(struct acpi_subtable_header *,struct acpi_probe_entry *);@@ -1450,13 +1447,6 @@ static inline int acpi_node_prop_get(const struct fwnode_handle *fwnode,return -ENXIO ; } -static inline struct fwnode_handle * -acpi_get_next_subnode (const struct fwnode_handle *fwnode, -struct fwnode_handle *child) -{ -return NULL ; -} -static inline struct fwnode_handle *acpi_graph_get_next_endpoint (const struct fwnode_handle *fwnode,struct fwnode_handle *prev)
Signature · 3 lines
Regards, Laurent Pinchart
Laurent Pinchart
maintainerRe: [PATCH v2 01/16] ACPI: property: Make acpi_get_next_subnode() static
Quoted 18 lines · Laurent Pinchart
Hi Sakari,
Thank you for the patch.
Quoted 5 lines · Sakari Ailus
acpi_get_next_subnode()is only used indrivers/acpi/property.c. Remove its prototype frominclude/linux/acpi.hand make it static.Signed-off-by Sakari Ailus <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>Quoted 5 lines
--- drivers/acpi/property.c | 5 +++-- include/linux/acpi.h | 10 ---------- 2 files changed, 3 insertions(+), 12 deletions(-)
Quoted 8 lines
drivers/acpi/property.c static int stop_on_next(struct acpi_device *adev, void *data) · line 1266
Quoted 8 lines
drivers/acpi/property.c +0
-0@@ -1264,8 +1264,9 @@ static int stop_on_next(struct acpi_device *adev, void *data)* @fwnode: Firmware node to find the next child node for. * @child: Handle to one of the device's child nodes or a null handle. */
I missed this, I'd turn /** into /* here as the function is now static.
Quoted 36 lines
Quoted 36 lines
drivers/acpi/property.c +3
-2-struct fwnode_handle *acpi_get_next_subnode (const struct fwnode_handle *fwnode, -struct fwnode_handle *child) +static struct fwnode_handle * +acpi_get_next_subnode (const struct fwnode_handle *fwnode, +struct fwnode_handle *child) {struct acpi_device *adev =to_acpi_device_node (fwnode);include/linux/acpi.h +0
-10@@ -1349,9 +1349,6 @@ acpi_data_add_props(struct acpi_device_data *data, const guid_t *guid,int acpi_node_prop_get (const struct fwnode_handle *fwnode,const char *propname,void **valptr); -struct fwnode_handle *acpi_get_next_subnode (const struct fwnode_handle *fwnode, -struct fwnode_handle *child); -struct acpi_probe_entry ;typedef bool (*acpi_probe_entry_validate_subtbl )(struct acpi_subtable_header *,struct acpi_probe_entry *);@@ -1450,13 +1447,6 @@ static inline int acpi_node_prop_get(const struct fwnode_handle *fwnode,return -ENXIO ; } -static inline struct fwnode_handle * -acpi_get_next_subnode (const struct fwnode_handle *fwnode, -struct fwnode_handle *child) -{ -return NULL ; -} -static inline struct fwnode_handle *acpi_graph_get_next_endpoint (const struct fwnode_handle *fwnode,struct fwnode_handle *prev)
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v2 01/16] ACPI: property: Make acpi_get_next_subnode() static
In reply to Sakari AilusQuoted 5 lines · On Wed, 24 Sep 2025 10:45:47 +0300 Sakari Ailus <[email protected]>…
acpi_get_next_subnode()is only used indrivers/acpi/property.c. Remove its prototype frominclude/linux/acpi.hand make it static.Signed-off-by Sakari Ailus <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>
Sakari Ailus
reviewerPATCH v2 2/16 ACPI: property: Use ACPI functions in acpi_graph_get_next_endpoint() only
In reply to Sakari AilusCalling fwnode_get_next_child_node() in ACPI implementation of the fwnode property API is somewhat problematic as the latter is used in the impelementation of the former. Instead of using fwnode_get_next_child_node() in acpi_graph_get_next_endpoint(), call acpi_get_next_subnode() directly instead.
--- drivers/acpi/property.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/acpi/property.c +4 -4
@@ -1381,7 +1381,7 @@ static struct fwnode_handle *acpi_graph_get_next_endpoint(if (!prev) { do { - port = fwnode_get_next_child_node(fwnode, port); + port = acpi_get_next_subnode(fwnode, port); /* * The names of the port nodes begin with "port@" * followed by the number of the port node and they also
@@ -1399,13 +1399,13 @@ static struct fwnode_handle *acpi_graph_get_next_endpoint(if (!port)return NULL ; - endpoint =fwnode_get_next_child_node (port, prev); + endpoint =acpi_get_next_subnode (port, prev);while (!endpoint) { - port =fwnode_get_next_child_node (fwnode, port); + port =acpi_get_next_subnode (fwnode, port);if (!port)break ;if (is_acpi_graph_node (port,"port" )) - endpoint =fwnode_get_next_child_node (port,NULL ); + endpoint =acpi_get_next_subnode (port,NULL ); }/*
Signature · 1 line
2.47.3
Re: [PATCH v2 02/16] ACPI: property: Use ACPI functions in acpi_graph_get_next_endpoint() only
Quoted 7 lines · Sakari Ailus
Calling
fwnode_get_next_child_node()in ACPI implementation of the fwnode property API is somewhat problematic as the latter is used in the impelementation of the former. Instead of usingfwnode_get_next_child_node()inacpi_graph_get_next_endpoint(), callacpi_get_next_subnode()directly instead.Signed-off-by Sakari Ailus <[email protected]>
Quoted 34 lines
--- drivers/acpi/property.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/acpi/property.c +4
-4@@ -1381,7 +1381,7 @@ static struct fwnode_handle *acpi_graph_get_next_endpoint(if (!prev) { do { - port = fwnode_get_next_child_node(fwnode, port); + port = acpi_get_next_subnode(fwnode, port); /* * The names of the port nodes begin with "port@" * followed by the number of the port node and they also@@ -1399,13 +1399,13 @@ static struct fwnode_handle *acpi_graph_get_next_endpoint(if (!port)return NULL ; - endpoint =fwnode_get_next_child_node (port, prev); + endpoint =acpi_get_next_subnode (port, prev);while (!endpoint) { - port =fwnode_get_next_child_node (fwnode, port); + port =acpi_get_next_subnode (fwnode, port);if (!port)break ;if (is_acpi_graph_node (port,"port" )) - endpoint =fwnode_get_next_child_node (port,NULL ); + endpoint =acpi_get_next_subnode (port,NULL ); }/*
Signature · 3 lines
Regards, Laurent Pinchart
Dmitry Torokhov
maintainerRe: [PATCH v2 02/16] ACPI: property: Use ACPI functions in acpi_graph_get_next_endpoint() only
In reply to Sakari AilusHi Sakari,
Quoted 2 lines · Sakari Ailus
Calling
fwnode_get_next_child_node()in ACPI implementation of the fwnode property API is somewhat problematic as the latter is used in the
How exactly is this problematic?
Quoted 3 lines
impelementation of the former. Instead of using
fwnode_get_next_child_node()inacpi_graph_get_next_endpoint(), callacpi_get_next_subnode()directly instead.
I think we are moving into the world of mixed fwnode types with software nodes/secondary fwnodes, so I do not think this is a step in right direction.
Thanks.
Signature · 1 line
Dmitry
Sakari Ailus
reviewerRe: [PATCH v2 02/16] ACPI: property: Use ACPI functions in acpi_graph_get_next_endpoint() only
Hi Dmitry,
Quoted 7 lines · Dmitry Torokhov
Hi Sakari,
Quoted 2 lines · Sakari Ailus
Calling
fwnode_get_next_child_node()in ACPI implementation of the fwnode property API is somewhat problematic as the latter is used in theHow exactly is this problematic?
In general, the fwnode property API is implemented by the (currently three) backends so the backend calling fwnode property API to call itself without knowing what exactly gets called may end up in an infinite recursion. Keeping ACPI implementation separate from the fwnode property frontend avoids even needing to think about this.
Quoted 8 lines
Quoted 4 lines
impelementation of the former. Instead of using
fwnode_get_next_child_node()inacpi_graph_get_next_endpoint(), callacpi_get_next_subnode()directly instead.I think we are moving into the world of mixed fwnode types with software nodes/secondary fwnodes, so I do not think this is a step in right direction.
This is not how it works. If you have an ACPI node, it's and ACPI node, not a software node or an OF node. A software node would be attached as fwnode->secondary, it's not the same ACPI (device or data) node.
Signature · 3 lines
Regards, Sakari Ailus
Re: [PATCH v2 02/16] ACPI: property: Use ACPI functions in acpi_graph_get_next_endpoint() only
In reply to Sakari AilusQuoted 7 lines · On Wed, 24 Sep 2025 10:45:48 +0300 Sakari Ailus <[email protected]>…
Calling
fwnode_get_next_child_node()in ACPI implementation of the fwnode property API is somewhat problematic as the latter is used in the impelementation of the former. Instead of usingfwnode_get_next_child_node()inacpi_graph_get_next_endpoint(), callacpi_get_next_subnode()directly instead.Signed-off-by Sakari Ailus <[email protected]>
Makes sense to me on simply basis of making reasoning about it a little simpler.
Sakari Ailus
reviewerPATCH v2 3/16 ACPI: property: Rework acpi_graph_get_next_endpoint()
In reply to Sakari AilusRework the code obtaining the next endpoint in acpi_graph_get_next_endpoint(). The resulting code removes unnecessary contitionals and should be easier to follow.
--- drivers/acpi/property.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/acpi/property.c +7 -6
@@ -1399,14 +1399,15 @@ static struct fwnode_handle *acpi_graph_get_next_endpoint(if (!port)return NULL ; - endpoint =acpi_get_next_subnode (port, prev); -while (!endpoint) { - port =acpi_get_next_subnode (fwnode, port); -if (!port) +do { + endpoint =acpi_get_next_subnode (port, prev); +if (endpoint)break ; + + port =acpi_get_next_subnode (fwnode, port);if (is_acpi_graph_node (port,"port" )) - endpoint =acpi_get_next_subnode (port,NULL ); - } + prev =NULL ; + }while (port);/* * The names of the endpoint nodes begin with "endpoint@" followed by
Signature · 1 line
2.47.3
Laurent Pinchart
maintainerRe: [PATCH v2 03/16] ACPI: property: Rework acpi_graph_get_next_endpoint()
Hi Sakari,
Quoted 22 lines · Sakari Ailus
Rework the code obtaining the next endpoint in
acpi_graph_get_next_endpoint(). The resulting code removes unnecessary contitionals and should be easier to follow.Suggested-by Andy Shevchenko <[email protected]>Signed-off-by Sakari Ailus <[email protected]>--- drivers/acpi/property.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)drivers/acpi/property.c +0
-4@@ -1399,14 +1399,15 @@ static struct fwnode_handle *acpi_graph_get_next_endpoint(if (!port)return NULL ; - endpoint =acpi_get_next_subnode (port, prev); -while (!endpoint) { - port =acpi_get_next_subnode (fwnode, port); -if (!port)
drivers/acpi/property.c static struct fwnode_handle *acpi_graph_get_next_endpoint( · line 1409
Quoted 10 lines
drivers/acpi/property.c +6
-2+ do { + endpoint = acpi_get_next_subnode(port, prev); + if (endpoint) break; + + port = acpi_get_next_subnode(fwnode, port); if (is_acpi_graph_node(port, "port")) - endpoint =acpi_get_next_subnode (port,NULL ); - } + prev = NULL;
Isn't there an issue here ? If the next subnode of fwnode is not a port, the next iteration of the do loop will attempt to get an endpoint from that non-port node. Maybe the acpi_get_next_subnode() that will try to get the endpoint from the non-port port will return NULL because prev won't be a child of port, but that seems fragile.
I think the following would be easier to understand:
do {
endpoint = acpi_get_next_subnode(port, prev);
if (endpoint)
break;
prev = NULL;
do {
port = acpi_get_next_subnode(fwnode, port);
} while (port && !is_acpi_graph_node(port, "port"));
} while (port);Quoted 5 lines
drivers/acpi/property.c +1
-0+ }while (port);/* * The names of the endpoint nodes begin with "endpoint@" followed by
Signature · 3 lines
Regards, Laurent Pinchart
Sakari Ailus
reviewerRe: [PATCH v2 03/16] ACPI: property: Rework acpi_graph_get_next_endpoint()
Hi Laurent,
Thank you for the review.
Quoted 44 lines · Laurent Pinchart
Hi Sakari,
Quoted 22 lines · Sakari Ailus
Rework the code obtaining the next endpoint in
acpi_graph_get_next_endpoint(). The resulting code removes unnecessary contitionals and should be easier to follow.Suggested-by Andy Shevchenko <[email protected]>Signed-off-by Sakari Ailus <[email protected]>--- drivers/acpi/property.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)drivers/acpi/property.c +0
-4@@ -1399,14 +1399,15 @@ static struct fwnode_handle *acpi_graph_get_next_endpoint(if (!port)return NULL ; - endpoint =acpi_get_next_subnode (port, prev); -while (!endpoint) { - port =acpi_get_next_subnode (fwnode, port); -if (!port)drivers/acpi/property.c static struct fwnode_handle *acpi_graph_get_next_endpoint( · line 1409
Quoted 10 lines
drivers/acpi/property.c +6
-2+ do { + endpoint = acpi_get_next_subnode(port, prev); + if (endpoint) break; + + port = acpi_get_next_subnode(fwnode, port); if (is_acpi_graph_node(port, "port")) - endpoint =acpi_get_next_subnode (port,NULL ); - } + prev = NULL;Isn't there an issue here ? If the next subnode of fwnode is not a port, the next iteration of the do loop will attempt to get an endpoint from that non-port node. Maybe the
acpi_get_next_subnode()that will try to get the endpoint from the non-port port will return NULL because prev won't be a child of port, but that seems fragile.I think the following would be easier to understand:
Quoted 11 lines
do {
endpoint = acpi_get_next_subnode(port, prev);
if (endpoint)
break;
prev = NULL;
do {
port = acpi_get_next_subnode(fwnode, port);
} while (port && !is_acpi_graph_node(port, "port"));
} while (port);Yes, this indeed ensures port will be a port node. I'll use this in the next version.
Quoted 7 lines
Quoted 6 lines
drivers/acpi/property.c +1
-0+ }while (port);/* * The names of the endpoint nodes begin with "endpoint@" followed by
Signature · 3 lines
Regards, Sakari Ailus
Sakari Ailus
reviewerPATCH v2 4/16 ACPI: property: Return present device nodes only on fwnode interface
In reply to Sakari Ailusfwnode_graph_get_next_subnode() may return fwnode backed by ACPI device nodes and there has been no check these devices are present in the system, unlike there has been on fwnode OF backend. In order to provide consistent behaviour towards callers, add a check for device presence by introducing a new function acpi_get_next_present_subnode(), used as the get_next_child_node() fwnode operation that also checks device node presence.
--- drivers/acpi/property.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/acpi/property.c +21 -1
@@ -1319,6 +1319,26 @@ acpi_get_next_subnode(const struct fwnode_handle *fwnode,return NULL ; } +/** +* acpi_get_next_present_subnode - Return the next present child node handle for a fwnode +* @fwnode: Firmware node to find the next child node for. +* @child: Handle to one of the device's child nodes or a null handle. +* Like acpi_get_next_subnode(), but the device nodes returned by +* acpi_get_next_present_subnode() are guaranteed to be present. +* Returns: The next sub-node fwnode handle. +*/ +static struct fwnode_handle * +acpi_get_next_present_subnode (const struct fwnode_handle *fwnode, +struct fwnode_handle *child) +{ +do { + child =acpi_get_next_subnode (fwnode, child); + }while (is_acpi_device_node (child) && + !acpi_device_is_present (to_acpi_device_node (child))); + +return child; +} +/** * acpi_node_get_parent - Return parent fwnode of this fwnode * @fwnode: Firmware node whose parent to get
@@ -1664,7 +1684,7 @@ static int acpi_fwnode_irq_get(const struct fwnode_handle *fwnode, .property_read_string_array = \ acpi_fwnode_property_read_string_array, \ .get_parent = acpi_node_get_parent, \ - .get_next_child_node = acpi_get_next_subnode, \ + .get_next_child_node = acpi_get_next_present_subnode, \ .get_named_child_node = acpi_fwnode_get_named_child_node, \ .get_name = acpi_fwnode_get_name, \ .get_name_prefix = acpi_fwnode_get_name_prefix, \
Signature · 1 line
2.47.3
Re: [PATCH v2 04/16] ACPI: property: Return present device nodes only on fwnode interface
Quoted 18 lines · Sakari Ailus
fwnode_graph_get_next_subnode()may return fwnode backed by ACPI device nodes and there has been no check these devices are present in the system, unlike there has been on fwnode OF backend. In order to provide consistent behaviour towards callers, add a check for device presence by introducing a new functionacpi_get_next_present_subnode(), used as theget_next_child_node()fwnode operation that also checks device node presence.Signed-off-by Sakari Ailus <[email protected]>--- drivers/acpi/property.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)drivers/acpi/property.c +0
-0
drivers/acpi/property.c acpi_get_next_subnode(const struct fwnode_handle *fwnode, · line 1322
Quoted 4 lines
drivers/acpi/property.c +1
-0@@ -1319,6 +1319,26 @@ acpi_get_next_subnode(const struct fwnode_handle *fwnode,return NULL ; } +/**
/*
as the function is static ?
drivers/acpi/property.c acpi_get_next_subnode(const struct fwnode_handle *fwnode, · line 1325
Quoted 3 lines
drivers/acpi/property.c +3
-0+* acpi_get_next_present_subnode - Return the next present child node handle for a fwnode +* @fwnode: Firmware node to find the next child node for. +* @child: Handle to one of the device's child nodes or a null handle.
A blank line here would be nice.
Quoted 28 lines
drivers/acpi/property.c +17
-1+* Like acpi_get_next_subnode(), but the device nodes returned by +* acpi_get_next_present_subnode() are guaranteed to be present. +* Returns: The next sub-node fwnode handle. +*/ +static struct fwnode_handle * +acpi_get_next_present_subnode (const struct fwnode_handle *fwnode, +struct fwnode_handle *child) +{ +do { + child =acpi_get_next_subnode (fwnode, child); + }while (is_acpi_device_node (child) && + !acpi_device_is_present (to_acpi_device_node (child))); + +return child; +} +/** * acpi_node_get_parent - Return parent fwnode of this fwnode * @fwnode: Firmware node whose parent to get @@ -1664,7 +1684,7 @@ static int acpi_fwnode_irq_get(const struct fwnode_handle *fwnode, .property_read_string_array = \ acpi_fwnode_property_read_string_array, \ .get_parent = acpi_node_get_parent, \ - .get_next_child_node = acpi_get_next_subnode, \ + .get_next_child_node = acpi_get_next_present_subnode, \ .get_named_child_node = acpi_fwnode_get_named_child_node, \ .get_name = acpi_fwnode_get_name, \ .get_name_prefix = acpi_fwnode_get_name_prefix, \
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v2 04/16] ACPI: property: Return present device nodes only on fwnode interface
In reply to Sakari AilusQuoted 9 lines · On Wed, 24 Sep 2025 10:45:50 +0300 Sakari Ailus <[email protected]>…
fwnode_graph_get_next_subnode()may return fwnode backed by ACPI device nodes and there has been no check these devices are present in the system, unlike there has been on fwnode OF backend. In order to provide consistent behaviour towards callers, add a check for device presence by introducing a new functionacpi_get_next_present_subnode(), used as theget_next_child_node()fwnode operation that also checks device node presence.Signed-off-by Sakari Ailus <[email protected]>
I think this is fine because of the bit in the ACPI spec that says all
bits are set if _STA is missing. It seems much less likely we'll see
problems with hardware disappearing because _STA is there but says the device isn't present.
Always a regression risk though :(
With the formatting changes Laurent asked for
Sakari Ailus
reviewerPATCH v2 5/16 property: Move Return: section of fwnode_graph_get_endpoint_by_id() down
In reply to Sakari AilusMove Return: section of fwnode_graph_get_endpoint_by_id() down where it habitually is located.
--- drivers/base/property.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/base/property.c +3 -3
@@ -1235,15 +1235,15 @@ static bool fwnode_graph_remote_available(struct fwnode_handle *ep)* The caller is responsible for calling fwnode_handle_put() on the returned * fwnode pointer. * -* Return: the fwnode handle of the local endpoint corresponding the port and -* endpoint IDs or %NULL if not found. -* * If FWNODE_GRAPH_ENDPOINT_NEXT is passed in @flags and the specified endpoint * has not been found, look for the closest endpoint ID greater than the * specified one and return the endpoint that corresponds to it, if present. * * Does not return endpoints that belong to disabled devices or endpoints that * are unconnected, unless FWNODE_GRAPH_DEVICE_DISABLED is passed in @flags. +* +* Return: the fwnode handle of the local endpoint corresponding the port and +* endpoint IDs or %NULL if not found. */ struct fwnode_handle * fwnode_graph_get_endpoint_by_id(const struct fwnode_handle *fwnode,
Signature · 1 line
2.47.3
Re: [PATCH v2 05/16] property: Move Return: section of fwnode_graph_get_endpoint_by_id() down
Quoted 4 lines · Sakari Ailus
Move Return: section of
fwnode_graph_get_endpoint_by_id()down where it habitually is located.Signed-off-by Sakari Ailus <[email protected]>
Quoted 27 lines
--- drivers/base/property.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/base/property.c +3
-3@@ -1235,15 +1235,15 @@ static bool fwnode_graph_remote_available(struct fwnode_handle *ep)* The caller is responsible for calling fwnode_handle_put() on the returned * fwnode pointer. * -* Return: the fwnode handle of the local endpoint corresponding the port and -* endpoint IDs or %NULL if not found. -* * If FWNODE_GRAPH_ENDPOINT_NEXT is passed in @flags and the specified endpoint * has not been found, look for the closest endpoint ID greater than the * specified one and return the endpoint that corresponds to it, if present. * * Does not return endpoints that belong to disabled devices or endpoints that * are unconnected, unless FWNODE_GRAPH_DEVICE_DISABLED is passed in @flags. +* +* Return: the fwnode handle of the local endpoint corresponding the port and +* endpoint IDs or %NULL if not found. */ struct fwnode_handle * fwnode_graph_get_endpoint_by_id(const struct fwnode_handle *fwnode,
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v2 05/16] property: Move Return: section of fwnode_graph_get_endpoint_by_id() down
In reply to Sakari AilusQuoted 2 lines · On Wed, 24 Sep 2025 10:45:51 +0300 Sakari Ailus <[email protected]>…
Move Return: section of
fwnode_graph_get_endpoint_by_id()down where it habitually is located.
I was rather expecting the kernel-doc documentation to specify this but it only seems to do so by example. Hence reasonable to describe it as you have.
Quoted 2 lines
Signed-off-by Sakari Ailus <[email protected]>
Sakari Ailus
reviewerPATCH v2 6/16 property: Drop DEVICE_DISABLED flag in fwnode_graph_get_endpoint_by_id()
In reply to Sakari AilusNo caller uses FWNODE_GRAPH_DEVICE_DISABLED flag when calling fwnode_graph_get_endpoint_by_id(). Drop support for the flag entirely and remove it from the documentation.
--- drivers/base/property.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/base/property.c +1 -5
@@ -1239,9 +1239,6 @@ static bool fwnode_graph_remote_available(struct fwnode_handle *ep)* has not been found, look for the closest endpoint ID greater than the * specified one and return the endpoint that corresponds to it, if present. * -* Does not return endpoints that belong to disabled devices or endpoints that -* are unconnected, unless FWNODE_GRAPH_DEVICE_DISABLED is passed in @flags. -* * Return: the fwnode handle of the local endpoint corresponding the port and * endpoint IDs or %NULL if not found. */
@@ -1252,13 +1249,12 @@ fwnode_graph_get_endpoint_by_id(const struct fwnode_handle *fwnode,struct fwnode_handle *ep, *best_ep =NULL ;unsigned int best_ep_id =0 ;bool endpoint_next = flags &FWNODE_GRAPH_ENDPOINT_NEXT ; -bool enabled_only = !(flags &FWNODE_GRAPH_DEVICE_DISABLED );fwnode_graph_for_each_endpoint (fwnode, ep) {struct fwnode_endpoint fwnode_ep = {0 };int ret; -if (enabled_only && !fwnode_graph_remote_available (ep)) +if (!fwnode_graph_remote_available (ep))continue ; ret =fwnode_graph_parse_endpoint (ep, &fwnode_ep);
Signature · 1 line
2.47.3
Laurent Pinchart
maintainerRe: [PATCH v2 06/16] property: Drop DEVICE_DISABLED flag in fwnode_graph_get_endpoint_by_id()
Hi Sakari,
Thank you for the patch.
Quoted 5 lines · Sakari Ailus
No caller uses
FWNODE_GRAPH_DEVICE_DISABLEDflag when callingfwnode_graph_get_endpoint_by_id(). Drop support for the flag entirely and remove it from the documentation.Signed-off-by Sakari Ailus <[email protected]>
You can squash this with 07/16.
Quoted 33 lines
--- drivers/base/property.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)drivers/base/property.c +1
-5@@ -1239,9 +1239,6 @@ static bool fwnode_graph_remote_available(struct fwnode_handle *ep)* has not been found, look for the closest endpoint ID greater than the * specified one and return the endpoint that corresponds to it, if present. * -* Does not return endpoints that belong to disabled devices or endpoints that -* are unconnected, unless FWNODE_GRAPH_DEVICE_DISABLED is passed in @flags. -* * Return: the fwnode handle of the local endpoint corresponding the port and * endpoint IDs or %NULL if not found. */ @@ -1252,13 +1249,12 @@ fwnode_graph_get_endpoint_by_id(const struct fwnode_handle *fwnode,struct fwnode_handle *ep, *best_ep =NULL ;unsigned int best_ep_id =0 ;bool endpoint_next = flags &FWNODE_GRAPH_ENDPOINT_NEXT ; -bool enabled_only = !(flags &FWNODE_GRAPH_DEVICE_DISABLED );fwnode_graph_for_each_endpoint (fwnode, ep) {struct fwnode_endpoint fwnode_ep = {0 };int ret; -if (enabled_only && !fwnode_graph_remote_available (ep)) +if (!fwnode_graph_remote_available (ep))continue ; ret =fwnode_graph_parse_endpoint (ep, &fwnode_ep);
Signature · 3 lines
Regards, Laurent Pinchart
Sakari Ailus
reviewerPATCH v2 7/16 property: Drop DEVICE_DISABLED flag in fwnode_graph_get_endpoint_count()
In reply to Sakari AilusFWNODE_GRAPH_DEVICE_DISABLED flag isn't used anywhere, drop the flag and support for it in fwnode_graph_get_endpoint_count().
--- drivers/base/property.c | 10 ++-------- include/linux/property.h | 8 +------- 2 files changed, 3 insertions(+), 15 deletions(-)
drivers/base/property.c +2 -8
@@ -1291,21 +1291,15 @@ EXPORT_SYMBOL_GPL(fwnode_graph_get_endpoint_by_id);/** * fwnode_graph_get_endpoint_count - Count endpoints on a device node * @fwnode: The node related to a device -* @flags: fwnode lookup flags * Count endpoints in a device node. -* -* If FWNODE_GRAPH_DEVICE_DISABLED flag is specified, also unconnected endpoints -* and endpoints connected to disabled devices are counted. */ -unsigned int fwnode_graph_get_endpoint_count (const struct fwnode_handle *fwnode, -unsigned long flags) +unsigned int fwnode_graph_get_endpoint_count (const struct fwnode_handle *fwnode) {struct fwnode_handle *ep;unsigned int count =0 ;fwnode_graph_for_each_endpoint (fwnode, ep) { -if (flags &FWNODE_GRAPH_DEVICE_DISABLED || -fwnode_graph_remote_available (ep)) +if (fwnode_graph_remote_available (ep)) count++; }
include/linux/property.h +1 -7
@@ -503,19 +503,13 @@ static inline bool fwnode_graph_is_endpoint(const struct fwnode_handle *fwnode)* @FWNODE_GRAPH_ENDPOINT_NEXT: In the case of no exact match, look for the * closest endpoint ID greater than the specified * one. -* @FWNODE_GRAPH_DEVICE_DISABLED: That the device to which the remote -* endpoint of the given endpoint belongs to, -* may be disabled, or that the endpoint is not -* connected. */ #define FWNODE_GRAPH_ENDPOINT_NEXT BIT(0) -#define FWNODE_GRAPH_DEVICE_DISABLED BIT(1)struct fwnode_handle *fwnode_graph_get_endpoint_by_id (const struct fwnode_handle *fwnode,u32 port,u32 endpoint,unsigned long flags); -unsigned int fwnode_graph_get_endpoint_count (const struct fwnode_handle *fwnode, -unsigned long flags); +unsigned int fwnode_graph_get_endpoint_count (const struct fwnode_handle *fwnode);#define fwnode_graph_for_each_endpoint (fwnode, child) \ for (child = fwnode_graph_get_next_endpoint(fwnode, NULL); child; \
Signature · 1 line
2.47.3
Re: [PATCH v2 07/16] property: Drop DEVICE_DISABLED flag in fwnode_graph_get_endpoint_count()
Quoted 5 lines · Sakari Ailus
FWNODE_GRAPH_DEVICE_DISABLEDflag isn't used anywhere, drop the flag and support for it infwnode_graph_get_endpoint_count().Signed-off-by Sakari Ailus <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>
With 06/16 squashed into this,
Quoted 58 lines
--- drivers/base/property.c | 10 ++-------- include/linux/property.h | 8 +------- 2 files changed, 3 insertions(+), 15 deletions(-)drivers/base/property.c +2
-8@@ -1291,21 +1291,15 @@ EXPORT_SYMBOL_GPL(fwnode_graph_get_endpoint_by_id);/** * fwnode_graph_get_endpoint_count - Count endpoints on a device node * @fwnode: The node related to a device -* @flags: fwnode lookup flags * Count endpoints in a device node. -* -* If FWNODE_GRAPH_DEVICE_DISABLED flag is specified, also unconnected endpoints -* and endpoints connected to disabled devices are counted. */ -unsigned int fwnode_graph_get_endpoint_count (const struct fwnode_handle *fwnode, -unsigned long flags) +unsigned int fwnode_graph_get_endpoint_count (const struct fwnode_handle *fwnode) {struct fwnode_handle *ep;unsigned int count =0 ;fwnode_graph_for_each_endpoint (fwnode, ep) { -if (flags &FWNODE_GRAPH_DEVICE_DISABLED || -fwnode_graph_remote_available (ep)) +if (fwnode_graph_remote_available (ep)) count++; }include/linux/property.h +1
-7@@ -503,19 +503,13 @@ static inline bool fwnode_graph_is_endpoint(const struct fwnode_handle *fwnode)* @FWNODE_GRAPH_ENDPOINT_NEXT: In the case of no exact match, look for the * closest endpoint ID greater than the specified * one. -* @FWNODE_GRAPH_DEVICE_DISABLED: That the device to which the remote -* endpoint of the given endpoint belongs to, -* may be disabled, or that the endpoint is not -* connected. */ #define FWNODE_GRAPH_ENDPOINT_NEXT BIT(0) -#define FWNODE_GRAPH_DEVICE_DISABLED BIT(1)struct fwnode_handle *fwnode_graph_get_endpoint_by_id (const struct fwnode_handle *fwnode,u32 port,u32 endpoint,unsigned long flags); -unsigned int fwnode_graph_get_endpoint_count (const struct fwnode_handle *fwnode, -unsigned long flags); +unsigned int fwnode_graph_get_endpoint_count (const struct fwnode_handle *fwnode);#define fwnode_graph_for_each_endpoint (fwnode, child) \ for (child = fwnode_graph_get_next_endpoint(fwnode, NULL); child; \
Signature · 3 lines
Regards, Laurent Pinchart
Jonathan Cameron
Reviewed-byRe: [PATCH v2 07/16] property: Drop DEVICE_DISABLED flag in fwnode_graph_get_endpoint_count()
Quoted 11 lines · On Wed, 24 Sep 2025 13:00:40 +0300 Laurent Pinchart…
Quoted 5 lines · Sakari Ailus
FWNODE_GRAPH_DEVICE_DISABLEDflag isn't used anywhere, drop the flag and support for it infwnode_graph_get_endpoint_count().Signed-off-by Sakari Ailus <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>With 06/16 squashed into this,
Reviewed-by Laurent Pinchart <[email protected]>
Agreed, doing them together makes the flag disappear so we don't have to check manually that there are indeed no uses of it with the functions you modify in patch 6.
With that,LGTM
Sakari Ailus
reviewerPATCH v2 8/16 property: Document that fwnode API returns available nodes
In reply to Sakari AilusThe fwnode API has historically provided two functions to iterate over a fwnode's child nodes, fwnode_get_next_child_node() and fwnode_get_next_available_child_node() whereas all of the fwnode API has always worked on available nodes, apart unavailable ACPI child device nodes could have been returned by fwnode_get_next_child_node().
Now that the availability check has been added to ACPI side as well, document that the functions in the fwnode API return available nodes.
--- drivers/base/property.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/base/property.c +6 -6
@@ -785,7 +785,7 @@ struct fwnode_handle *fwnode_get_nth_parent(struct fwnode_handle *fwnode,EXPORT_SYMBOL_GPL (fwnode_get_nth_parent);/** -* fwnode_get_next_child_node - Return the next child node handle for a node +* fwnode_get_next_child_node - Return the next available child node handle * @fwnode: Firmware node to find the next child node for. * @child: Handle to one of the node's child nodes or a %NULL handle. *
@@ -830,7 +830,7 @@ fwnode_get_next_available_child_node(const struct fwnode_handle *fwnode,EXPORT_SYMBOL_GPL (fwnode_get_next_available_child_node);/** -* device_get_next_child_node - Return the next child node handle for a device +* device_get_next_child_node - Return the next available child node handle for a device * @dev: Device to find the next child node for. * @child: Handle to one of the device's child nodes or a %NULL handle. *
@@ -858,7 +858,7 @@ struct fwnode_handle *device_get_next_child_node(const struct device *dev,EXPORT_SYMBOL_GPL (device_get_next_child_node);/** -* fwnode_get_named_child_node - Return first matching named child node handle +* fwnode_get_named_child_node - Return first available matching named child node handle * @fwnode: Firmware node to find the named child node for. * @childname: String to match child node name against. *
@@ -874,7 +874,7 @@ fwnode_get_named_child_node(const struct fwnode_handle *fwnode,EXPORT_SYMBOL_GPL (fwnode_get_named_child_node);/** -* device_get_named_child_node - Return first matching named child node handle +* device_get_named_child_node - Return first available matching named child node handle for a device * @dev: Device to find the named child node for. * @childname: String to match child node name against. *
@@ -928,7 +928,7 @@ bool fwnode_device_is_available(const struct fwnode_handle *fwnode)EXPORT_SYMBOL_GPL (fwnode_device_is_available);/** -* fwnode_get_child_node_count - return the number of child nodes for a given firmware node +* fwnode_get_child_node_count - Return the number of available child nodes for a given firmware node * @fwnode: Pointer to the parent firmware node * * Return: the number of child nodes for a given firmware node.
@@ -946,7 +946,7 @@ unsigned int fwnode_get_child_node_count(const struct fwnode_handle *fwnode)EXPORT_SYMBOL_GPL (fwnode_get_child_node_count);/** -* fwnode_get_named_child_node_count - number of child nodes with given name +* fwnode_get_named_child_node_count - Return the number of available child nodes with given name * @fwnode: Node which child nodes are counted. * @name: String to match child node name against. *
Signature · 1 line
2.47.3
Re: [PATCH v2 08/16] property: Document that fwnode API returns available nodes
Hi Sakari,
Quoted 29 lines · Sakari Ailus
The fwnode API has historically provided two functions to iterate over a fwnode's child nodes,
fwnode_get_next_child_node()andfwnode_get_next_available_child_node()whereas all of the fwnode API has always worked on available nodes, apart unavailable ACPI child device nodes could have been returned byfwnode_get_next_child_node().Now that the availability check has been added to ACPI side as well, document that the functions in the fwnode API return available nodes.
Signed-off-by Sakari Ailus <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>--- drivers/base/property.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/base/property.c +1
-1@@ -785,7 +785,7 @@ struct fwnode_handle *fwnode_get_nth_parent(struct fwnode_handle *fwnode,EXPORT_SYMBOL_GPL (fwnode_get_nth_parent);/** -* fwnode_get_next_child_node - Return the next child node handle for a node +* fwnode_get_next_child_node - Return the next available child node handle * @fwnode: Firmware node to find the next child node for. * @child: Handle to one of the node's child nodes or a %NULL handle. *
drivers/base/property.c fwnode_get_next_available_child_node(const struct fwnode_handle *fwnode, · line 833
Quoted 5 lines
drivers/base/property.c +1
-1@@ -830,7 +830,7 @@ fwnode_get_next_available_child_node(const struct fwnode_handle *fwnode,EXPORT_SYMBOL_GPL (fwnode_get_next_available_child_node);/** -* device_get_next_child_node - Return the next child node handle for a device +* device_get_next_child_node - Return the next available child node handle for a device
You may want to drop "for a device" at the end of the line, it seems you've made that change in 15/16 instead of here.
Quoted 39 lines
drivers/base/property.c +4
-4* @dev: Device to find the next child node for. * @child: Handle to one of the device's child nodes or a %NULL handle. * @@ -858,7 +858,7 @@ struct fwnode_handle *device_get_next_child_node(const struct device *dev,EXPORT_SYMBOL_GPL (device_get_next_child_node);/** -* fwnode_get_named_child_node - Return first matching named child node handle +* fwnode_get_named_child_node - Return first available matching named child node handle * @fwnode: Firmware node to find the named child node for. * @childname: String to match child node name against. * @@ -874,7 +874,7 @@ fwnode_get_named_child_node(const struct fwnode_handle *fwnode,EXPORT_SYMBOL_GPL (fwnode_get_named_child_node);/** -* device_get_named_child_node - Return first matching named child node handle +* device_get_named_child_node - Return first available matching named child node handle for a device * @dev: Device to find the named child node for. * @childname: String to match child node name against. * @@ -928,7 +928,7 @@ bool fwnode_device_is_available(const struct fwnode_handle *fwnode)EXPORT_SYMBOL_GPL (fwnode_device_is_available);/** -* fwnode_get_child_node_count - return the number of child nodes for a given firmware node +* fwnode_get_child_node_count - Return the number of available child nodes for a given firmware node * @fwnode: Pointer to the parent firmware node * * Return: the number of child nodes for a given firmware node. @@ -946,7 +946,7 @@ unsigned int fwnode_get_child_node_count(const struct fwnode_handle *fwnode)EXPORT_SYMBOL_GPL (fwnode_get_child_node_count);/** -* fwnode_get_named_child_node_count - number of child nodes with given name +* fwnode_get_named_child_node_count - Return the number of available child nodes with given name * @fwnode: Node which child nodes are counted. * @name: String to match child node name against. *
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v2 08/16] property: Document that fwnode API returns available nodes
In reply to Sakari AilusQuoted 11 lines · On Wed, 24 Sep 2025 10:45:54 +0300 Sakari Ailus <[email protected]>…
The fwnode API has historically provided two functions to iterate over a fwnode's child nodes,
fwnode_get_next_child_node()andfwnode_get_next_available_child_node()whereas all of the fwnode API has always worked on available nodes, apart unavailable ACPI child device nodes could have been returned byfwnode_get_next_child_node().Now that the availability check has been added to ACPI side as well, document that the functions in the fwnode API return available nodes.
Signed-off-by Sakari Ailus <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>
Sakari Ailus
reviewerPATCH v2 9/16 driver core: Use fwnode_for_each_child_node() instead
In reply to Sakari Ailusfwnode_for_each_child_node() is now the same as fwnode_for_each_available_child_node() on all backends (OF, ACPI and swnode). In order to remove the available variants, switch the uses to non-available variants.
--- drivers/base/core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/base/core.c +5 -5
@@ -185,7 +185,7 @@ void fw_devlink_purge_absent_suppliers(struct fwnode_handle *fwnode) fwnode->flags |=FWNODE_FLAG_NOT_DEVICE ;fwnode_links_purge_consumers (fwnode); -fwnode_for_each_available_child_node (fwnode, child) +fwnode_for_each_child_node (fwnode, child)fw_devlink_purge_absent_suppliers (child); }EXPORT_SYMBOL_GPL (fw_devlink_purge_absent_suppliers);
@@ -231,7 +231,7 @@ static void __fw_devlink_pickup_dangling_consumers(struct fwnode_handle *fwnode, fwnode->flags |=FWNODE_FLAG_NOT_DEVICE ;__fwnode_links_move_consumers (fwnode, new_sup); -fwnode_for_each_available_child_node (fwnode, child) +fwnode_for_each_child_node (fwnode, child)__fw_devlink_pickup_dangling_consumers (child, new_sup); }
@@ -1318,7 +1318,7 @@ void device_links_driver_bound(struct device *dev)guard (mutex)(&fwnode_link_lock); -fwnode_for_each_available_child_node (dev->fwnode, child) +fwnode_for_each_child_node (dev->fwnode, child)__fw_devlink_pickup_dangling_consumers (child, dev->fwnode);__fw_devlink_link_to_consumers (dev);
@@ -1736,7 +1736,7 @@ static void fw_devlink_parse_fwtree(struct fwnode_handle *fwnode)fw_devlink_parse_fwnode (fwnode); -while ((child =fwnode_get_next_available_child_node (fwnode, child))) +while ((child =fwnode_get_next_child_node (fwnode, child)))fw_devlink_parse_fwtree (child); }
@@ -2309,7 +2309,7 @@ static void __fw_devlink_link_to_suppliers(struct device *dev,* case where the supplier is added before the consumer's parent device * (@dev). */ -while ((child =fwnode_get_next_available_child_node (fwnode, child))) +while ((child =fwnode_get_next_child_node (fwnode, child)))__fw_devlink_link_to_suppliers (dev, child); }
Signature · 1 line
2.47.3
Re: [PATCH v2 09/16] driver core: Use fwnode_for_each_child_node() instead
Quoted 7 lines · Sakari Ailus
fwnode_for_each_child_node()is now the same asfwnode_for_each_available_child_node()on all backends (OF, ACPI and swnode). In order to remove the available variants, switch the uses to non-available variants.Signed-off-by Sakari Ailus <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>
Quoted 53 lines
--- drivers/base/core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/base/core.c +5
-5@@ -185,7 +185,7 @@ void fw_devlink_purge_absent_suppliers(struct fwnode_handle *fwnode) fwnode->flags |=FWNODE_FLAG_NOT_DEVICE ;fwnode_links_purge_consumers (fwnode); -fwnode_for_each_available_child_node (fwnode, child) +fwnode_for_each_child_node (fwnode, child)fw_devlink_purge_absent_suppliers (child); }EXPORT_SYMBOL_GPL (fw_devlink_purge_absent_suppliers);@@ -231,7 +231,7 @@ static void __fw_devlink_pickup_dangling_consumers(struct fwnode_handle *fwnode, fwnode->flags |=FWNODE_FLAG_NOT_DEVICE ;__fwnode_links_move_consumers (fwnode, new_sup); -fwnode_for_each_available_child_node (fwnode, child) +fwnode_for_each_child_node (fwnode, child)__fw_devlink_pickup_dangling_consumers (child, new_sup); }@@ -1318,7 +1318,7 @@ void device_links_driver_bound(struct device *dev)guard (mutex)(&fwnode_link_lock); -fwnode_for_each_available_child_node (dev->fwnode, child) +fwnode_for_each_child_node (dev->fwnode, child)__fw_devlink_pickup_dangling_consumers (child, dev->fwnode);__fw_devlink_link_to_consumers (dev);@@ -1736,7 +1736,7 @@ static void fw_devlink_parse_fwtree(struct fwnode_handle *fwnode)fw_devlink_parse_fwnode (fwnode); -while ((child =fwnode_get_next_available_child_node (fwnode, child))) +while ((child =fwnode_get_next_child_node (fwnode, child)))fw_devlink_parse_fwtree (child); }@@ -2309,7 +2309,7 @@ static void __fw_devlink_link_to_suppliers(struct device *dev,* case where the supplier is added before the consumer's parent device * (@dev). */ -while ((child =fwnode_get_next_available_child_node (fwnode, child))) +while ((child =fwnode_get_next_child_node (fwnode, child)))__fw_devlink_link_to_suppliers (dev, child); }
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v2 09/16] driver core: Use fwnode_for_each_child_node() instead
In reply to Sakari AilusQuoted 7 lines · On Wed, 24 Sep 2025 10:45:55 +0300 Sakari Ailus <[email protected]>…
fwnode_for_each_child_node()is now the same asfwnode_for_each_available_child_node()on all backends (OF, ACPI and swnode). In order to remove the available variants, switch the uses to non-available variants.Signed-off-by Sakari Ailus <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>
Sakari Ailus
reviewerPATCH v2 10/16 net: lan966x: Use fwnode_for_each_child_node() instead
In reply to Sakari Ailusfwnode_for_each_child_node() is now the same as fwnode_for_each_available_child_node() on all backends (OF, ACPI and swnode). In order to remove the available variants, switch the uses to non-available variants.
--- drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/microchip/lan966x/lan966x_main.c +1 -1
@@ -1190,7 +1190,7 @@ static int lan966x_probe(struct platform_device *pdev)lan966x_stats_init (lan966x);/* go over the child nodes */ -fwnode_for_each_available_child_node (ports, portnp) { +fwnode_for_each_child_node (ports, portnp) {phy_interface_t phy_mode;struct phy *serdes;u32 p;
Signature · 1 line
2.47.3
Re: [PATCH v2 10/16] net: lan966x: Use fwnode_for_each_child_node() instead
Quoted 6 lines · Sakari Ailus
fwnode_for_each_child_node()is now the same asfwnode_for_each_available_child_node()on all backends (OF, ACPI and swnode). In order to remove the available variants, switch the uses to non-available variants.Signed-off-by Sakari Ailus <[email protected]>
Quoted 17 lines
--- drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/microchip/lan966x/lan966x_main.c +1
-1@@ -1190,7 +1190,7 @@ static int lan966x_probe(struct platform_device *pdev)lan966x_stats_init (lan966x);/* go over the child nodes */ -fwnode_for_each_available_child_node (ports, portnp) { +fwnode_for_each_child_node (ports, portnp) {phy_interface_t phy_mode;struct phy *serdes;u32 p;
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v2 10/16] net: lan966x: Use fwnode_for_each_child_node() instead
In reply to Sakari AilusQuoted 6 lines · On Wed, 24 Sep 2025 10:45:56 +0300 Sakari Ailus <[email protected]>…
fwnode_for_each_child_node()is now the same asfwnode_for_each_available_child_node()on all backends (OF, ACPI and swnode). In order to remove the available variants, switch the uses to non-available variants.Signed-off-by Sakari Ailus <[email protected]>
FWIW given mechanical change
Sakari Ailus
reviewerPATCH v2 11/16 Input: touch-overlay - Use fwnode_for_each_child_node() instead
In reply to Sakari Ailusfwnode_for_each_child_node() is now the same as fwnode_for_each_available_child_node() on all backends (OF, ACPI and swnode). In order to remove the available variants, switch the uses to non-available variants.
--- drivers/input/touch-overlay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/touch-overlay.c +1 -1
@@ -82,7 +82,7 @@ int touch_overlay_map(struct list_head *list, struct input_dev *input)if (!overlay)return 0 ; -fwnode_for_each_available_child_node (overlay, fw_segment) { +fwnode_for_each_child_node (overlay, fw_segment) { segment =devm_kzalloc (dev,sizeof (*segment),GFP_KERNEL );if (!segment) {fwnode_handle_put (fw_segment);
Signature · 1 line
2.47.3
Re: [PATCH v2 11/16] Input: touch-overlay - Use fwnode_for_each_child_node() instead
Quoted 6 lines · Sakari Ailus
fwnode_for_each_child_node()is now the same asfwnode_for_each_available_child_node()on all backends (OF, ACPI and swnode). In order to remove the available variants, switch the uses to non-available variants.Signed-off-by Sakari Ailus <[email protected]>
Quoted 17 lines
--- drivers/input/touch-overlay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/input/touch-overlay.c +1
-1@@ -82,7 +82,7 @@ int touch_overlay_map(struct list_head *list, struct input_dev *input)if (!overlay)return 0 ; -fwnode_for_each_available_child_node (overlay, fw_segment) { +fwnode_for_each_child_node (overlay, fw_segment) { segment =devm_kzalloc (dev,sizeof (*segment),GFP_KERNEL );if (!segment) {fwnode_handle_put (fw_segment);
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v2 11/16] Input: touch-overlay - Use fwnode_for_each_child_node() instead
In reply to Sakari AilusQuoted 6 lines · Sakari Ailus
fwnode_for_each_child_node()is now the same asfwnode_for_each_available_child_node()on all backends (OF, ACPI and swnode). In order to remove the available variants, switch the uses to non-available variants.Signed-off-by Sakari Ailus <[email protected]>
Quoted 17 lines
--- drivers/input/touch-overlay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/input/touch-overlay.c +1
-1@@ -82,7 +82,7 @@ int touch_overlay_map(struct list_head *list, struct input_dev *input)if (!overlay)return 0 ; -fwnode_for_each_available_child_node (overlay, fw_segment) { +fwnode_for_each_child_node (overlay, fw_segment) { segment =devm_kzalloc (dev,sizeof (*segment),GFP_KERNEL );if (!segment) {fwnode_handle_put (fw_segment);
Signature · 1 line
Dmitry
Re: [PATCH v2 11/16] Input: touch-overlay - Use fwnode_for_each_child_node() instead
In reply to Sakari AilusQuoted 6 lines · On Wed, 24 Sep 2025 10:45:57 +0300 Sakari Ailus <[email protected]>…
fwnode_for_each_child_node()is now the same asfwnode_for_each_available_child_node()on all backends (OF, ACPI and swnode). In order to remove the available variants, switch the uses to non-available variants.Signed-off-by Sakari Ailus <[email protected]>
Another mechanical change.
Quoted 17 lines
--- drivers/input/touch-overlay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/input/touch-overlay.c +1
-1@@ -82,7 +82,7 @@ int touch_overlay_map(struct list_head *list, struct input_dev *input)if (!overlay)return 0 ; -fwnode_for_each_available_child_node (overlay, fw_segment) { +fwnode_for_each_child_node (overlay, fw_segment) { segment =devm_kzalloc (dev,sizeof (*segment),GFP_KERNEL );if (!segment) {fwnode_handle_put (fw_segment);
Sakari Ailus
reviewerPATCH v2 12/16 media: thp7312: Use fwnode_for_each_child_node() instead
In reply to Sakari Ailusfwnode_for_each_child_node() is now the same as fwnode_for_each_available_child_node() on all backends (OF, ACPI and swnode). In order to remove the available variants, switch the uses to non-available variants.
--- drivers/media/i2c/thp7312.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/thp7312.c +1 -1
@@ -2064,7 +2064,7 @@ static int thp7312_parse_dt(struct thp7312_device *thp7312)return -EINVAL ; } -fwnode_for_each_available_child_node (sensors, node) { +fwnode_for_each_child_node (sensors, node) {if (fwnode_name_eq (node,"sensor" )) {if (!thp7312_sensor_parse_dt (thp7312, node)) num_sensors++;
Signature · 1 line
2.47.3
Re: [PATCH v2 12/16] media: thp7312: Use fwnode_for_each_child_node() instead
Quoted 6 lines · Sakari Ailus
fwnode_for_each_child_node()is now the same asfwnode_for_each_available_child_node()on all backends (OF, ACPI and swnode). In order to remove the available variants, switch the uses to non-available variants.Signed-off-by Sakari Ailus <[email protected]>
Quoted 17 lines
--- drivers/media/i2c/thp7312.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/i2c/thp7312.c +1
-1@@ -2064,7 +2064,7 @@ static int thp7312_parse_dt(struct thp7312_device *thp7312)return -EINVAL ; } -fwnode_for_each_available_child_node (sensors, node) { +fwnode_for_each_child_node (sensors, node) {if (fwnode_name_eq (node,"sensor" )) {if (!thp7312_sensor_parse_dt (thp7312, node)) num_sensors++;
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v2 12/16] media: thp7312: Use fwnode_for_each_child_node() instead
In reply to Sakari AilusQuoting Sakari Ailus (2025-09-24 16:45:58)
Quoted 6 lines
fwnode_for_each_child_node()is now the same asfwnode_for_each_available_child_node()on all backends (OF, ACPI and swnode). In order to remove the available variants, switch the uses to non-available variants.Signed-off-by Sakari Ailus <[email protected]>
Quoted 20 lines
--- drivers/media/i2c/thp7312.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/i2c/thp7312.c +1
-1@@ -2064,7 +2064,7 @@ static int thp7312_parse_dt(struct thp7312_device *thp7312)return -EINVAL ; } -fwnode_for_each_available_child_node (sensors, node) { +fwnode_for_each_child_node (sensors, node) {if (fwnode_name_eq (node,"sensor" )) {if (!thp7312_sensor_parse_dt (thp7312, node)) num_sensors++;Signature · 1 line
2.47.3
Re: [PATCH v2 12/16] media: thp7312: Use fwnode_for_each_child_node() instead
In reply to Sakari AilusQuoted 6 lines · On Wed, 24 Sep 2025 10:45:58 +0300 Sakari Ailus <[email protected]>…
fwnode_for_each_child_node()is now the same asfwnode_for_each_available_child_node()on all backends (OF, ACPI and swnode). In order to remove the available variants, switch the uses to non-available variants.Signed-off-by Sakari Ailus <[email protected]>
Sakari Ailus
reviewerPATCH v2 13/16 leds: Use fwnode_for_each_child_node() instead
In reply to Sakari Ailusfwnode_for_each_child_node() is now the same as fwnode_for_each_available_child_node() on all backends (OF, ACPI and swnode). In order to remove the available variants, switch the uses to non-available variants.
--- drivers/leds/leds-max5970.c | 2 +- drivers/leds/leds-max77705.c | 2 +- drivers/leds/rgb/leds-ktd202x.c | 4 ++-- drivers/leds/rgb/leds-ncp5623.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
drivers/leds/leds-max5970.c +1 -1
@@ -60,7 +60,7 @@ static int max5970_led_probe(struct platform_device *pdev)if (!led_node)return -ENODEV ; -fwnode_for_each_available_child_node (led_node, child) { +fwnode_for_each_child_node (led_node, child) {u32 reg;if (fwnode_property_read_u32 (child,"reg" , ®))
drivers/leds/leds-max77705.c +1 -1
@@ -191,7 +191,7 @@ static int max77705_add_led(struct device *dev, struct regmap *regmap, struct fw cdev->brightness_set_blocking = max77705_led_brightness_set_multi; cdev->blink_set = max77705_rgb_blink; -fwnode_for_each_available_child_node (np, child) { +fwnode_for_each_child_node (np, child) { ret =max77705_parse_subled (dev, child, &info[i]);if (ret <0 )return ret;
drivers/leds/rgb/leds-ktd202x.c +2 -2
@@ -391,7 +391,7 @@ static int ktd202x_setup_led_rgb(struct ktd202x *chip, struct fwnode_handle *fwnint i =0 ; num_channels =0 ; -fwnode_for_each_available_child_node (fwnode, child) +fwnode_for_each_child_node (fwnode, child) num_channels++;if (!num_channels || num_channels > chip->num_leds)
@@ -401,7 +401,7 @@ static int ktd202x_setup_led_rgb(struct ktd202x *chip, struct fwnode_handle *fwnif (!info)return -ENOMEM ; -fwnode_for_each_available_child_node (fwnode, child) { +fwnode_for_each_child_node (fwnode, child) {u32 mono_color;u32 reg;int ret;
drivers/leds/rgb/leds-ncp5623.c +1 -1
@@ -180,7 +180,7 @@ static int ncp5623_probe(struct i2c_client *client) goto release_mc_node; } -fwnode_for_each_available_child_node (mc_node, led_node) { +fwnode_for_each_child_node (mc_node, led_node) { ret =fwnode_property_read_u32 (led_node,"color" , &color_index);if (ret) goto release_led_node;
Signature · 1 line
2.47.3
Re: [PATCH v2 13/16] leds: Use fwnode_for_each_child_node() instead
Quoted 6 lines · Sakari Ailus
fwnode_for_each_child_node()is now the same asfwnode_for_each_available_child_node()on all backends (OF, ACPI and swnode). In order to remove the available variants, switch the uses to non-available variants.Signed-off-by Sakari Ailus <[email protected]>
Quoted 68 lines
--- drivers/leds/leds-max5970.c | 2 +- drivers/leds/leds-max77705.c | 2 +- drivers/leds/rgb/leds-ktd202x.c | 4 ++-- drivers/leds/rgb/leds-ncp5623.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)drivers/leds/leds-max5970.c +1
-1@@ -60,7 +60,7 @@ static int max5970_led_probe(struct platform_device *pdev)if (!led_node)return -ENODEV ; -fwnode_for_each_available_child_node (led_node, child) { +fwnode_for_each_child_node (led_node, child) {u32 reg;if (fwnode_property_read_u32 (child,"reg" , ®))drivers/leds/leds-max77705.c +1
-1@@ -191,7 +191,7 @@ static int max77705_add_led(struct device *dev, struct regmap *regmap, struct fw cdev->brightness_set_blocking = max77705_led_brightness_set_multi; cdev->blink_set = max77705_rgb_blink; -fwnode_for_each_available_child_node (np, child) { +fwnode_for_each_child_node (np, child) { ret =max77705_parse_subled (dev, child, &info[i]);if (ret <0 )return ret;drivers/leds/rgb/leds-ktd202x.c +2
-2@@ -391,7 +391,7 @@ static int ktd202x_setup_led_rgb(struct ktd202x *chip, struct fwnode_handle *fwnint i =0 ; num_channels =0 ; -fwnode_for_each_available_child_node (fwnode, child) +fwnode_for_each_child_node (fwnode, child) num_channels++;if (!num_channels || num_channels > chip->num_leds)@@ -401,7 +401,7 @@ static int ktd202x_setup_led_rgb(struct ktd202x *chip, struct fwnode_handle *fwnif (!info)return -ENOMEM ; -fwnode_for_each_available_child_node (fwnode, child) { +fwnode_for_each_child_node (fwnode, child) {u32 mono_color;u32 reg;int ret;drivers/leds/rgb/leds-ncp5623.c +1
-1@@ -180,7 +180,7 @@ static int ncp5623_probe(struct i2c_client *client) goto release_mc_node; } -fwnode_for_each_available_child_node (mc_node, led_node) { +fwnode_for_each_child_node (mc_node, led_node) { ret =fwnode_property_read_u32 (led_node,"color" , &color_index);if (ret) goto release_led_node;
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v2 13/16] leds: Use fwnode_for_each_child_node() instead
In reply to Sakari AilusQuoted 6 lines · On Wed, 24 Sep 2025 10:45:59 +0300 Sakari Ailus <[email protected]>…
fwnode_for_each_child_node()is now the same asfwnode_for_each_available_child_node()on all backends (OF, ACPI and swnode). In order to remove the available variants, switch the uses to non-available variants.Signed-off-by Sakari Ailus <[email protected]>
Sakari Ailus
reviewerPATCH v2 14/16 leds: Use fwnode_get_next_child_node() instead
In reply to Sakari Ailusfwnode_get_next_child_node() is now the same as fwnode_get_next_available_child_node() on all backends (OF, ACPI and swnode). In order to remove the available variants, switch the uses to non-available variants (device_get_next_child_node() in this case).
--- drivers/leds/flash/leds-rt4505.c | 2 +- drivers/leds/flash/leds-rt8515.c | 2 +- drivers/leds/flash/leds-sgm3140.c | 3 +-- drivers/leds/flash/leds-tps6131x.c | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-)
drivers/leds/flash/leds-rt4505.c +1 -1
@@ -365,7 +365,7 @@ static int rt4505_probe(struct i2c_client *client)return ret; } - child =fwnode_get_next_available_child_node (client->dev.fwnode,NULL ); + child =device_get_next_child_node (&client->dev,NULL );if (!child) {dev_err (priv->dev,"Failed to get child node\n" );return -EINVAL ;
drivers/leds/flash/leds-rt8515.c +1 -1
@@ -304,7 +304,7 @@ static int rt8515_probe(struct platform_device *pdev)return dev_err_probe (dev,PTR_ERR (rt->enable_torch),"cannot get ENT (enable torch) GPIO\n" ); - child =fwnode_get_next_available_child_node (dev->fwnode,NULL ); + child =device_get_next_child_node (dev,NULL );if (!child) {dev_err (dev,"No fwnode child node found for connected LED.\n" );
drivers/leds/flash/leds-sgm3140.c +1 -2
@@ -214,8 +214,7 @@ static int sgm3140_probe(struct platform_device *pdev)return dev_err_probe (&pdev->dev, ret,"Failed to request regulator\n" ); - child_node =fwnode_get_next_available_child_node (pdev->dev.fwnode, -NULL ); + child_node =device_get_next_child_node (&pdev->dev,NULL );if (!child_node) {dev_err (&pdev->dev,"No fwnode child node found for connected LED.\n" );
drivers/leds/flash/leds-tps6131x.c +1 -1
@@ -544,7 +544,7 @@ static int tps6131x_parse_node(struct tps6131x *tps6131x) tps6131x->valley_current_limit =device_property_read_bool (dev,"ti,valley-current-limit" ); - tps6131x->led_node =fwnode_get_next_available_child_node (dev->fwnode,NULL ); + tps6131x->led_node =device_get_next_child_node (dev,NULL );if (!tps6131x->led_node) {dev_err (dev,"Missing LED node\n" );return -EINVAL ;
Signature · 1 line
2.47.3
Re: [PATCH v2 14/16] leds: Use fwnode_get_next_child_node() instead
Quoted 6 lines · Sakari Ailus
fwnode_get_next_child_node()is now the same asfwnode_get_next_available_child_node()on all backends (OF, ACPI and swnode). In order to remove the available variants, switch the uses to non-available variants (device_get_next_child_node()in this case).Signed-off-by Sakari Ailus <[email protected]>
Quoted 60 lines
--- drivers/leds/flash/leds-rt4505.c | 2 +- drivers/leds/flash/leds-rt8515.c | 2 +- drivers/leds/flash/leds-sgm3140.c | 3 +-- drivers/leds/flash/leds-tps6131x.c | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-)drivers/leds/flash/leds-rt4505.c +1
-1@@ -365,7 +365,7 @@ static int rt4505_probe(struct i2c_client *client)return ret; } - child =fwnode_get_next_available_child_node (client->dev.fwnode,NULL ); + child =device_get_next_child_node (&client->dev,NULL );if (!child) {dev_err (priv->dev,"Failed to get child node\n" );return -EINVAL ;drivers/leds/flash/leds-rt8515.c +1
-1@@ -304,7 +304,7 @@ static int rt8515_probe(struct platform_device *pdev)return dev_err_probe (dev,PTR_ERR (rt->enable_torch),"cannot get ENT (enable torch) GPIO\n" ); - child =fwnode_get_next_available_child_node (dev->fwnode,NULL ); + child =device_get_next_child_node (dev,NULL );if (!child) {dev_err (dev,"No fwnode child node found for connected LED.\n" );drivers/leds/flash/leds-sgm3140.c +1
-2@@ -214,8 +214,7 @@ static int sgm3140_probe(struct platform_device *pdev)return dev_err_probe (&pdev->dev, ret,"Failed to request regulator\n" ); - child_node =fwnode_get_next_available_child_node (pdev->dev.fwnode, -NULL ); + child_node =device_get_next_child_node (&pdev->dev,NULL );if (!child_node) {dev_err (&pdev->dev,"No fwnode child node found for connected LED.\n" );drivers/leds/flash/leds-tps6131x.c +1
-1@@ -544,7 +544,7 @@ static int tps6131x_parse_node(struct tps6131x *tps6131x) tps6131x->valley_current_limit =device_property_read_bool (dev,"ti,valley-current-limit" ); - tps6131x->led_node =fwnode_get_next_available_child_node (dev->fwnode,NULL ); + tps6131x->led_node =device_get_next_child_node (dev,NULL );if (!tps6131x->led_node) {dev_err (dev,"Missing LED node\n" );return -EINVAL ;
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v2 14/16] leds: Use fwnode_get_next_child_node() instead
In reply to Sakari AilusQuoted 6 lines · On Wed, 24 Sep 2025 10:46:00 +0300 Sakari Ailus <[email protected]>…
fwnode_get_next_child_node()is now the same asfwnode_get_next_available_child_node()on all backends (OF, ACPI and swnode). In order to remove the available variants, switch the uses to non-available variants (device_get_next_child_node()in this case).Signed-off-by Sakari Ailus <[email protected]>
Sakari Ailus
reviewerPATCH v2 15/16 property: Drop functions operating on "available" child nodes
In reply to Sakari Ailusfwnode_get_next_available_child_node() and later fwnode_for_each_available_child_node() were introduced to mirror the OF interface operating on OF nodes. Now that these two are functionally the same as the variants without "_available" part, drop the "_available" variants.
--- drivers/base/property.c | 30 +----------------------------- include/linux/property.h | 6 ------ 2 files changed, 1 insertion(+), 35 deletions(-)
drivers/base/property.c +1 -29
@@ -802,35 +802,7 @@ fwnode_get_next_child_node(const struct fwnode_handle *fwnode,EXPORT_SYMBOL_GPL (fwnode_get_next_child_node);/** -* fwnode_get_next_available_child_node - Return the next available child node handle for a node -* @fwnode: Firmware node to find the next child node for. -* @child: Handle to one of the node's child nodes or a %NULL handle. -* -* The caller is responsible for calling fwnode_handle_put() on the returned -* fwnode pointer. Note that this function also puts a reference to @child -* unconditionally. -*/ -struct fwnode_handle * -fwnode_get_next_available_child_node (const struct fwnode_handle *fwnode, -struct fwnode_handle *child) -{ -struct fwnode_handle *next_child = child; - -if (IS_ERR_OR_NULL (fwnode)) -return NULL ; - -do { - next_child =fwnode_get_next_child_node (fwnode, next_child); -if (!next_child) -return NULL ; - }while (!fwnode_device_is_available (next_child)); - -return next_child; -} -EXPORT_SYMBOL_GPL (fwnode_get_next_available_child_node); - -/** -* device_get_next_child_node - Return the next available child node handle for a device +* device_get_next_child_node - Return the next available child node handle * @dev: Device to find the next child node for. * @child: Handle to one of the device's child nodes or a %NULL handle. *
include/linux/property.h +0 -6
@@ -161,8 +161,6 @@ struct fwnode_handle *fwnode_get_nth_parent(struct fwnode_handle *fwn, unsigned int depth);struct fwnode_handle *fwnode_get_next_child_node (const struct fwnode_handle *fwnode,struct fwnode_handle *child); -struct fwnode_handle *fwnode_get_next_available_child_node ( -const struct fwnode_handle *fwnode,struct fwnode_handle *child);#define fwnode_for_each_child_node (fwnode, child) \ for (child = fwnode_get_next_child_node(fwnode, NULL); child; \
@@ -172,10 +170,6 @@ struct fwnode_handle *fwnode_get_next_available_child_node( fwnode_for_each_child_node(fwnode, child) \for_each_if (fwnode_name_eq(child ,name )) -#define fwnode_for_each_available_child_node (fwnode, child) \ - for (child = fwnode_get_next_available_child_node(fwnode, NULL); child;\ - child = fwnode_get_next_available_child_node(fwnode, child)) - struct fwnode_handle *device_get_next_child_node(const struct device *dev,struct fwnode_handle *child);
Signature · 1 line
2.47.3
Re: [PATCH v2 15/16] property: Drop functions operating on "available" child nodes
Hi Sakari,
Thank you for the patch.
Quoted 40 lines · Sakari Ailus
fwnode_get_next_available_child_node()and laterfwnode_for_each_available_child_node()were introduced to mirror the OF interface operating on OF nodes. Now that these two are functionally the same as the variants without "_available" part, drop the "_available" variants.Signed-off-by Sakari Ailus <[email protected]>--- drivers/base/property.c | 30 +----------------------------- include/linux/property.h | 6 ------ 2 files changed, 1 insertion(+), 35 deletions(-)drivers/base/property.c +0
-20@@ -802,35 +802,7 @@ fwnode_get_next_child_node(const struct fwnode_handle *fwnode,EXPORT_SYMBOL_GPL (fwnode_get_next_child_node);/** -* fwnode_get_next_available_child_node - Return the next available child node handle for a node -* @fwnode: Firmware node to find the next child node for. -* @child: Handle to one of the node's child nodes or a %NULL handle. -* -* The caller is responsible for calling fwnode_handle_put() on the returned -* fwnode pointer. Note that this function also puts a reference to @child -* unconditionally. -*/ -struct fwnode_handle * -fwnode_get_next_available_child_node (const struct fwnode_handle *fwnode, -struct fwnode_handle *child) -{ -struct fwnode_handle *next_child = child; - -if (IS_ERR_OR_NULL (fwnode)) -return NULL ; - - do { - next_child = fwnode_get_next_child_node(fwnode, next_child); - if (!next_child)
drivers/base/property.c fwnode_get_next_child_node(const struct fwnode_handle *fwnode, · line 805
Quoted 10 lines
drivers/base/property.c +1
-9-return NULL ; - }while (!fwnode_device_is_available (next_child)); - -return next_child; -} -EXPORT_SYMBOL_GPL (fwnode_get_next_available_child_node); - -/** -* device_get_next_child_node - Return the next available child node handle for a device +* device_get_next_child_node - Return the next available child node handle
This last line is an unrelated change. With that fixed,
Quoted 27 lines
drivers/base/property.c +0
-0* @dev: Device to find the next child node for. * @child: Handle to one of the device's child nodes or a %NULL handle. * include/linux/property.h +0
-6@@ -161,8 +161,6 @@ struct fwnode_handle *fwnode_get_nth_parent(struct fwnode_handle *fwn, unsigned int depth);struct fwnode_handle *fwnode_get_next_child_node (const struct fwnode_handle *fwnode,struct fwnode_handle *child); -struct fwnode_handle *fwnode_get_next_available_child_node ( -const struct fwnode_handle *fwnode,struct fwnode_handle *child);#define fwnode_for_each_child_node (fwnode, child) \ for (child = fwnode_get_next_child_node(fwnode, NULL); child; \@@ -172,10 +170,6 @@ struct fwnode_handle *fwnode_get_next_available_child_node( fwnode_for_each_child_node(fwnode, child) \for_each_if (fwnode_name_eq(child ,name )) -#define fwnode_for_each_available_child_node (fwnode, child) \ - for (child = fwnode_get_next_available_child_node(fwnode, NULL); child;\ - child = fwnode_get_next_available_child_node(fwnode, child)) - struct fwnode_handle *device_get_next_child_node(const struct device *dev,struct fwnode_handle *child);
Signature · 3 lines
Regards, Laurent Pinchart
Jonathan Cameron
Reviewed-byRe: [PATCH v2 15/16] property: Drop functions operating on "available" child nodes
Quoted 8 lines
Quoted 4 lines
-/**
- *device_get_next_child_node- Return the next available child node handle for a device
+ *device_get_next_child_node- Return the next available child node handleThis last line is an unrelated change. With that fixed,
Reviewed-by Laurent Pinchart <[email protected]>
I'll assume you'll tidy that up.
Very pleased to see this go, simply for the saving in time explaining the odd difference to people in driver reviews!
Sakari Ailus
reviewerPATCH v2 16/16 spi: cadence: Remove explicit device node availability check
In reply to Sakari AilusDon't check the availability of child device nodes explicitly as this is now embedded in device_for_each_child_node().
--- drivers/spi/spi-cadence-xspi.c | 3 --- 1 file changed, 3 deletions(-)
drivers/spi/spi-cadence-xspi.c +0 -3
@@ -908,9 +908,6 @@ static int cdns_xspi_of_get_plat_data(struct platform_device *pdev)unsigned int cs;device_for_each_child_node (&pdev->dev, fwnode_child) { -if (!fwnode_device_is_available (fwnode_child)) -continue ; -if (fwnode_property_read_u32 (fwnode_child,"reg" , &cs)) {dev_err (&pdev->dev,"Couldn't get memory chip select\n" );fwnode_handle_put (fwnode_child);
Signature · 1 line
2.47.3
Re: [PATCH v2 16/16] spi: cadence: Remove explicit device node availability check
Quoted 2 lines · Sakari Ailus
Don't check the availability of child device nodes explicitly as this is now embedded in
device_for_each_child_node().
Re: [PATCH v2 16/16] spi: cadence: Remove explicit device node availability check
In reply to Sakari AilusHi Sakari,
Thank you for the patch.
Quoted 4 lines · Sakari Ailus
Don't check the availability of child device nodes explicitly as this is now embedded in
device_for_each_child_node().Signed-off-by Sakari Ailus <[email protected]>
Quoted 18 lines
--- drivers/spi/spi-cadence-xspi.c | 3 --- 1 file changed, 3 deletions(-)drivers/spi/spi-cadence-xspi.c +0
-3@@ -908,9 +908,6 @@ static int cdns_xspi_of_get_plat_data(struct platform_device *pdev)unsigned int cs;device_for_each_child_node (&pdev->dev, fwnode_child) { -if (!fwnode_device_is_available (fwnode_child)) -continue ; -if (fwnode_property_read_u32 (fwnode_child,"reg" , &cs)) {dev_err (&pdev->dev,"Couldn't get memory chip select\n" );fwnode_handle_put (fwnode_child);
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v2 16/16] spi: cadence: Remove explicit device node availability check
In reply to Sakari AilusQuoted 4 lines · On Wed, 24 Sep 2025 10:46:02 +0300 Sakari Ailus <[email protected]>…
Don't check the availability of child device nodes explicitly as this is now embedded in
device_for_each_child_node().Signed-off-by Sakari Ailus <[email protected]>
Quoted 18 lines
--- drivers/spi/spi-cadence-xspi.c | 3 --- 1 file changed, 3 deletions(-)drivers/spi/spi-cadence-xspi.c +0
-3@@ -908,9 +908,6 @@ static int cdns_xspi_of_get_plat_data(struct platform_device *pdev)unsigned int cs;device_for_each_child_node (&pdev->dev, fwnode_child) { -if (!fwnode_device_is_available (fwnode_child)) -continue ; -if (fwnode_property_read_u32 (fwnode_child,"reg" , &cs)) {dev_err (&pdev->dev,"Couldn't get memory chip select\n" );fwnode_handle_put (fwnode_child);
Rafael J. Wysocki
maintainerHi Sakari,
Quoted 33 lines · Sakari Ailus
Hello everyone,
Historically the fwnode property API has enumerated only available device nodes on OF whereas on ACPI, also nodes that haven't been present in the system have been provided. Both OF and ACPI have similar concepts of node availbility, on OF it's the "status" property present on device nodes and on ACPI the
_STAobject evaluates to device present, enabled and functional bits, of which the present and functional bits are currently being used to determine whether to enumerate a device.Two additional functions,
fwnode_get_next_available_child_node()andfwnode_for_each_available_child_node(), have been provided to enumerate the available nodes only on ACPI, whereas on OF the implementation has been the same on the non-available variants. The motivation for providing these has very likely been to provide fwnode variants of the similarly named functions but the difference isn't justifiable from API consistency viewpoint.This set switches the users away from the "available" fwnode API functions and later on removes them, aligning the functionality on all fwnode backends.
since v1:
- Move patch "ACPI: property: Make
acpi_get_next_subnode()static" as first.- Add missing parentheses and kernel-doc Return: section in
acpi_get_next_present_subnode()documentation and move the Return
section: offwnode_graph_get_endpoint_by_id()to the end of the documentation section (new patch for the latter).
Quoted 5 lines
- Use
device_get_next_child_node()instead offwnode_get_next_child_node()in flash LED driver drivers.- Rework iterating port nodes in
acpi_graph_get_next_endpoint()as suggested by Andy (new patch).
I think that you really have four series here, or rather two series, a collection of patches depending on them, and a follow-up cleanup.
Quoted 6 lines
Sakari Ailus (16):
ACPI: property: Makeacpi_get_next_subnode()static
ACPI: property: Use ACPI functions inacpi_graph_get_next_endpoint()
only
ACPI: property: Reworkacpi_graph_get_next_endpoint()
ACPI: property: Return present device nodes only on fwnode interface
So the above is one series, focused on ACPI property changes.
They can go in via ACPI as soon as everyone is happy with them. I think I can push them for 6.18 if that helps to process the other patches.
Quoted 6 lines
property: Move Return: section of
fwnode_graph_get_endpoint_by_id()
down
property: DropDEVICE_DISABLEDflag in
fwnode_graph_get_endpoint_by_id()
property: DropDEVICE_DISABLEDflag in
fwnode_graph_get_endpoint_count()
The above patches are another series that doesn't depend on the first one AFAICS and can go in via driver core.
Quoted 7 lines
property: Document that fwnode API returns available nodes driver core: Use
fwnode_for_each_child_node()instead
net: lan966x: Usefwnode_for_each_child_node()instead
Input: touch-overlay - Usefwnode_for_each_child_node()instead
media: thp7312: Usefwnode_for_each_child_node()instead
leds: Usefwnode_for_each_child_node()instead
leds: Usefwnode_get_next_child_node()instead
The above can go in via respective subsystem trees when the ACPI property series gets in (I'm not sure if/how they depend on the second series).
And the following one is a follow-up cleanup getting rid of code that would be redundant going forward.
Quoted 2 lines
property: Drop functions operating on "available" child nodes
spi: cadence: Remove explicit device node availability check
Does the spi change depend on the previous patch?
Sakari Ailus
reviewerHi Rafael,
Quoted 53 lines · Rafael J. Wysocki
Hi Sakari,
Quoted 33 lines · Sakari Ailus
Hello everyone,
Historically the fwnode property API has enumerated only available device nodes on OF whereas on ACPI, also nodes that haven't been present in the system have been provided. Both OF and ACPI have similar concepts of node availbility, on OF it's the "status" property present on device nodes and on ACPI the
_STAobject evaluates to device present, enabled and functional bits, of which the present and functional bits are currently being used to determine whether to enumerate a device.Two additional functions,
fwnode_get_next_available_child_node()andfwnode_for_each_available_child_node(), have been provided to enumerate the available nodes only on ACPI, whereas on OF the implementation has been the same on the non-available variants. The motivation for providing these has very likely been to provide fwnode variants of the similarly named functions but the difference isn't justifiable from API consistency viewpoint.This set switches the users away from the "available" fwnode API functions and later on removes them, aligning the functionality on all fwnode backends.
since v1:
- Move patch "ACPI: property: Make
acpi_get_next_subnode()static" as first.- Add missing parentheses and kernel-doc Return: section in
acpi_get_next_present_subnode()documentation and move the Return
section: offwnode_graph_get_endpoint_by_id()to the end of the documentation section (new patch for the latter).Quoted 5 lines
- Use
device_get_next_child_node()instead offwnode_get_next_child_node()in flash LED driver drivers.- Rework iterating port nodes in
acpi_graph_get_next_endpoint()as suggested by Andy (new patch).I think that you really have four series here, or rather two series, a collection of patches depending on them, and a follow-up cleanup.
Quoted 6 lines
Sakari Ailus (16):
ACPI: property: Makeacpi_get_next_subnode()static
ACPI: property: Use ACPI functions inacpi_graph_get_next_endpoint()
only
ACPI: property: Reworkacpi_graph_get_next_endpoint()
ACPI: property: Return present device nodes only on fwnode interface
Quoted 5 lines
So the above is one series, focused on ACPI property changes.
They can go in via ACPI as soon as everyone is happy with them. I think I can push them for 6.18 if that helps to process the other patches.
If it's an option, that would be nice. But see below.
Quoted 10 lines
Quoted 7 lines
property: Move Return: section of
fwnode_graph_get_endpoint_by_id()
down
property: DropDEVICE_DISABLEDflag in
fwnode_graph_get_endpoint_by_id()
property: DropDEVICE_DISABLEDflag in
fwnode_graph_get_endpoint_count()The above patches are another series that doesn't depend on the first one AFAICS and can go in via driver core.
Agreed.
Quoted 13 lines
Quoted 8 lines
property: Document that fwnode API returns available nodes driver core: Use
fwnode_for_each_child_node()instead
net: lan966x: Usefwnode_for_each_child_node()instead
Input: touch-overlay - Usefwnode_for_each_child_node()instead
media: thp7312: Usefwnode_for_each_child_node()instead
leds: Usefwnode_for_each_child_node()instead
leds: Usefwnode_get_next_child_node()insteadThe above can go in via respective subsystem trees when the ACPI property series gets in (I'm not sure if/how they depend on the second series).
Quoted 7 lines
And the following one is a follow-up cleanup getting rid of code that would be redundant going forward.
Quoted 2 lines
property: Drop functions operating on "available" child nodes
spi: cadence: Remove explicit device node availability checkDoes the spi change depend on the previous patch?
There's really only one dependency, apart from the direct dependency of fwnode_get_next_available_child_node() / fwnode_for_each_available_child_node() definitions removed in the second last patch: fwnode_get_next_child_node() and fwnode_for_each_child_node() may still return non-available nodes before the last of the ACPI patches in the set. So if the ACPI patches aren't merged but the rest are, non-available nodes could be returned.
How about:
1. Merge the ACPI patches to 6.18.
2. Merge the rest, apart from the second last patch, for 6.19.
3. Once everything else is in, merge the last patch. Could wait for 6.20.
Perhaps I should split the series in three sets?
I'll send an update on the ACPI patches soon, to address a comment related to them.
Signature · 3 lines
Kind regards, Sakari Ailus
Rafael J. Wysocki
maintainerHi Sakari,
Quoted 107 lines · Sakari Ailus
Hi Rafael,
Quoted 53 lines · Rafael J. Wysocki
Hi Sakari,
Quoted 33 lines · Sakari Ailus
Hello everyone,
Historically the fwnode property API has enumerated only available device nodes on OF whereas on ACPI, also nodes that haven't been present in the system have been provided. Both OF and ACPI have similar concepts of node availbility, on OF it's the "status" property present on device nodes and on ACPI the
_STAobject evaluates to device present, enabled and functional bits, of which the present and functional bits are currently being used to determine whether to enumerate a device.Two additional functions,
fwnode_get_next_available_child_node()andfwnode_for_each_available_child_node(), have been provided to enumerate the available nodes only on ACPI, whereas on OF the implementation has been the same on the non-available variants. The motivation for providing these has very likely been to provide fwnode variants of the similarly named functions but the difference isn't justifiable from API consistency viewpoint.This set switches the users away from the "available" fwnode API functions and later on removes them, aligning the functionality on all fwnode backends.
since v1:
- Move patch "ACPI: property: Make
acpi_get_next_subnode()static" as first.- Add missing parentheses and kernel-doc Return: section in
acpi_get_next_present_subnode()documentation and move the Return
section: offwnode_graph_get_endpoint_by_id()to the end of the documentation section (new patch for the latter).Quoted 5 lines
- Use
device_get_next_child_node()instead offwnode_get_next_child_node()in flash LED driver drivers.- Rework iterating port nodes in
acpi_graph_get_next_endpoint()as suggested by Andy (new patch).I think that you really have four series here, or rather two series, a collection of patches depending on them, and a follow-up cleanup.
Quoted 6 lines
Sakari Ailus (16):
ACPI: property: Makeacpi_get_next_subnode()static
ACPI: property: Use ACPI functions inacpi_graph_get_next_endpoint()
only
ACPI: property: Reworkacpi_graph_get_next_endpoint()
ACPI: property: Return present device nodes only on fwnode interfaceQuoted 5 lines
So the above is one series, focused on ACPI property changes.
They can go in via ACPI as soon as everyone is happy with them. I think I can push them for 6.18 if that helps to process the other patches.
If it's an option, that would be nice. But see below.
Quoted 10 lines
Quoted 7 lines
property: Move Return: section of
fwnode_graph_get_endpoint_by_id()
down
property: DropDEVICE_DISABLEDflag in
fwnode_graph_get_endpoint_by_id()
property: DropDEVICE_DISABLEDflag in
fwnode_graph_get_endpoint_count()The above patches are another series that doesn't depend on the first one AFAICS and can go in via driver core.
Agreed.
Quoted 13 lines
Quoted 8 lines
property: Document that fwnode API returns available nodes driver core: Use
fwnode_for_each_child_node()instead
net: lan966x: Usefwnode_for_each_child_node()instead
Input: touch-overlay - Usefwnode_for_each_child_node()instead
media: thp7312: Usefwnode_for_each_child_node()instead
leds: Usefwnode_for_each_child_node()instead
leds: Usefwnode_get_next_child_node()insteadThe above can go in via respective subsystem trees when the ACPI property series gets in (I'm not sure if/how they depend on the second series).
Quoted 7 lines
And the following one is a follow-up cleanup getting rid of code that would be redundant going forward.
Quoted 2 lines
property: Drop functions operating on "available" child nodes
spi: cadence: Remove explicit device node availability checkDoes the spi change depend on the previous patch?
There's really only one dependency, apart from the direct dependency of
fwnode_get_next_available_child_node()/fwnode_for_each_available_child_node()definitions removed in the second last patch:fwnode_get_next_child_node()andfwnode_for_each_child_node()may still return non-available nodes before the last of the ACPI patches in the set. So if the ACPI patches aren't merged but the rest are, non-available nodes could be returned.
Quoted 7 lines
How about:
1. Merge the ACPI patches to 6.18.
2. Merge the rest, apart from the second last patch, for 6.19.
3. Once everything else is in, merge the last patch. Could wait for 6.20.
Sounds good.
Quoted 1 line
Perhaps I should split the series in three sets?
That would help I think.
Quoted 2 lines
I'll send an update on the ACPI patches soon, to address a comment related to them.
OK
Thanks!
Re: (subset) [PATCH v2 00/16] Align availability checks on fwnode child node enumeration
In reply to Sakari AilusQuoted 9 lines · Sakari Ailus
Historically the fwnode property API has enumerated only available device nodes on OF whereas on ACPI, also nodes that haven't been present in the system have been provided. Both OF and ACPI have similar concepts of node availbility, on OF it's the "status" property present on device nodes and on ACPI the
_STAobject evaluates to device present, enabled and functional bits, of which the present and functional bits are currently being used to determine whether to enumerate a device.[...]
Applied, thanks!
[13/16] leds: Use fwnode_for_each_child_node() instead
commit: 34dbf5b458193b120a4a00777f2045f40c3db974
[14/16] leds: Use fwnode_get_next_child_node() instead
commit: 93ecfb549059e3c77da16364c0f6fbddb42b147b--
Lee Jones [李琼斯]