Commit 4b59cc1f authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

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: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: default avatarYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Acked-by: default avatarToshi Kani <toshi.kani@hp.com>
Tested-by: default avatarToshi Kani <toshi.kani@hp.com>
parent 68a67f6c
Loading
Loading
Loading
Loading
+20 −10
Original line number Diff line number Diff line
@@ -1673,12 +1673,10 @@ static int acpi_bus_type_and_status(acpi_handle handle, int *type,
	return 0;
}

static struct acpi_scan_handler *acpi_scan_match_handler(char *idstr,
static bool acpi_scan_handler_matching(struct acpi_scan_handler *handler,
				       char *idstr,
				       const struct acpi_device_id **matchid)
{
	struct acpi_scan_handler *handler;

	list_for_each_entry(handler, &acpi_scan_handlers_list, list_node) {
	const struct acpi_device_id *devid;

	for (devid = handler->ids; devid->id[0]; devid++)
@@ -1686,9 +1684,21 @@ static struct acpi_scan_handler *acpi_scan_match_handler(char *idstr,
			if (matchid)
				*matchid = devid;

				return handler;
			return true;
		}

	return false;
}

static struct acpi_scan_handler *acpi_scan_match_handler(char *idstr,
					const struct acpi_device_id **matchid)
{
	struct acpi_scan_handler *handler;

	list_for_each_entry(handler, &acpi_scan_handlers_list, list_node)
		if (acpi_scan_handler_matching(handler, idstr, matchid))
			return handler;

	return NULL;
}