* [PATCH 1/3] ACPI: property: Make acpi_get_next_subnode() static
2025-10-01 10:43 [PATCH 0/3] ACPI property cleanups Sakari Ailus
@ 2025-10-01 10:43 ` Sakari Ailus
2025-10-01 10:43 ` [PATCH 2/3] ACPI: property: Use ACPI functions in acpi_graph_get_next_endpoint() only Sakari Ailus
2025-10-01 10:43 ` [PATCH 3/3] ACPI: property: Rework acpi_graph_get_next_endpoint() Sakari Ailus
2 siblings, 0 replies; 5+ messages in thread
From: Sakari Ailus @ 2025-10-01 10:43 UTC (permalink / raw)
To: linux-acpi
Cc: linux-kernel, Rafael J. Wysocki, Len Brown, Dmitry Torokhov,
Laurent Pinchart, Andy Shevchenko, Jonathan Cameron
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 <sakari.ailus@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
---
drivers/acpi/property.c | 7 ++++---
include/linux/acpi.h | 10 ----------
2 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index 10bab30300f3..59ed2d9f1007 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -1259,13 +1259,14 @@ static int stop_on_next(struct acpi_device *adev, void *data)
return 0;
}
-/**
+/*
* acpi_get_next_subnode - Return the next 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.
*/
-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
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 2/3] ACPI: property: Use ACPI functions in acpi_graph_get_next_endpoint() only
2025-10-01 10:43 [PATCH 0/3] ACPI property cleanups Sakari Ailus
2025-10-01 10:43 ` [PATCH 1/3] ACPI: property: Make acpi_get_next_subnode() static Sakari Ailus
@ 2025-10-01 10:43 ` Sakari Ailus
2025-10-01 10:43 ` [PATCH 3/3] ACPI: property: Rework acpi_graph_get_next_endpoint() Sakari Ailus
2 siblings, 0 replies; 5+ messages in thread
From: Sakari Ailus @ 2025-10-01 10:43 UTC (permalink / raw)
To: linux-acpi
Cc: linux-kernel, Rafael J. Wysocki, Len Brown, Dmitry Torokhov,
Laurent Pinchart, Andy Shevchenko, Jonathan Cameron
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 <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 | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index 59ed2d9f1007..200e5d717f16 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -1403,7 +1403,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
@@ -1421,13 +1421,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
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 3/3] ACPI: property: Rework acpi_graph_get_next_endpoint()
2025-10-01 10:43 [PATCH 0/3] ACPI property cleanups Sakari Ailus
2025-10-01 10:43 ` [PATCH 1/3] ACPI: property: Make acpi_get_next_subnode() static Sakari Ailus
2025-10-01 10:43 ` [PATCH 2/3] ACPI: property: Use ACPI functions in acpi_graph_get_next_endpoint() only Sakari Ailus
@ 2025-10-01 10:43 ` Sakari Ailus
2025-10-01 12:20 ` Laurent Pinchart
2 siblings, 1 reply; 5+ messages in thread
From: Sakari Ailus @ 2025-10-01 10:43 UTC (permalink / raw)
To: linux-acpi
Cc: linux-kernel, Rafael J. Wysocki, Len Brown, Dmitry Torokhov,
Laurent Pinchart, Andy Shevchenko, Jonathan Cameron
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 <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/acpi/property.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index 200e5d717f16..c07f45929a25 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -1421,14 +1421,17 @@ 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;
- if (is_acpi_graph_node(port, "port"))
- endpoint = acpi_get_next_subnode(port, NULL);
- }
+
+ prev = NULL;
+
+ do {
+ port = acpi_get_next_subnode(fwnode, port);
+ } while (port && !is_acpi_graph_node(port, "port"));
+ } while (port);
/*
* The names of the endpoint nodes begin with "endpoint@" followed by
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 3/3] ACPI: property: Rework acpi_graph_get_next_endpoint()
2025-10-01 10:43 ` [PATCH 3/3] ACPI: property: Rework acpi_graph_get_next_endpoint() Sakari Ailus
@ 2025-10-01 12:20 ` Laurent Pinchart
0 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2025-10-01 12:20 UTC (permalink / raw)
To: Sakari Ailus
Cc: linux-acpi, linux-kernel, Rafael J. Wysocki, Len Brown,
Dmitry Torokhov, Andy Shevchenko, Jonathan Cameron
On Wed, Oct 01, 2025 at 01:43:20PM +0300, Sakari Ailus wrote:
> 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 <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
> drivers/acpi/property.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
> index 200e5d717f16..c07f45929a25 100644
> --- a/drivers/acpi/property.c
> +++ b/drivers/acpi/property.c
> @@ -1421,14 +1421,17 @@ 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;
> - if (is_acpi_graph_node(port, "port"))
> - endpoint = acpi_get_next_subnode(port, NULL);
> - }
> +
> + prev = NULL;
> +
> + do {
> + port = acpi_get_next_subnode(fwnode, port);
> + } while (port && !is_acpi_graph_node(port, "port"));
> + } while (port);
>
> /*
> * The names of the endpoint nodes begin with "endpoint@" followed by
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 5+ messages in thread