mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-19 10:44:14 +08:00
ACPI / scan: Introduce acpi_scan_handler_matching()
Introduce new helper routine acpi_scan_handler_matching() for checking if the given ACPI scan handler matches a given device ID and rework acpi_scan_match_handler() to use the new routine (that routine will also be useful for other purposes in the future). Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Acked-by: Toshi Kani <toshi.kani@hp.com> Tested-by: Toshi Kani <toshi.kani@hp.com>
This commit is contained in:
parent
68a67f6c78
commit
4b59cc1fd6
@ -1673,22 +1673,32 @@ static int acpi_bus_type_and_status(acpi_handle handle, int *type,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool acpi_scan_handler_matching(struct acpi_scan_handler *handler,
|
||||||
|
char *idstr,
|
||||||
|
const struct acpi_device_id **matchid)
|
||||||
|
{
|
||||||
|
const struct acpi_device_id *devid;
|
||||||
|
|
||||||
|
for (devid = handler->ids; devid->id[0]; devid++)
|
||||||
|
if (!strcmp((char *)devid->id, idstr)) {
|
||||||
|
if (matchid)
|
||||||
|
*matchid = devid;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static struct acpi_scan_handler *acpi_scan_match_handler(char *idstr,
|
static struct acpi_scan_handler *acpi_scan_match_handler(char *idstr,
|
||||||
const struct acpi_device_id **matchid)
|
const struct acpi_device_id **matchid)
|
||||||
{
|
{
|
||||||
struct acpi_scan_handler *handler;
|
struct acpi_scan_handler *handler;
|
||||||
|
|
||||||
list_for_each_entry(handler, &acpi_scan_handlers_list, list_node) {
|
list_for_each_entry(handler, &acpi_scan_handlers_list, list_node)
|
||||||
const struct acpi_device_id *devid;
|
if (acpi_scan_handler_matching(handler, idstr, matchid))
|
||||||
|
return handler;
|
||||||
|
|
||||||
for (devid = handler->ids; devid->id[0]; devid++)
|
|
||||||
if (!strcmp((char *)devid->id, idstr)) {
|
|
||||||
if (matchid)
|
|
||||||
*matchid = devid;
|
|
||||||
|
|
||||||
return handler;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user