Skip to content

Commit

Permalink
Merge branch 'pci/yinghai-survey-resources+acpi-scan' into next
Browse files Browse the repository at this point in the history
* pci/yinghai-survey-resources+acpi-scan:
  ACPI / scan: Treat power resources in a special way
  ACPI: Remove unused struct acpi_pci_root.id member
  ACPI: Drop ACPI device .bind() and .unbind() callbacks
  ACPI / PCI: Move the _PRT setup and cleanup code to pci-acpi.c
  ACPI / PCI: Rework the setup and cleanup of device wakeup
  ACPI: Add .setup() and .cleanup() callbacks to struct acpi_bus_type
  ACPI: Make acpi_bus_scan() and acpi_bus_add() take only one argument
  ACPI: Replace ACPI device add_type field with a match_driver flag
  ACPI: Drop the second argument of acpi_bus_scan()
  ACPI: Remove the arguments of acpi_bus_add() that are not used
  ACPI: Remove acpi_start_single_object() and acpi_bus_start()
  ACPI / PCI: Fold acpi_pci_root_start() into acpi_pci_root_add()
  ACPI: Change the ordering of acpi_bus_check_add()
  ACPI: Replace struct acpi_bus_ops with enum type
  ACPI: Reduce the usage of struct acpi_bus_ops
  ACPI: Make acpi_bus_add() and acpi_bus_start() visibly different
  ACPI: Change the ordering of PCI root bridge driver registrarion
  ACPI: Separate adding ACPI device objects from probing ACPI drivers
  • Loading branch information
Bjorn Helgaas committed Jan 10, 2013
2 parents e84813c + 295a7f6 commit b704046
Show file tree
Hide file tree
Showing 19 changed files with 232 additions and 479 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
24 changes: 6 additions & 18 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
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
15 changes: 4 additions & 11 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 Down
50 changes: 35 additions & 15 deletions drivers/acpi/glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,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 @@ -264,28 +267,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 @@ -304,6 +318,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 b704046

Please sign in to comment.