aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-09-21 15:29:50 -0400
committerLen Brown <len.brown@intel.com>2009-09-25 14:24:29 -0400
commit859ac9a4be0c753cece0e30a2e4a65fd2cdcaeee (patch)
tree10962790433ee0865ab6506c69981e8248368e46 /drivers/acpi
parentadc08e2035f1859d4b129f42b2c2305ef090d226 (diff)
ACPI: identify device tree root by null parent pointer, not ACPI_BUS_TYPE
We can identify the root of the ACPI device tree by the fact that it has no parent. This is simpler than passing around ACPI_BUS_TYPE_SYSTEM and will help remove special treatment of the device tree root. Currently, we add the root by hand with ACPI_BUS_TYPE_SYSTEM. If we traverse the tree treating the root as just another device and use acpi_get_type(), the root shows up as ACPI_TYPE_DEVICE. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/scan.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 27d2dec55c6..0b5aaf059c9 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -22,6 +22,8 @@ extern struct acpi_device *acpi_root;
22#define ACPI_BUS_HID "LNXSYBUS" 22#define ACPI_BUS_HID "LNXSYBUS"
23#define ACPI_BUS_DEVICE_NAME "System Bus" 23#define ACPI_BUS_DEVICE_NAME "System Bus"
24 24
25#define ACPI_IS_ROOT_DEVICE(device) (!(device)->parent)
26
25static LIST_HEAD(acpi_device_list); 27static LIST_HEAD(acpi_device_list);
26static LIST_HEAD(acpi_bus_id_list); 28static LIST_HEAD(acpi_bus_id_list);
27DEFINE_MUTEX(acpi_device_lock); 29DEFINE_MUTEX(acpi_device_lock);
@@ -955,10 +957,12 @@ static void acpi_device_get_busid(struct acpi_device *device)
955 * The device's Bus ID is simply the object name. 957 * The device's Bus ID is simply the object name.
956 * TBD: Shouldn't this value be unique (within the ACPI namespace)? 958 * TBD: Shouldn't this value be unique (within the ACPI namespace)?
957 */ 959 */
958 switch (device->device_type) { 960 if (ACPI_IS_ROOT_DEVICE(device)) {
959 case ACPI_BUS_TYPE_SYSTEM:
960 strcpy(device->pnp.bus_id, "ACPI"); 961 strcpy(device->pnp.bus_id, "ACPI");
961 break; 962 return;
963 }
964
965 switch (device->device_type) {
962 case ACPI_BUS_TYPE_POWER_BUTTON: 966 case ACPI_BUS_TYPE_POWER_BUTTON:
963 strcpy(device->pnp.bus_id, "PWRF"); 967 strcpy(device->pnp.bus_id, "PWRF");
964 break; 968 break;
@@ -1093,6 +1097,11 @@ static void acpi_device_set_id(struct acpi_device *device)
1093 1097
1094 switch (device->device_type) { 1098 switch (device->device_type) {
1095 case ACPI_BUS_TYPE_DEVICE: 1099 case ACPI_BUS_TYPE_DEVICE:
1100 if (ACPI_IS_ROOT_DEVICE(device)) {
1101 hid = ACPI_SYSTEM_HID;
1102 break;
1103 }
1104
1096 status = acpi_get_object_info(device->handle, &info); 1105 status = acpi_get_object_info(device->handle, &info);
1097 if (ACPI_FAILURE(status)) { 1106 if (ACPI_FAILURE(status)) {
1098 printk(KERN_ERR PREFIX "%s: Error reading device info\n", __func__); 1107 printk(KERN_ERR PREFIX "%s: Error reading device info\n", __func__);
@@ -1129,9 +1138,6 @@ static void acpi_device_set_id(struct acpi_device *device)
1129 case ACPI_BUS_TYPE_PROCESSOR: 1138 case ACPI_BUS_TYPE_PROCESSOR:
1130 hid = ACPI_PROCESSOR_OBJECT_HID; 1139 hid = ACPI_PROCESSOR_OBJECT_HID;
1131 break; 1140 break;
1132 case ACPI_BUS_TYPE_SYSTEM:
1133 hid = ACPI_SYSTEM_HID;
1134 break;
1135 case ACPI_BUS_TYPE_THERMAL: 1141 case ACPI_BUS_TYPE_THERMAL:
1136 hid = ACPI_THERMAL_HID; 1142 hid = ACPI_THERMAL_HID;
1137 break; 1143 break;
@@ -1643,7 +1649,7 @@ int __init acpi_scan_init(void)
1643 * Create the root device in the bus's device tree 1649 * Create the root device in the bus's device tree
1644 */ 1650 */
1645 result = acpi_add_single_object(&acpi_root, ACPI_ROOT_OBJECT, 1651 result = acpi_add_single_object(&acpi_root, ACPI_ROOT_OBJECT,
1646 ACPI_BUS_TYPE_SYSTEM, &ops); 1652 ACPI_BUS_TYPE_DEVICE, &ops);
1647 if (result) 1653 if (result)
1648 goto Done; 1654 goto Done;
1649 1655