diff options
author | Len Brown <len.brown@intel.com> | 2008-10-22 23:19:50 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-10-22 23:19:50 -0400 |
commit | 955ba395616a78780e70dc3f3b0b56ca4db52e5c (patch) | |
tree | f5978cfdc2b5ede82445de6675301a0171e66ea0 /drivers/acpi/scan.c | |
parent | aa58329fc8ec50b379388fcad55f62c3493730d3 (diff) | |
parent | 383d7a11c9989205db44c7f1be339e5097062f03 (diff) |
Merge branch 'bugfixes' into test
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r-- | drivers/acpi/scan.c | 62 |
1 files changed, 36 insertions, 26 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index f6f52c1a2ab..91fed422bae 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -276,6 +276,13 @@ int acpi_match_device_ids(struct acpi_device *device, { const struct acpi_device_id *id; + /* + * If the device is not present, it is unnecessary to load device + * driver for it. + */ + if (!device->status.present) + return -ENODEV; + if (device->flags.hardware_id) { for (id = ids; id->id[0]; id++) { if (!strcmp((char*)id->id, device->pnp.hardware_id)) @@ -807,6 +814,7 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) /* TBD: System wake support and resource requirements. */ device->power.state = ACPI_STATE_UNKNOWN; + acpi_bus_get_power(device->handle, &(device->power.state)); return 0; } @@ -1153,20 +1161,6 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice) } static int -acpi_is_child_device(struct acpi_device *device, - int (*matcher)(struct acpi_device *)) -{ - int result = -ENODEV; - - do { - if (ACPI_SUCCESS(matcher(device))) - return AE_OK; - } while ((device = device->parent)); - - return result; -} - -static int acpi_add_single_object(struct acpi_device **child, struct acpi_device *parent, acpi_handle handle, int type, struct acpi_bus_ops *ops) @@ -1221,15 +1215,18 @@ acpi_add_single_object(struct acpi_device **child, result = -ENODEV; goto end; } - if (!device->status.present) { - /* Bay and dock should be handled even if absent */ - if (!ACPI_SUCCESS( - acpi_is_child_device(device, acpi_bay_match)) && - !ACPI_SUCCESS( - acpi_is_child_device(device, acpi_dock_match))) { - result = -ENODEV; - goto end; - } + /* + * When the device is neither present nor functional, the + * device should not be added to Linux ACPI device tree. + * When the status of the device is not present but functinal, + * it should be added to Linux ACPI tree. For example : bay + * device , dock device. + * In such conditions it is unncessary to check whether it is + * bay device or dock device. + */ + if (!device->status.present && !device->status.functional) { + result = -ENODEV; + goto end; } break; default: @@ -1252,6 +1249,16 @@ acpi_add_single_object(struct acpi_device **child, acpi_device_set_id(device, parent, handle, type); /* + * The ACPI device is attached to acpi handle before getting + * the power/wakeup/peformance flags. Otherwise OS can't get + * the corresponding ACPI device by the acpi handle in the course + * of getting the power/wakeup/performance flags. + */ + result = acpi_device_set_context(device, type); + if (result) + goto end; + + /* * Power Management * ---------------- */ @@ -1281,8 +1288,6 @@ acpi_add_single_object(struct acpi_device **child, goto end; } - if ((result = acpi_device_set_context(device, type))) - goto end; result = acpi_device_register(device, parent); @@ -1402,7 +1407,12 @@ static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops) * TBD: Need notifications and other detection mechanisms * in place before we can fully implement this. */ - if (child->status.present) { + /* + * When the device is not present but functional, it is also + * necessary to scan the children of this device. + */ + if (child->status.present || (!child->status.present && + child->status.functional)) { status = acpi_get_next_object(ACPI_TYPE_ANY, chandle, NULL, NULL); if (ACPI_SUCCESS(status)) { |