summaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-03-03 23:06:21 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-03-04 14:25:32 +0100
commit4b59cc1fd6fd1dac1d4468b4f327ae9f59d1c0aa (patch)
tree78360548903b07907a17c2d4164b8d0e32d3dda6 /drivers/acpi
parent68a67f6c78b80525d9b3c6672e7782de95e56a83 (diff)
downloadblackbird-op-linux-4b59cc1fd6fd1dac1d4468b4f327ae9f59d1c0aa.tar.gz
blackbird-op-linux-4b59cc1fd6fd1dac1d4468b4f327ae9f59d1c0aa.zip
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.c30
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,
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,
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++)
- if (!strcmp((char *)devid->id, idstr)) {
- if (matchid)
- *matchid = devid;
+ list_for_each_entry(handler, &acpi_scan_handlers_list, list_node)
+ if (acpi_scan_handler_matching(handler, idstr, matchid))
+ return handler;
- return handler;
- }
- }
return NULL;
}
OpenPOWER on IntegriCloud