aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/acpiphp_glue.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug/acpiphp_glue.c')
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c40
1 files changed, 14 insertions, 26 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 3d6d4fd1e3c5..91b5ad875c53 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -734,15 +734,9 @@ static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
734 */ 734 */
735static int acpiphp_bus_add(struct acpiphp_func *func) 735static int acpiphp_bus_add(struct acpiphp_func *func)
736{ 736{
737 acpi_handle phandle; 737 struct acpi_device *device;
738 struct acpi_device *device, *pdevice;
739 int ret_val; 738 int ret_val;
740 739
741 acpi_get_parent(func->handle, &phandle);
742 if (acpi_bus_get_device(phandle, &pdevice)) {
743 dbg("no parent device, assuming NULL\n");
744 pdevice = NULL;
745 }
746 if (!acpi_bus_get_device(func->handle, &device)) { 740 if (!acpi_bus_get_device(func->handle, &device)) {
747 dbg("bus exists... trim\n"); 741 dbg("bus exists... trim\n");
748 /* this shouldn't be in here, so remove 742 /* this shouldn't be in here, so remove
@@ -752,16 +746,13 @@ static int acpiphp_bus_add(struct acpiphp_func *func)
752 dbg("acpi_bus_trim return %x\n", ret_val); 746 dbg("acpi_bus_trim return %x\n", ret_val);
753 } 747 }
754 748
755 ret_val = acpi_bus_add(&device, pdevice, func->handle, 749 ret_val = acpi_bus_add(func->handle);
756 ACPI_BUS_TYPE_DEVICE); 750 if (!ret_val)
757 if (ret_val) { 751 ret_val = acpi_bus_get_device(func->handle, &device);
758 dbg("error adding bus, %x\n", 752
759 -ret_val); 753 if (ret_val)
760 goto acpiphp_bus_add_out; 754 dbg("error adding bus, %x\n", -ret_val);
761 }
762 ret_val = acpi_bus_start(device);
763 755
764acpiphp_bus_add_out:
765 return ret_val; 756 return ret_val;
766} 757}
767 758
@@ -1130,8 +1121,7 @@ static int acpiphp_configure_bridge (acpi_handle handle)
1130 1121
1131static void handle_bridge_insertion(acpi_handle handle, u32 type) 1122static void handle_bridge_insertion(acpi_handle handle, u32 type)
1132{ 1123{
1133 struct acpi_device *device, *pdevice; 1124 struct acpi_device *device;
1134 acpi_handle phandle;
1135 1125
1136 if ((type != ACPI_NOTIFY_BUS_CHECK) && 1126 if ((type != ACPI_NOTIFY_BUS_CHECK) &&
1137 (type != ACPI_NOTIFY_DEVICE_CHECK)) { 1127 (type != ACPI_NOTIFY_DEVICE_CHECK)) {
@@ -1139,17 +1129,15 @@ static void handle_bridge_insertion(acpi_handle handle, u32 type)
1139 return; 1129 return;
1140 } 1130 }
1141 1131
1142 acpi_get_parent(handle, &phandle); 1132 if (acpi_bus_add(handle)) {
1143 if (acpi_bus_get_device(phandle, &pdevice)) {
1144 dbg("no parent device, assuming NULL\n");
1145 pdevice = NULL;
1146 }
1147 if (acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE)) {
1148 err("cannot add bridge to acpi list\n"); 1133 err("cannot add bridge to acpi list\n");
1149 return; 1134 return;
1150 } 1135 }
1151 if (!acpiphp_configure_bridge(handle) && 1136 if (acpi_bus_get_device(handle, &device)) {
1152 !acpi_bus_start(device)) 1137 err("ACPI device object missing\n");
1138 return;
1139 }
1140 if (!acpiphp_configure_bridge(handle))
1153 add_bridge(handle); 1141 add_bridge(handle);
1154 else 1142 else
1155 err("cannot configure and start bridge\n"); 1143 err("cannot configure and start bridge\n");