Skip to content

Commit

Permalink
Merge branch 'acpi-scan' into acpi-pm
Browse files Browse the repository at this point in the history
The following commits depend on the 'acpi-scan' material.
  • Loading branch information
Rafael J. Wysocki committed Jan 17, 2013
2 parents 9931fac + 5993c46 commit 6a8dd80
Show file tree
Hide file tree
Showing 19 changed files with 279 additions and 563 deletions.
2 changes: 1 addition & 1 deletion drivers/acpi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ acpi-y += resource.o
acpi-y += processor_core.o
acpi-y += ec.o
acpi-$(CONFIG_ACPI_DOCK) += dock.o
acpi-y += pci_root.o pci_link.o pci_irq.o pci_bind.o
acpi-y += pci_root.o pci_link.o pci_irq.o
acpi-y += acpi_platform.o
acpi-y += power.o
acpi-y += event.o
Expand Down
26 changes: 7 additions & 19 deletions drivers/acpi/acpi_memhotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,38 +157,26 @@ static int
acpi_memory_get_device(acpi_handle handle,
struct acpi_memory_device **mem_device)
{
acpi_status status;
acpi_handle phandle;
struct acpi_device *device = NULL;
struct acpi_device *pdevice = NULL;
int result;


if (!acpi_bus_get_device(handle, &device) && device)
goto end;

status = acpi_get_parent(handle, &phandle);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Cannot find acpi parent"));
return -EINVAL;
}

/* Get the parent device */
result = acpi_bus_get_device(phandle, &pdevice);
if (result) {
acpi_handle_warn(phandle, "Cannot get acpi bus device\n");
return -EINVAL;
}

/*
* Now add the notified device. This creates the acpi_device
* and invokes .add function
*/
result = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
result = acpi_bus_add(handle);
if (result) {
acpi_handle_warn(handle, "Cannot add acpi bus\n");
return -EINVAL;
}
result = acpi_bus_get_device(handle, &device);
if (result) {
acpi_handle_warn(handle, "Missing device object\n");
return -EINVAL;
}

end:
*mem_device = acpi_driver_data(device);
Expand Down Expand Up @@ -355,7 +343,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
break;
}

ej_event->handle = handle;
ej_event->device = device;
ej_event->event = ACPI_NOTIFY_EJECT_REQUEST;
acpi_os_hotplug_execute(acpi_bus_hot_remove_device,
(void *)ej_event);
Expand Down
31 changes: 6 additions & 25 deletions drivers/acpi/container.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,30 +135,6 @@ static int acpi_container_remove(struct acpi_device *device, int type)
return status;
}

static int container_device_add(struct acpi_device **device, acpi_handle handle)
{
acpi_handle phandle;
struct acpi_device *pdev;
int result;


if (acpi_get_parent(handle, &phandle)) {
return -ENODEV;
}

if (acpi_bus_get_device(phandle, &pdev)) {
return -ENODEV;
}

if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_DEVICE)) {
return -ENODEV;
}

result = acpi_bus_start(*device);

return result;
}

static void container_notify_cb(acpi_handle handle, u32 type, void *context)
{
struct acpi_device *device = NULL;
Expand Down Expand Up @@ -190,11 +166,16 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
if (!ACPI_FAILURE(status) || device)
break;

result = container_device_add(&device, handle);
result = acpi_bus_add(handle);
if (result) {
acpi_handle_warn(handle, "Failed to add container\n");
break;
}
result = acpi_bus_get_device(handle, &device);
if (result) {
acpi_handle_warn(handle, "Missing device object\n");
break;
}

kobject_uevent(&device->dev.kobj, KOBJ_ONLINE);
ost_code = ACPI_OST_SC_SUCCESS;
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/device_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
* acpi_dev_pm_get_node - Get ACPI device node for the given physical device.
* @dev: Device to get the ACPI node for.
*/
static struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
{
acpi_handle handle = DEVICE_ACPI_HANDLE(dev);
struct acpi_device *adev;
Expand Down
17 changes: 5 additions & 12 deletions drivers/acpi/dock.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,25 +310,18 @@ static int dock_present(struct dock_station *ds)
static struct acpi_device * dock_create_acpi_device(acpi_handle handle)
{
struct acpi_device *device;
struct acpi_device *parent_device;
acpi_handle parent;
int ret;

if (acpi_bus_get_device(handle, &device)) {
/*
* no device created for this object,
* so we should create one.
*/
acpi_get_parent(handle, &parent);
if (acpi_bus_get_device(parent, &parent_device))
parent_device = NULL;

ret = acpi_bus_add(&device, parent_device, handle,
ACPI_BUS_TYPE_DEVICE);
if (ret) {
ret = acpi_bus_add(handle);
if (ret)
pr_debug("error adding bus, %x\n", -ret);
return NULL;
}

acpi_bus_get_device(handle, &device);
}
return device;
}
Expand All @@ -346,7 +339,7 @@ static void dock_remove_acpi_device(acpi_handle handle)
int ret;

if (!acpi_bus_get_device(handle, &device)) {
ret = acpi_bus_trim(device, 1);
ret = acpi_bus_trim(device);
if (ret)
pr_debug("error removing bus, %x\n", -ret);
}
Expand Down
50 changes: 35 additions & 15 deletions drivers/acpi/glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ static struct acpi_bus_type *acpi_get_bus_type(struct bus_type *type)
{
struct acpi_bus_type *tmp, *ret = NULL;

if (!type)
return NULL;

down_read(&bus_type_sem);
list_for_each_entry(tmp, &bus_type_list, list) {
if (tmp->bus == type) {
Expand Down Expand Up @@ -269,28 +272,39 @@ static int acpi_platform_notify(struct device *dev)
{
struct acpi_bus_type *type;
acpi_handle handle;
int ret = -EINVAL;
int ret;

ret = acpi_bind_one(dev, NULL);
if (!ret)
goto out;

if (!dev->bus || !dev->parent) {
if (ret && (!dev->bus || !dev->parent)) {
/* bridge devices genernally haven't bus or parent */
ret = acpi_find_bridge_device(dev, &handle);
goto end;
if (!ret) {
ret = acpi_bind_one(dev, handle);
if (ret)
goto out;
}
}

type = acpi_get_bus_type(dev->bus);
if (!type) {
DBG("No ACPI bus support for %s\n", dev_name(dev));
ret = -EINVAL;
goto end;
if (ret) {
if (!type || !type->find_device) {
DBG("No ACPI bus support for %s\n", dev_name(dev));
ret = -EINVAL;
goto out;
}

ret = type->find_device(dev, &handle);
if (ret) {
DBG("Unable to get handle for %s\n", dev_name(dev));
goto out;
}
ret = acpi_bind_one(dev, handle);
if (ret)
goto out;
}
if ((ret = type->find_device(dev, &handle)) != 0)
DBG("Can't get handler for %s\n", dev_name(dev));
end:
if (!ret)
acpi_bind_one(dev, handle);

if (type && type->setup)
type->setup(dev);

out:
#if ACPI_GLUE_DEBUG
Expand All @@ -309,6 +323,12 @@ static int acpi_platform_notify(struct device *dev)

static int acpi_platform_notify_remove(struct device *dev)
{
struct acpi_bus_type *type;

type = acpi_get_bus_type(dev->bus);
if (type && type->cleanup)
type->cleanup(dev);

acpi_unbind_one(dev);
return 0;
}
Expand Down
1 change: 1 addition & 0 deletions drivers/acpi/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ struct acpi_ec {

extern struct acpi_ec *first_ec;

int acpi_pci_root_init(void);
int acpi_ec_init(void);
int acpi_ec_ecdt_probe(void);
int acpi_boot_ec_enable(void);
Expand Down
122 changes: 0 additions & 122 deletions drivers/acpi/pci_bind.c

This file was deleted.

Loading

0 comments on commit 6a8dd80

Please sign in to comment.