From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-acpi@vger.kernel.org
Cc: "Wysocki, Rafael J" <rafael.j.wysocki@intel.com>,
Len Brown <lenb@kernel.org>
Subject: [PATCH 1/1] ACPI: property: Fix REF STR... reference parsing
Date: Mon, 31 Mar 2025 15:18:36 +0300 [thread overview]
Message-ID: <20250331121836.2495903-1-sakari.ailus@linux.intel.com> (raw)
Restore parsing of ACPI data node references consisting of a device node
reference followed by one or more child data node names.
Fixes: 9880702d123f ("ACPI: property: Support using strings in reference properties")
Cc: stable@vger.kernel.org # for 6.8 and later
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
Hi Rafael,
It seems that support for REF STR... references got accidentally removed
when pure STR reference were added. The former are documented in
Documentation/firmware-guide/acpi/dsd/graph.rst .
- Sakari
drivers/acpi/property.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index 436019d96027..4e3202a0b305 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -807,10 +807,27 @@ acpi_fwnode_get_named_child_node(const struct fwnode_handle *fwnode,
static int acpi_get_ref_args(struct fwnode_reference_args *args,
struct fwnode_handle *ref_fwnode,
const union acpi_object **element,
- const union acpi_object *end, size_t num_args)
+ const union acpi_object *end, size_t num_args,
+ bool follow_strings)
{
u32 nargs = 0, i;
+ /*
+ * Parse REF STR... references by following named child nodes below the
+ * device node pointed by REF.
+ */
+ if (follow_strings) {
+ for (; (*element) < end && (*element)->type == ACPI_TYPE_STRING;
+ (*element)++) {
+ const char *child_name = (*element)->string.pointer;
+
+ ref_fwnode = acpi_fwnode_get_named_child_node(ref_fwnode,
+ child_name);
+ if (!ref_fwnode)
+ return -EINVAL;
+ }
+ }
+
/*
* Assume the following integer elements are all args. Stop counting on
* the first reference (possibly represented as a string) or end of the
@@ -999,7 +1016,7 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
ret = acpi_get_ref_args(idx == index ? args : NULL,
acpi_fwnode_handle(device),
- &element, end, num_args);
+ &element, end, num_args, true);
if (ret < 0)
return ret;
@@ -1017,7 +1034,7 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
ret = acpi_get_ref_args(idx == index ? args : NULL,
ref_fwnode, &element, end,
- num_args);
+ num_args, false);
if (ret < 0)
return ret;
--
2.39.5
next reply other threads:[~2025-03-31 12:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-31 12:18 Sakari Ailus [this message]
2025-03-31 13:19 ` [PATCH 1/1] ACPI: property: Fix REF STR... reference parsing Rafael J. Wysocki
2025-03-31 13:35 ` Sakari Ailus
2025-03-31 15:00 ` Rafael J. Wysocki
2025-03-31 15:09 ` Sakari Ailus
2025-03-31 15:35 ` Rafael J. Wysocki
2025-03-31 16:10 ` Sakari Ailus
2025-06-16 5:41 ` Sakari Ailus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250331121836.2495903-1-sakari.ailus@linux.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox