Skip to content

Commit aca0a4e

Browse files
committed
ACPI / scan: .match() callback for ACPI scan handlers
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>
1 parent 52d1d0b commit aca0a4e

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

drivers/acpi/scan.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1977,6 +1977,9 @@ static bool acpi_scan_handler_matching(struct acpi_scan_handler *handler,
19771977
{
19781978
const struct acpi_device_id *devid;
19791979

1980+
if (handler->match)
1981+
return handler->match(idstr, matchid);
1982+
19801983
for (devid = handler->ids; devid->id[0]; devid++)
19811984
if (!strcmp((char *)devid->id, idstr)) {
19821985
if (matchid)

include/acpi/acpi_bus.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ static inline struct acpi_hotplug_profile *to_acpi_hotplug_profile(
131131
struct acpi_scan_handler {
132132
const struct acpi_device_id *ids;
133133
struct list_head list_node;
134+
bool (*match)(char *idstr, const struct acpi_device_id **matchid);
134135
int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id);
135136
void (*detach)(struct acpi_device *dev);
136137
void (*bind)(struct device *phys_dev);

0 commit comments

Comments
 (0)