From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-acpi@vger.kernel.org
Cc: rafael@kernel.org, andriy.shevchenko@intel.com
Subject: [PATCH v2 2/8] ACPI: property: Tie data nodes to acpi handles
Date: Fri, 20 May 2022 09:11:42 +0300 [thread overview]
Message-ID: <20220520061148.21366-3-sakari.ailus@linux.intel.com> (raw)
In-Reply-To: <20220520061148.21366-1-sakari.ailus@linux.intel.com>
ACPICA allows associating additional information (i.e. pointers with
specific tag) to acpi_handles. The acpi_device's are associated to
acpi_handle's in acpi_tie_acpi_dev() in scan.c, do the same here for the
_DSD data nodes.
This allows direct data node references in properties, implemented later on
in the series.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/acpi/property.c | 42 ++++++++++++++++++++++++++++++++++++++++-
1 file changed, 41 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index bc9a645f8bb77..f8c83ee6c8d59 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -340,6 +340,43 @@ acpi_data_add_props(struct acpi_device_data *data, const guid_t *guid,
return props;
}
+static void acpi_nondev_subnode_tag(acpi_handle handle, void *context)
+{
+}
+
+static void acpi_untie_nondev_subnodes(struct acpi_device_data *data)
+{
+ struct acpi_data_node *dn;
+
+ list_for_each_entry(dn, &data->subnodes, sibling) {
+ acpi_detach_data(dn->handle, acpi_nondev_subnode_tag);
+
+ acpi_untie_nondev_subnodes(&dn->data);
+ }
+}
+
+static int acpi_tie_nondev_subnodes(struct acpi_device_data *data)
+{
+ struct acpi_data_node *dn;
+
+ list_for_each_entry(dn, &data->subnodes, sibling) {
+ acpi_status status;
+ int ret;
+
+ status = acpi_attach_data(dn->handle, acpi_nondev_subnode_tag, dn);
+ if (ACPI_FAILURE(status)) {
+ acpi_handle_err(dn->handle, "Can't tag data node\n");
+ return 0;
+ }
+
+ ret = acpi_tie_nondev_subnodes(&dn->data);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+
static bool acpi_extract_properties(const union acpi_object *desc,
struct acpi_device_data *data)
{
@@ -419,7 +456,9 @@ void acpi_init_properties(struct acpi_device *adev)
&adev->data, acpi_fwnode_handle(adev)))
adev->data.pointer = buf.pointer;
- if (!adev->data.pointer) {
+ if (!adev->data.pointer ||
+ acpi_tie_nondev_subnodes(&adev->data) < 0) {
+ acpi_untie_nondev_subnodes(&adev->data);
acpi_handle_debug(adev->handle, "Invalid _DSD data, skipping\n");
ACPI_FREE(buf.pointer);
}
@@ -462,6 +501,7 @@ static void acpi_destroy_nondev_subnodes(struct list_head *list)
void acpi_free_properties(struct acpi_device *adev)
{
+ acpi_untie_nondev_subnodes(&adev->data);
acpi_destroy_nondev_subnodes(&adev->data.subnodes);
ACPI_FREE((void *)adev->data.pointer);
adev->data.of_compatible = NULL;
--
2.30.2
next prev parent reply other threads:[~2022-05-20 6:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-20 6:11 [PATCH v2 0/8] ACPI: Buffer property and reference as string support Sakari Ailus
2022-05-20 6:11 ` [PATCH v2 1/8] ACPI: property: Return type of acpi_add_nondev_subnodes() should be bool Sakari Ailus
2022-05-20 6:11 ` Sakari Ailus [this message]
2022-05-20 6:11 ` [PATCH v2 3/8] ACPI: property: Use acpi_object_type consistently in property ref parsing Sakari Ailus
2022-05-20 6:11 ` [PATCH v2 4/8] ACPI: property: Move property ref argument parsing into a new function Sakari Ailus
2022-05-20 6:11 ` [PATCH v2 5/8] ACPI: property: Switch node property referencing from ifs to a switch Sakari Ailus
2022-05-20 6:11 ` [PATCH v2 6/8] ACPI: property: Unify integer value reading functions Sakari Ailus
2022-05-20 14:25 ` Andy Shevchenko
2022-05-20 22:04 ` Sakari Ailus
2022-05-20 6:11 ` [PATCH v2 7/8] ACPI: property: Add support for parsing buffer property UUID Sakari Ailus
2022-05-20 14:28 ` Andy Shevchenko
2022-05-25 8:13 ` Sakari Ailus
2022-05-20 6:11 ` [PATCH v2 8/8] ACPI: property: Read buffer properties as integers 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=20220520061148.21366-3-sakari.ailus@linux.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=andriy.shevchenko@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=rafael@kernel.org \
/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