* [PATCH 0/1] Add node availability check for child node iteration on ACPI fwnode backend
@ 2025-10-01 10:26 Sakari Ailus
2025-10-01 10:26 ` [PATCH 1/1] ACPI: property: Return present device nodes only on fwnode interface Sakari Ailus
0 siblings, 1 reply; 3+ messages in thread
From: Sakari Ailus @ 2025-10-01 10:26 UTC (permalink / raw)
To: linux-acpi
Cc: linux-kernel, Rafael J. Wysocki, Len Brown, Dmitry Torokhov,
Laurent Pinchart, Andy Shevchenko, Jonathan Cameron
Hello everyone,
This patch adds device node availability check to the child device node
iteration in the ACPI fwnode backend.
The previous set including with the tree-wide changes can be found here
<URL:https://lore.kernel.org/linux-acpi/CAJZ5v0gQ9vnT+Z8zryEausp-2xX7HocoBgwmiptxg7BGiU9C8g@mail.gmail.com/T/#t>.
I'll post the other bits separately as they'll be merged at different
moments. The rest of the ACPI changes can also wait until v6.19.
since tree-wide set v2
<20250924074602.266292-1-sakari.ailus@linux.intel.com>, WRT. this patch:
- Don't use kernel-doc functions to document static functions in .c files.
- Add empty lines between sections within a now non-kernel-doc comment.
since v1 <20250916160129.3955410-1-sakari.ailus@linux.intel.com> (entire
tree-wide set):
- 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 (1):
ACPI: property: Return present device nodes only on fwnode interface
drivers/acpi/property.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
--
2.47.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] ACPI: property: Return present device nodes only on fwnode interface
2025-10-01 10:26 [PATCH 0/1] Add node availability check for child node iteration on ACPI fwnode backend Sakari Ailus
@ 2025-10-01 10:26 ` Sakari Ailus
2025-10-01 18:49 ` Rafael J. Wysocki
0 siblings, 1 reply; 3+ messages in thread
From: Sakari Ailus @ 2025-10-01 10:26 UTC (permalink / raw)
To: linux-acpi
Cc: linux-kernel, Rafael J. Wysocki, Len Brown, Dmitry Torokhov,
Laurent Pinchart, Andy Shevchenko, Jonathan Cameron
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 <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
---
drivers/acpi/property.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index 436019d96027..10bab30300f3 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -1318,6 +1318,28 @@ struct fwnode_handle *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
@@ -1662,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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] ACPI: property: Return present device nodes only on fwnode interface
2025-10-01 10:26 ` [PATCH 1/1] ACPI: property: Return present device nodes only on fwnode interface Sakari Ailus
@ 2025-10-01 18:49 ` Rafael J. Wysocki
0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2025-10-01 18:49 UTC (permalink / raw)
To: Sakari Ailus
Cc: linux-acpi, linux-kernel, Rafael J. Wysocki, Len Brown,
Dmitry Torokhov, Laurent Pinchart, Andy Shevchenko,
Jonathan Cameron
On Wed, Oct 1, 2025 at 12:26 PM Sakari Ailus
<sakari.ailus@linux.intel.com> wrote:
>
> 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 <sakari.ailus@linux.intel.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
> ---
> drivers/acpi/property.c | 24 +++++++++++++++++++++++-
> 1 file changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
> index 436019d96027..10bab30300f3 100644
> --- a/drivers/acpi/property.c
> +++ b/drivers/acpi/property.c
> @@ -1318,6 +1318,28 @@ struct fwnode_handle *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
> @@ -1662,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, \
> --
Applied with some minor tweaks as 6.18 material, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-01 18:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-01 10:26 [PATCH 0/1] Add node availability check for child node iteration on ACPI fwnode backend Sakari Ailus
2025-10-01 10:26 ` [PATCH 1/1] ACPI: property: Return present device nodes only on fwnode interface Sakari Ailus
2025-10-01 18:49 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®