From patchwork Fri Oct 12 10:31:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tangchen X-Patchwork-Id: 1586141 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 5F09BDFF71 for ; Fri, 12 Oct 2012 10:32:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757998Ab2JLKcv (ORCPT ); Fri, 12 Oct 2012 06:32:51 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:43149 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1757951Ab2JLKcu (ORCPT ); Fri, 12 Oct 2012 06:32:50 -0400 X-IronPort-AV: E=Sophos;i="4.80,576,1344182400"; d="scan'208";a="5989984" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 12 Oct 2012 18:31:14 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id q9CAWdZU020948; Fri, 12 Oct 2012 18:32:40 +0800 Received: from tangchen.fnst.cn.fujitsu.com ([10.167.225.117]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2012101218322612-451374 ; Fri, 12 Oct 2012 18:32:26 +0800 From: Tang Chen To: yinghai@kernel.org, lenb@kernel.org, bhelgaas@google.com, izumi.taku@jp.fujitsu.com, jiang.liu@huawei.com, linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Tang Chen Subject: [PATCH 1/3] Introduce a new acpi to determine HID match. Date: Fri, 12 Oct 2012 18:31:28 +0800 Message-Id: <1350037890-5899-2-git-send-email-tangchen@cn.fujitsu.com> X-Mailer: git-send-email 1.7.10.1 In-Reply-To: <1350037890-5899-1-git-send-email-tangchen@cn.fujitsu.com> References: <1350037890-5899-1-git-send-email-tangchen@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/10/12 18:32:26, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/10/12 18:32:28, Serialize complete at 2012/10/12 18:32:28 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org This introduce a new api to determine if a HID matches a list of IDs. Different from acpi_match_device_ids(), the new api gets HID from acpi_device_info struct. Signed-off-by: Tang Chen --- drivers/acpi/scan.c | 24 ++++++++++++++++++++++++ include/acpi/acpi_bus.h | 2 ++ 2 files changed, 26 insertions(+), 0 deletions(-) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 03c12e6..41fd4c9 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -312,6 +312,30 @@ int acpi_match_device_ids(struct acpi_device *device, } EXPORT_SYMBOL(acpi_match_device_ids); +int acpi_match_object_info_ids(struct acpi_device_info *info, + const struct acpi_device_id *ids) +{ + char *hardware_id; + int i, j; + + for (i = 0; ids[i].id[0]; i++) { + hardware_id = info->hardware_id.string; + if (hardware_id && + !strcmp((char *)ids[i].id, hardware_id)) + return 0; + + for (j = 0; j < info->compatible_id_list.count; j++) { + hardware_id = info->compatible_id_list.ids[j].string; + if (hardware_id && + !strcmp((char *)ids[i].id, hardware_id)) + return 0; + } + } + + return 1; +} +EXPORT_SYMBOL(acpi_match_object_info_ids); + static void acpi_free_ids(struct acpi_device *device) { struct acpi_hardware_id *id, *tmp; diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index f0b9681..f83d581 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -379,6 +379,8 @@ int acpi_bus_start(struct acpi_device *device); acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd); int acpi_match_device_ids(struct acpi_device *device, const struct acpi_device_id *ids); +int acpi_match_object_info_ids(struct acpi_device_info *info, + const struct acpi_device_id *ids); int acpi_create_dir(struct acpi_device *); void acpi_remove_dir(struct acpi_device *);