diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-03-03 17:06:21 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-03-04 08:25:32 -0500 |
commit | 4b59cc1fd6fd1dac1d4468b4f327ae9f59d1c0aa (patch) | |
tree | 78360548903b07907a17c2d4164b8d0e32d3dda6 /drivers/acpi | |
parent | 68a67f6c78b80525d9b3c6672e7782de95e56a83 (diff) |
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>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/scan.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index de73fdf89598..45fbe95ba1f3 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -1673,22 +1673,32 @@ static int acpi_bus_type_and_status(acpi_handle handle, int *type, | |||
1673 | return 0; | 1673 | return 0; |
1674 | } | 1674 | } |
1675 | 1675 | ||
1676 | static bool acpi_scan_handler_matching(struct acpi_scan_handler *handler, | ||
1677 | char *idstr, | ||
1678 | const struct acpi_device_id **matchid) | ||
1679 | { | ||
1680 | const struct acpi_device_id *devid; | ||
1681 | |||
1682 | for (devid = handler->ids; devid->id[0]; devid++) | ||
1683 | if (!strcmp((char *)devid->id, idstr)) { | ||
1684 | if (matchid) | ||
1685 | *matchid = devid; | ||
1686 | |||
1687 | return true; | ||
1688 | } | ||
1689 | |||
1690 | return false; | ||
1691 | } | ||
1692 | |||
1676 | static struct acpi_scan_handler *acpi_scan_match_handler(char *idstr, | 1693 | static struct acpi_scan_handler *acpi_scan_match_handler(char *idstr, |
1677 | const struct acpi_device_id **matchid) | 1694 | const struct acpi_device_id **matchid) |
1678 | { | 1695 | { |
1679 | struct acpi_scan_handler *handler; | 1696 | struct acpi_scan_handler *handler; |
1680 | 1697 | ||
1681 | list_for_each_entry(handler, &acpi_scan_handlers_list, list_node) { | 1698 | list_for_each_entry(handler, &acpi_scan_handlers_list, list_node) |
1682 | const struct acpi_device_id *devid; | 1699 | if (acpi_scan_handler_matching(handler, idstr, matchid)) |
1683 | 1700 | return handler; | |
1684 | for (devid = handler->ids; devid->id[0]; devid++) | ||
1685 | if (!strcmp((char *)devid->id, idstr)) { | ||
1686 | if (matchid) | ||
1687 | *matchid = devid; | ||
1688 | 1701 | ||
1689 | return handler; | ||
1690 | } | ||
1691 | } | ||
1692 | return NULL; | 1702 | return NULL; |
1693 | } | 1703 | } |
1694 | 1704 | ||