All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shaohua Li <shaohua.li-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: acpi-dev <acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Cc: Adam Belay <ambx1-IBH0VoN/3vPQT0dZR+AlfA@public.gmane.org>,
	Len <len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: [RFC 2/2]adjust initialization order
Date: Mon, 12 Sep 2005 13:22:27 +0800	[thread overview]
Message-ID: <1126502548.5153.19.camel@linux-hp.sh.intel.com> (raw)

Hi,
adjust the initialization order slightly, so PCI device enumeration is after
ACPI device enumeration.

Thanks,
Shaohua
---

 linux-2.6.13-root/drivers/acpi/Makefile |    6 +-
 linux-2.6.13-root/drivers/acpi/scan.c   |   66 +++++++++++++++++++++++++-------
 2 files changed, 56 insertions(+), 16 deletions(-)

diff -puN drivers/acpi/Makefile~adjust_init_order drivers/acpi/Makefile
--- linux-2.6.13/drivers/acpi/Makefile~adjust_init_order	2005-09-05 13:51:23.000000000 +0800
+++ linux-2.6.13-root/drivers/acpi/Makefile	2005-09-05 13:51:23.000000000 +0800
@@ -37,6 +37,9 @@ endif
 
 obj-$(CONFIG_ACPI_BUS)		+= sleep/
 obj-$(CONFIG_ACPI_BUS)		+= bus.o glue.o
+obj-$(CONFIG_ACPI_SYSTEM)	+= system.o event.o
+obj-$(CONFIG_ACPI_DEBUG)	+= debug.o
+obj-$(CONFIG_ACPI_BUS)		+= scan.o motherboard.o
 obj-$(CONFIG_ACPI_AC) 		+= ac.o
 obj-$(CONFIG_ACPI_BATTERY)	+= battery.o
 obj-$(CONFIG_ACPI_BUTTON)	+= button.o
@@ -49,11 +52,8 @@ obj-$(CONFIG_ACPI_POWER)	+= power.o
 obj-$(CONFIG_ACPI_PROCESSOR)	+= processor.o
 obj-$(CONFIG_ACPI_CONTAINER)	+= container.o
 obj-$(CONFIG_ACPI_THERMAL)	+= thermal.o
-obj-$(CONFIG_ACPI_SYSTEM)	+= system.o event.o
-obj-$(CONFIG_ACPI_DEBUG)	+= debug.o
 obj-$(CONFIG_ACPI_NUMA)		+= numa.o
 obj-$(CONFIG_ACPI_ASUS)		+= asus_acpi.o
 obj-$(CONFIG_ACPI_IBM)		+= ibm_acpi.o
 obj-$(CONFIG_ACPI_TOSHIBA)	+= toshiba_acpi.o
-obj-$(CONFIG_ACPI_BUS)		+= scan.o motherboard.o
 obj-$(CONFIG_ACPI_HOTPLUG_MEMORY)	+= acpi_memhotplug.o
diff -puN drivers/acpi/scan.c~adjust_init_order drivers/acpi/scan.c
--- linux-2.6.13/drivers/acpi/scan.c~adjust_init_order	2005-09-05 13:51:23.000000000 +0800
+++ linux-2.6.13-root/drivers/acpi/scan.c	2005-09-05 13:51:23.000000000 +0800
@@ -716,6 +716,51 @@ acpi_bus_match (
 	return acpi_match_ids(device, driver->ids);
 }
 
+static void acpi_bind_child_devices(struct acpi_device *start)
+{
+	acpi_status		status;
+	struct acpi_device	*parent, *child;
+	acpi_handle		phandle, chandle;
+	u32			level = 1;
+
+	parent  = start;
+	phandle = start->handle;
+	child = chandle = NULL;
+
+	while ((level > 0) && parent) {
+		status = acpi_get_next_object(ACPI_TYPE_ANY, phandle,
+				chandle, &chandle);
+
+		/*
+		 * If this scope is exhausted then move our way back up.
+		 */
+		if (ACPI_FAILURE(status)) {
+			level--;
+			chandle = phandle;
+			acpi_get_parent(phandle, &phandle);
+			child = parent;
+			parent = parent->parent;
+
+			continue;
+		}
+
+		/*
+		 * If there is a device corresponding to chandle then
+		 * parse it
+		 */
+		if (acpi_bus_get_device(chandle, &child) == 0) {
+			if (child->flags.bus_address)
+				if (child->parent && child->parent->ops.bind)
+					child->parent->ops.bind(child);
+
+			level++;
+			phandle = chandle;
+			chandle = NULL;
+			parent = child;
+		}
+		continue;
+	}
+}
 
 /**
  * acpi_bus_driver_init 
@@ -746,7 +791,14 @@ acpi_bus_driver_init (
 	}
 
 	device->driver = driver;
-
+	/*
+	 * Bind _ADR-Based Devices
+	 * -----------------------
+	 * If there's a a bus address (_ADR) then we utilize the parent's
+	 * 'bind' function (if exists) to bind the ACPI- and natively-
+	 * enumerated device representations.
+	 */
+	acpi_bind_child_devices(device);
 	/*
 	 * TBD - Configuration Management: Assign resources to device based
 	 * upon possible configuration and currently allocated resources.
@@ -1334,18 +1386,6 @@ acpi_add_single_object (
 	acpi_device_register(device,parent);
 
 	/*
-	 * Bind _ADR-Based Devices
-	 * -----------------------
-	 * If there's a a bus address (_ADR) then we utilize the parent's 
-	 * 'bind' function (if exists) to bind the ACPI- and natively-
-	 * enumerated device representations.
-	 */
-	if (device->flags.bus_address) {
-		if (device->parent && device->parent->ops.bind)
-			device->parent->ops.bind(device);
-	}
-
-	/*
 	 * Locate & Attach Driver
 	 * ----------------------
 	 * If there's a hardware id (_HID) or compatible ids (_CID) we check
_




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

                 reply	other threads:[~2005-09-12  5:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1126502548.5153.19.camel@linux-hp.sh.intel.com \
    --to=shaohua.li-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=ambx1-IBH0VoN/3vPQT0dZR+AlfA@public.gmane.org \
    --cc=len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.