[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5123203A.8020107@jp.fujitsu.com>
Date: Tue, 19 Feb 2013 15:48:26 +0900
From: Yasuaki Ishimatsu <isimatu.yasuaki@...fujitsu.com>
To: "Rafael J. Wysocki" <rjw@...k.pl>
CC: ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
LKML <linux-kernel@...r.kernel.org>,
Yinghai Lu <yinghai@...nel.org>,
Toshi Kani <toshi.kani@...com>, Jiang Liu <liuj97@...il.com>
Subject: Re: [PATCH 1/7] ACPI / scan: Introduce acpi_scan_match_handler()
2013/02/18 0:20, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
>
> Introduce helper routine acpi_scan_match_handler() that will find the
> ACPI scan handler matching a given device ID, if there is one, and
> rework acpi_scan_attach_handler() to use the new routine (that
> routine will also be useful for other purposes going forward).
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
Acked-by: Yasuaki Ishimatsu <isimatu.yasuaki@...fujitsu.com>
Thanks,
Yasuaki Ishimatsu
> drivers/acpi/scan.c | 53 +++++++++++++++++++++++++++-------------------------
> 1 file changed, 28 insertions(+), 25 deletions(-)
>
> Index: test/drivers/acpi/scan.c
> ===================================================================
> --- test.orig/drivers/acpi/scan.c
> +++ test/drivers/acpi/scan.c
> @@ -1529,6 +1529,25 @@ static int acpi_bus_type_and_status(acpi
> return 0;
> }
>
> +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;
> +
> + return handler;
> + }
> + }
> + return NULL;
> +}
> +
> static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used,
> void *not_used, void **return_value)
> {
> @@ -1576,42 +1595,26 @@ static acpi_status acpi_bus_check_add(ac
> return AE_OK;
> }
>
> -static int acpi_scan_do_attach_handler(struct acpi_device *device, char *id)
> +static int acpi_scan_attach_handler(struct acpi_device *device)
> {
> - struct acpi_scan_handler *handler;
> + struct acpi_hardware_id *hwid;
> + int ret = 0;
>
> - list_for_each_entry(handler, &acpi_scan_handlers_list, list_node) {
> + list_for_each_entry(hwid, &device->pnp.ids, list) {
> const struct acpi_device_id *devid;
> + struct acpi_scan_handler *handler;
>
> - for (devid = handler->ids; devid->id[0]; devid++) {
> - int ret;
> -
> - if (strcmp((char *)devid->id, id))
> - continue;
> -
> + handler = acpi_scan_match_handler(hwid->id, &devid);
> + if (handler) {
> ret = handler->attach(device, devid);
> if (ret > 0) {
> device->handler = handler;
> - return ret;
> + break;
> } else if (ret < 0) {
> - return ret;
> + break;
> }
> }
> }
> - return 0;
> -}
> -
> -static int acpi_scan_attach_handler(struct acpi_device *device)
> -{
> - struct acpi_hardware_id *hwid;
> - int ret = 0;
> -
> - list_for_each_entry(hwid, &device->pnp.ids, list) {
> - ret = acpi_scan_do_attach_handler(device, hwid->id);
> - if (ret)
> - break;
> -
> - }
> return ret;
> }
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists