public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
From: Tang Chen <tangchen@cn.fujitsu.com>
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 <tangchen@cn.fujitsu.com>
Subject: [PATCH 1/3] Introduce a new acpi to determine HID match.
Date: Fri, 12 Oct 2012 18:31:28 +0800	[thread overview]
Message-ID: <1350037890-5899-2-git-send-email-tangchen@cn.fujitsu.com> (raw)
In-Reply-To: <1350037890-5899-1-git-send-email-tangchen@cn.fujitsu.com>

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 <tangchen@cn.fujitsu.com>
---
 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 *);
 
-- 
1.7.1


  reply	other threads:[~2012-10-12 10:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-12 10:31 [PATCH 0/3] Find pci root bridges by comparing HID from acpi_device_info, not acpi_device Tang Chen
2012-10-12 10:31 ` Tang Chen [this message]
2012-10-12 10:31 ` [PATCH 2/3] Do not use acpi_device to find pci root bridge in _init code Tang Chen
2012-10-12 10:36   ` Jiang Liu
2012-10-12 10:42     ` Tang Chen
2012-10-12 10:54       ` Jiang Liu
2012-10-12 10:58         ` Tang Chen
2012-10-12 18:34         ` Yinghai Lu
2012-10-12 22:00           ` Yinghai Lu
2012-10-12 10:31 ` [PATCH 3/3] Check exit status of acpi_install_notify_handler() in find_root_bridges() Tang Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1350037890-5899-2-git-send-email-tangchen@cn.fujitsu.com \
    --to=tangchen@cn.fujitsu.com \
    --cc=bhelgaas@google.com \
    --cc=izumi.taku@jp.fujitsu.com \
    --cc=jiang.liu@huawei.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox