Skip to content

Commit

Permalink
ACPI / PCI: Fold acpi_pci_root_start() into acpi_pci_root_add()
Browse files Browse the repository at this point in the history
Move the code from the ACPI PCI root bridge's .start() callback
routine, acpi_pci_root_start(), directly into acpi_pci_root_add()
and drop acpi_pci_root_start().

It is safe to do that, because it is now always guaranteed that
when struct pci_dev objects are created, their companion struct
acpi_device objects are already present, so it is not necessary to
wait for them to be created before calling pci_bus_add_devices().

This change was previously proposed in a different form by
Yinghai Lu.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
Acked-by: Toshi Kani <toshi.kani@hp.com>
  • Loading branch information
Rafael J. Wysocki committed Jan 3, 2013
1 parent 4002bf3 commit 47525cd
Showing 1 changed file with 11 additions and 21 deletions.
32 changes: 11 additions & 21 deletions drivers/acpi/pci_root.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ ACPI_MODULE_NAME("pci_root");
#define ACPI_PCI_ROOT_DEVICE_NAME "PCI Root Bridge"
static int acpi_pci_root_add(struct acpi_device *device);
static int acpi_pci_root_remove(struct acpi_device *device, int type);
static int acpi_pci_root_start(struct acpi_device *device);

#define ACPI_PCIE_REQ_SUPPORT (OSC_EXT_PCI_CONFIG_SUPPORT \
| OSC_ACTIVE_STATE_PWR_SUPPORT \
Expand All @@ -67,7 +66,6 @@ static struct acpi_driver acpi_pci_root_driver = {
.ops = {
.add = acpi_pci_root_add,
.remove = acpi_pci_root_remove,
.start = acpi_pci_root_start,
},
};

Expand Down Expand Up @@ -453,6 +451,7 @@ static int acpi_pci_root_add(struct acpi_device *device)
struct acpi_pci_root *root;
acpi_handle handle;
struct acpi_device *child;
struct acpi_pci_driver *driver;
u32 flags, base_flags;
bool is_osc_granted = false;

Expand Down Expand Up @@ -632,24 +631,6 @@ static int acpi_pci_root_add(struct acpi_device *device)
if (device->wakeup.flags.run_wake)
device_set_run_wake(root->bus->bridge, true);

return 0;

out_del_root:
mutex_lock(&acpi_pci_root_lock);
list_del(&root->node);
mutex_unlock(&acpi_pci_root_lock);

acpi_pci_irq_del_prt(root->segment, root->secondary.start);
end:
kfree(root);
return result;
}

static int acpi_pci_root_start(struct acpi_device *device)
{
struct acpi_pci_root *root = acpi_driver_data(device);
struct acpi_pci_driver *driver;

if (system_state != SYSTEM_BOOTING)
pci_assign_unassigned_bus_resources(root->bus);

Expand All @@ -664,8 +645,17 @@ static int acpi_pci_root_start(struct acpi_device *device)
pci_enable_bridges(root->bus);

pci_bus_add_devices(root->bus);

return 0;

out_del_root:
mutex_lock(&acpi_pci_root_lock);
list_del(&root->node);
mutex_unlock(&acpi_pci_root_lock);

acpi_pci_irq_del_prt(root->segment, root->secondary.start);
end:
kfree(root);
return result;
}

static int acpi_pci_root_remove(struct acpi_device *device, int type)
Expand Down

0 comments on commit 47525cd

Please sign in to comment.