]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ACPI / scan: .match() callback for ACPI scan handlers
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 30 May 2014 02:21:52 +0000 (04:21 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 30 May 2014 14:04:35 +0000 (16:04 +0200)
Introduce a .match() callback for ACPI scan handlers to allow them to
use more elaborate matching algorithms if necessary.  That is needed
for the upcoming PNP scan handler in particular.

This change is based on a Zhang Rui's prototype.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/acpi/scan.c
include/acpi/acpi_bus.h

index df6e4c924b353a24db62d5b222572135f0240816..e44438f7917bb880dd95027c75542fa6de1a7d59 100644 (file)
@@ -1977,6 +1977,9 @@ static bool acpi_scan_handler_matching(struct acpi_scan_handler *handler,
 {
        const struct acpi_device_id *devid;
 
+       if (handler->match)
+               return handler->match(idstr, matchid);
+
        for (devid = handler->ids; devid->id[0]; devid++)
                if (!strcmp((char *)devid->id, idstr)) {
                        if (matchid)
index 7417a16c8d86a94ea1d64101e020dba006a681c1..c241c7594bbc48ad39bb2aeba8e8983bac099213 100644 (file)
@@ -131,6 +131,7 @@ static inline struct acpi_hotplug_profile *to_acpi_hotplug_profile(
 struct acpi_scan_handler {
        const struct acpi_device_id *ids;
        struct list_head list_node;
+       bool (*match)(char *idstr, const struct acpi_device_id **matchid);
        int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id);
        void (*detach)(struct acpi_device *dev);
        void (*bind)(struct device *phys_dev);