acpi_get_next_subnode() is only used in drivers/acpi/property.c. Remove its prototype from include/linux/acpi.h and make it static. Signed-off-by: Sakari Ailus Reviewed-by: Andy Shevchenko --- drivers/acpi/property.c | 5 +++-- include/linux/acpi.h | 10 ---------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index 436019d96027..5435628c67e7 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -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); diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 5ff5d99f6ead..703323b9fe0c 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -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) -- 2.47.3 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 using fwnode_get_next_child_node() in acpi_graph_get_next_endpoint(), call acpi_get_next_subnode() directly instead. Signed-off-by: Sakari Ailus --- drivers/acpi/property.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index 5435628c67e7..3e85900080ac 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -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); } /* -- 2.47.3 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 Signed-off-by: Sakari Ailus --- drivers/acpi/property.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index 3e85900080ac..5438592dc136 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -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 -- 2.47.3 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 function acpi_get_next_present_subnode(), used as the get_next_child_node() fwnode operation that also checks device node presence. Signed-off-by: Sakari Ailus --- drivers/acpi/property.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index 5438592dc136..01f3880ffcce 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -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, \ -- 2.47.3 Move Return: section of fwnode_graph_get_endpoint_by_id() down where it habitually is located. Signed-off-by: Sakari Ailus --- drivers/base/property.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/base/property.c b/drivers/base/property.c index f626d5bbe806..b52f7b3bbf84 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -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, -- 2.47.3 No 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. Signed-off-by: Sakari Ailus --- drivers/base/property.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/base/property.c b/drivers/base/property.c index b52f7b3bbf84..7fc3257f223d 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -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); -- 2.47.3 FWNODE_GRAPH_DEVICE_DISABLED flag isn't used anywhere, drop the flag and support for it in fwnode_graph_get_endpoint_count(). Signed-off-by: Sakari Ailus Reviewed-by: Andy Shevchenko --- drivers/base/property.c | 10 ++-------- include/linux/property.h | 8 +------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/base/property.c b/drivers/base/property.c index 7fc3257f223d..4bd64e729431 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -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++; } diff --git a/include/linux/property.h b/include/linux/property.h index d1e80b3c9918..8b8bbbe6b5b7 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -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; \ -- 2.47.3 The 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. Signed-off-by: Sakari Ailus Reviewed-by: Andy Shevchenko --- drivers/base/property.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/base/property.c b/drivers/base/property.c index 4bd64e729431..ff440456af7b 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -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. * -- 2.47.3 fwnode_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. Signed-off-by: Sakari Ailus Reviewed-by: Andy Shevchenko --- drivers/base/core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index d22d6b23e758..4bffd347e2f9 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -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); } -- 2.47.3 fwnode_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. Signed-off-by: Sakari Ailus --- drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c index 7001584f1b7a..e8f9bf96a63b 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c @@ -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; -- 2.47.3 fwnode_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. Signed-off-by: Sakari Ailus --- drivers/input/touch-overlay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/touch-overlay.c b/drivers/input/touch-overlay.c index b9fd82c4829d..7eaaaef1bd82 100644 --- a/drivers/input/touch-overlay.c +++ b/drivers/input/touch-overlay.c @@ -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); -- 2.47.3 fwnode_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. Signed-off-by: Sakari Ailus --- drivers/media/i2c/thp7312.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/thp7312.c b/drivers/media/i2c/thp7312.c index 775cfba188d8..86208a47f472 100644 --- a/drivers/media/i2c/thp7312.c +++ b/drivers/media/i2c/thp7312.c @@ -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++; -- 2.47.3 fwnode_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. Signed-off-by: Sakari Ailus --- 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(-) diff --git a/drivers/leds/leds-max5970.c b/drivers/leds/leds-max5970.c index 285074c53b23..a1e91a06249c 100644 --- a/drivers/leds/leds-max5970.c +++ b/drivers/leds/leds-max5970.c @@ -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", ®)) diff --git a/drivers/leds/leds-max77705.c b/drivers/leds/leds-max77705.c index b7403b3fcf5e..1e2054c1bf80 100644 --- a/drivers/leds/leds-max77705.c +++ b/drivers/leds/leds-max77705.c @@ -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; diff --git a/drivers/leds/rgb/leds-ktd202x.c b/drivers/leds/rgb/leds-ktd202x.c index 04e62faa3a00..e4f0f25a5e45 100644 --- a/drivers/leds/rgb/leds-ktd202x.c +++ b/drivers/leds/rgb/leds-ktd202x.c @@ -391,7 +391,7 @@ static int ktd202x_setup_led_rgb(struct ktd202x *chip, struct fwnode_handle *fwn int 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 *fwn if (!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; diff --git a/drivers/leds/rgb/leds-ncp5623.c b/drivers/leds/rgb/leds-ncp5623.c index 7c7d44623a9e..85d6be6fff2b 100644 --- a/drivers/leds/rgb/leds-ncp5623.c +++ b/drivers/leds/rgb/leds-ncp5623.c @@ -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; -- 2.47.3 fwnode_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). Signed-off-by: Sakari Ailus --- 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(-) diff --git a/drivers/leds/flash/leds-rt4505.c b/drivers/leds/flash/leds-rt4505.c index f16358b8dfc1..18fd5b7e528f 100644 --- a/drivers/leds/flash/leds-rt4505.c +++ b/drivers/leds/flash/leds-rt4505.c @@ -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; diff --git a/drivers/leds/flash/leds-rt8515.c b/drivers/leds/flash/leds-rt8515.c index 6af0d2c7fc56..f6b439674c03 100644 --- a/drivers/leds/flash/leds-rt8515.c +++ b/drivers/leds/flash/leds-rt8515.c @@ -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"); diff --git a/drivers/leds/flash/leds-sgm3140.c b/drivers/leds/flash/leds-sgm3140.c index 3e83200675f2..dc6840357370 100644 --- a/drivers/leds/flash/leds-sgm3140.c +++ b/drivers/leds/flash/leds-sgm3140.c @@ -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"); diff --git a/drivers/leds/flash/leds-tps6131x.c b/drivers/leds/flash/leds-tps6131x.c index 6f4d4fd55361..f0f1f2b77d5a 100644 --- a/drivers/leds/flash/leds-tps6131x.c +++ b/drivers/leds/flash/leds-tps6131x.c @@ -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; -- 2.47.3 fwnode_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. Signed-off-by: Sakari Ailus --- drivers/base/property.c | 30 +----------------------------- include/linux/property.h | 6 ------ 2 files changed, 1 insertion(+), 35 deletions(-) diff --git a/drivers/base/property.c b/drivers/base/property.c index ff440456af7b..75c3283fb5ca 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -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. * diff --git a/include/linux/property.h b/include/linux/property.h index 8b8bbbe6b5b7..da6202053862 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -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); -- 2.47.3 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 --- drivers/spi/spi-cadence-xspi.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/spi/spi-cadence-xspi.c b/drivers/spi/spi-cadence-xspi.c index 6dcba0e0ddaa..23e426ef9b9c 100644 --- a/drivers/spi/spi-cadence-xspi.c +++ b/drivers/spi/spi-cadence-xspi.c @@ -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); -- 2.47.3