From: Srinath Mannam <srinath.mannam@broadcom.com>
To: rafael@kernel.org, lenb@kernel.org, andy.shevchenko@gmail.com
Cc: ray.jui@broadcom.com, vladimir.olovyannikov@broadcom.com,
vikram.prakash@broadcom.com, scott.branden@broadcom.com,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
Srinath Mannam <srinath.mannam@broadcom.com>
Subject: [RFC PATCH] ACPI: bus: match of_device_id using acpi device
Date: Tue, 3 Jul 2018 14:52:40 +0530 [thread overview]
Message-ID: <1530609760-8919-1-git-send-email-srinath.mannam@broadcom.com> (raw)
This patch provides a function, to get of_device_id after
matching with ACPI device _DSD object compatible property
in the case driver does not contain acpi_device_id list
and driver probe called for ACPI device ID PRP0001 with
compatible property match with of_device_id compatible.
Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
---
drivers/acpi/bus.c | 23 +++++++++++++++++++++++
include/linux/acpi.h | 10 ++++++++++
2 files changed, 33 insertions(+)
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 84b4a62..e676bf7 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -830,6 +830,29 @@ const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
}
EXPORT_SYMBOL_GPL(acpi_match_device);
+/**
+ * acpi_match_of_device_id - Match a struct device in given of_device_id list
+ * @ids: Array of struct of_device_id object to match against.
+ * @dev: The device structure to match.
+ *
+ * Check if @dev has a valid ACPI handle and if there is a struct acpi_device
+ * object for that handle and use that object to match against a given list of
+ * device IDs.
+ *
+ * Return a pointer to the first matching ID on success or %NULL on failure.
+ */
+const
+struct of_device_id *acpi_match_of_device_id(const struct of_device_id *ids,
+ const struct device *dev)
+{
+ const struct of_device_id *id = NULL;
+
+ __acpi_match_device(acpi_companion_match(dev), NULL, ids, NULL, &id);
+ return id;
+}
+EXPORT_SYMBOL_GPL(acpi_match_of_device_id);
+
+
const void *acpi_device_get_match_data(const struct device *dev)
{
const struct acpi_device_id *match;
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 4b35a66..2f24800 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -589,6 +589,10 @@ extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
const struct device *dev);
+const
+struct of_device_id *acpi_match_of_device_id(const struct of_device_id *ids,
+ const struct device *dev);
+
const void *acpi_device_get_match_data(const struct device *dev);
extern bool acpi_driver_match_device(struct device *dev,
const struct device_driver *drv);
@@ -775,6 +779,12 @@ static inline const struct acpi_device_id *acpi_match_device(
return NULL;
}
+static inline const struct of_device_id *acpi_match_of_device_id(
+ const struct of_device_id *ids, const struct device *dev)
+{
+ return NULL;
+}
+
static inline const void *acpi_device_get_match_data(const struct device *dev)
{
return NULL;
--
2.7.4
next reply other threads:[~2018-07-03 9:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-03 9:22 Srinath Mannam [this message]
2018-07-03 13:06 ` [RFC PATCH] ACPI: bus: match of_device_id using acpi device Sudeep Holla
2018-07-03 17:41 ` Andy Shevchenko
2018-07-04 3:37 ` Srinath Mannam
2018-07-04 9:32 ` Andy Shevchenko
2018-07-04 9:38 ` Sudeep Holla
2018-07-04 9:41 ` Srinath Mannam
2018-07-04 10:17 ` Nikolaus Voss
2018-07-04 10:24 ` Andy Shevchenko
2018-07-04 10:28 ` Rafael J. Wysocki
2018-07-04 10:50 ` Nikolaus Voss
2018-07-04 10:53 ` Sudeep Holla
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=1530609760-8919-1-git-send-email-srinath.mannam@broadcom.com \
--to=srinath.mannam@broadcom.com \
--cc=andy.shevchenko@gmail.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=ray.jui@broadcom.com \
--cc=scott.branden@broadcom.com \
--cc=vikram.prakash@broadcom.com \
--cc=vladimir.olovyannikov@broadcom.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;
as well as URLs for NNTP newsgroup(s).