From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Mika Westerberg <mika.westerberg@linux.intel.com>,
Darren Hart <dvhart@infradead.org>
Cc: ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/4] ACPI / scan: Generalize of_compatible matching
Date: Thu, 09 Apr 2015 02:19:46 +0200 [thread overview]
Message-ID: <11437744.VKNlyABKHa@vostro.rjw.lan> (raw)
In-Reply-To: <4378053.gHTT51U7FJ@vostro.rjw.lan>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Redefine the function used for matching the device's "compatible"
property against a given list of "compatible" strings to take
a pointer to that list instead of a driver object pointer to
make it more general.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/acpi/scan.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
Index: linux-pm/drivers/acpi/scan.c
===================================================================
--- linux-pm.orig/drivers/acpi/scan.c
+++ linux-pm/drivers/acpi/scan.c
@@ -953,9 +953,17 @@ int acpi_match_device_ids(struct acpi_de
}
EXPORT_SYMBOL(acpi_match_device_ids);
-/* Performs match against special "PRP0001" shoehorn ACPI ID */
-static bool acpi_of_driver_match_device(struct device *dev,
- const struct device_driver *drv)
+/**
+ * acpi_of_match_device - Match device using the "compatible" property.
+ * @dev: Device to match.
+ * @of_match_table: List of device IDs to match against.
+ *
+ * If @dev has an ACPI companion which has the special PRP0001 device ID in its
+ * list of identifiers and a _DSD object with the "compatible" property, use
+ * that property to match against the given list of identifiers.
+ */
+static bool acpi_of_match_device(struct device *dev,
+ const struct of_device_id *of_match_table)
{
const union acpi_object *of_compatible, *obj;
struct acpi_device *adev;
@@ -966,7 +974,7 @@ static bool acpi_of_driver_match_device(
return false;
of_compatible = adev->data.of_compatible;
- if (!drv->of_match_table || !of_compatible)
+ if (!of_match_table || !of_compatible)
return false;
if (of_compatible->type == ACPI_TYPE_PACKAGE) {
@@ -980,7 +988,7 @@ static bool acpi_of_driver_match_device(
for (i = 0; i < nval; i++, obj++) {
const struct of_device_id *id;
- for (id = drv->of_match_table; id->compatible[0]; id++)
+ for (id = of_match_table; id->compatible[0]; id++)
if (!strcasecmp(obj->string.pointer, id->compatible))
return true;
}
@@ -992,7 +1000,7 @@ bool acpi_driver_match_device(struct dev
const struct device_driver *drv)
{
if (!drv->acpi_match_table)
- return acpi_of_driver_match_device(dev, drv);
+ return acpi_of_match_device(dev, drv->of_match_table);
return !!acpi_match_device(drv->acpi_match_table, dev);
}
next prev parent reply other threads:[~2015-04-09 0:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-09 0:18 [PATCH 0/4] ACPI / scan: Clean up the handling of the PRP0001 device ID Rafael J. Wysocki
2015-04-09 0:19 ` Rafael J. Wysocki [this message]
2015-04-09 0:20 ` [PATCH 2/4] ACPI / scan: Simplify acpi_match_device() Rafael J. Wysocki
2015-04-09 0:21 ` [PATCH 3/4] ACPI / scan: Take PRP0001 in _CID lists into account too Rafael J. Wysocki
2015-04-09 1:28 ` [Update][PATCH 3/4] ACPI / scan: Take the PRP0001 position in the list of IDs into account Rafael J. Wysocki
2015-04-09 0:22 ` [PATCH 4/4] ACPI / scan: Rework modalias creation when "compatible" is present Rafael J. Wysocki
2015-04-09 12:27 ` Mika Westerberg
2015-04-09 17:39 ` Rafael J. Wysocki
2015-04-09 21:13 ` [update][PATCH " Rafael J. Wysocki
2015-04-10 8:12 ` Mika Westerberg
2015-04-10 12:34 ` Rafael J. Wysocki
2015-04-10 12:29 ` Mika Westerberg
2015-04-10 14:20 ` Rafael J. Wysocki
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=11437744.VKNlyABKHa@vostro.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=dvhart@infradead.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.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