Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 350825
b: refs/heads/master
c: 0fc300b
h: refs/heads/master
i:
  350823: 6b49786
v: v3
  • Loading branch information
Rafael J. Wysocki committed Jan 3, 2013
1 parent 60d029b commit 11a94bc
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 92ef2a25c763338905dce8344a0584606f842920
refs/heads/master: 0fc300b0537c6a6a7f2b261b6c339dc498cd1702
63 changes: 35 additions & 28 deletions trunk/drivers/acpi/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1623,10 +1623,9 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl,
return AE_OK;
}

static acpi_status acpi_bus_probe_start(acpi_handle handle, u32 lvl,
void *context, void **not_used)
static acpi_status acpi_bus_device_attach(acpi_handle handle, u32 lvl_not_used,
void *not_used, void **ret_not_used)
{
struct acpi_bus_ops *ops = context;
acpi_status status = AE_OK;
struct acpi_device *device;
unsigned long long sta_not_used;
Expand All @@ -1642,16 +1641,11 @@ static acpi_status acpi_bus_probe_start(acpi_handle handle, u32 lvl,
if (acpi_bus_get_device(handle, &device))
return AE_CTRL_DEPTH;

if (ops->acpi_op_add) {
if (!acpi_match_device_ids(device, acpi_platform_device_ids)) {
/* This is a known good platform device. */
acpi_create_platform_device(device);
} else if (device_attach(&device->dev)) {
status = AE_CTRL_DEPTH;
}
} else if (ops->acpi_op_start) {
if (ACPI_FAILURE(acpi_start_single_object(device)))
status = AE_CTRL_DEPTH;
if (!acpi_match_device_ids(device, acpi_platform_device_ids)) {
/* This is a known good platform device. */
acpi_create_platform_device(device);
} else if (device_attach(&device->dev)) {
status = AE_CTRL_DEPTH;
}
return status;
}
Expand All @@ -1672,10 +1666,10 @@ static int acpi_bus_scan(acpi_handle handle, struct acpi_bus_ops *ops,
goto out;

ret = 0;
status = acpi_bus_probe_start(handle, 0, ops, NULL);
status = acpi_bus_device_attach(handle, 0, NULL, NULL);
if (ACPI_SUCCESS(status))
acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX,
acpi_bus_probe_start, NULL, ops, NULL);
acpi_bus_device_attach, NULL, NULL, NULL);

out:
if (child)
Expand All @@ -1700,31 +1694,44 @@ int
acpi_bus_add(struct acpi_device **child,
struct acpi_device *parent, acpi_handle handle, int type)
{
struct acpi_bus_ops ops;

memset(&ops, 0, sizeof(ops));
ops.acpi_op_add = 1;
struct acpi_bus_ops ops = { .acpi_op_add = 1, };

return acpi_bus_scan(handle, &ops, child);
}
EXPORT_SYMBOL(acpi_bus_add);

int acpi_bus_start(struct acpi_device *device)
static acpi_status acpi_bus_start_device(acpi_handle handle, u32 lvl,
void *not_used, void **ret_not_used)
{
struct acpi_bus_ops ops;
int result;
struct acpi_device *device;
unsigned long long sta_not_used;
int type_not_used;

/*
* Ignore errors ignored by acpi_bus_check_add() to avoid terminating
* namespace walks prematurely.
*/
if (acpi_bus_type_and_status(handle, &type_not_used, &sta_not_used))
return AE_OK;

if (acpi_bus_get_device(handle, &device))
return AE_CTRL_DEPTH;

return acpi_start_single_object(device);
}

int acpi_bus_start(struct acpi_device *device)
{
if (!device)
return -EINVAL;

memset(&ops, 0, sizeof(ops));
ops.acpi_op_start = 1;

result = acpi_bus_scan(device->handle, &ops, NULL);
if (ACPI_SUCCESS(acpi_start_single_object(device)))
acpi_walk_namespace(ACPI_TYPE_ANY, device->handle,
ACPI_UINT32_MAX, acpi_bus_start_device,
NULL, NULL, NULL);

acpi_update_all_gpes();

return result;
return 0;
}
EXPORT_SYMBOL(acpi_bus_start);

Expand Down

0 comments on commit 11a94bc

Please sign in to comment.