diff options
Diffstat (limited to 'drivers/pci/hotplug')
-rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 56 | ||||
-rw-r--r-- | drivers/pci/hotplug/sgi_hotplug.c | 15 |
2 files changed, 30 insertions, 41 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 3d6d4fd1e3c5..a951c22921d1 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -734,34 +734,24 @@ static unsigned char acpiphp_max_busnr(struct pci_bus *bus) | |||
734 | */ | 734 | */ |
735 | static int acpiphp_bus_add(struct acpiphp_func *func) | 735 | static 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 |
749 | * the bus then re-add it... | 743 | * the bus then re-add it... |
750 | */ | 744 | */ |
751 | ret_val = acpi_bus_trim(device, 1); | 745 | acpi_bus_trim(device); |
752 | dbg("acpi_bus_trim return %x\n", ret_val); | ||
753 | } | 746 | } |
754 | 747 | ||
755 | ret_val = acpi_bus_add(&device, pdevice, func->handle, | 748 | ret_val = acpi_bus_scan(func->handle); |
756 | ACPI_BUS_TYPE_DEVICE); | 749 | if (!ret_val) |
757 | if (ret_val) { | 750 | ret_val = acpi_bus_get_device(func->handle, &device); |
758 | dbg("error adding bus, %x\n", | 751 | |
759 | -ret_val); | 752 | if (ret_val) |
760 | goto acpiphp_bus_add_out; | 753 | dbg("error adding bus, %x\n", -ret_val); |
761 | } | ||
762 | ret_val = acpi_bus_start(device); | ||
763 | 754 | ||
764 | acpiphp_bus_add_out: | ||
765 | return ret_val; | 755 | return ret_val; |
766 | } | 756 | } |
767 | 757 | ||
@@ -781,11 +771,8 @@ static int acpiphp_bus_trim(acpi_handle handle) | |||
781 | return retval; | 771 | return retval; |
782 | } | 772 | } |
783 | 773 | ||
784 | retval = acpi_bus_trim(device, 1); | 774 | acpi_bus_trim(device); |
785 | if (retval) | 775 | return 0; |
786 | err("cannot remove from acpi list\n"); | ||
787 | |||
788 | return retval; | ||
789 | } | 776 | } |
790 | 777 | ||
791 | static void acpiphp_set_acpi_region(struct acpiphp_slot *slot) | 778 | static void acpiphp_set_acpi_region(struct acpiphp_slot *slot) |
@@ -1130,8 +1117,7 @@ static int acpiphp_configure_bridge (acpi_handle handle) | |||
1130 | 1117 | ||
1131 | static void handle_bridge_insertion(acpi_handle handle, u32 type) | 1118 | static void handle_bridge_insertion(acpi_handle handle, u32 type) |
1132 | { | 1119 | { |
1133 | struct acpi_device *device, *pdevice; | 1120 | struct acpi_device *device; |
1134 | acpi_handle phandle; | ||
1135 | 1121 | ||
1136 | if ((type != ACPI_NOTIFY_BUS_CHECK) && | 1122 | if ((type != ACPI_NOTIFY_BUS_CHECK) && |
1137 | (type != ACPI_NOTIFY_DEVICE_CHECK)) { | 1123 | (type != ACPI_NOTIFY_DEVICE_CHECK)) { |
@@ -1139,17 +1125,15 @@ static void handle_bridge_insertion(acpi_handle handle, u32 type) | |||
1139 | return; | 1125 | return; |
1140 | } | 1126 | } |
1141 | 1127 | ||
1142 | acpi_get_parent(handle, &phandle); | 1128 | if (acpi_bus_scan(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"); | 1129 | err("cannot add bridge to acpi list\n"); |
1149 | return; | 1130 | return; |
1150 | } | 1131 | } |
1151 | if (!acpiphp_configure_bridge(handle) && | 1132 | if (acpi_bus_get_device(handle, &device)) { |
1152 | !acpi_bus_start(device)) | 1133 | err("ACPI device object missing\n"); |
1134 | return; | ||
1135 | } | ||
1136 | if (!acpiphp_configure_bridge(handle)) | ||
1153 | add_bridge(handle); | 1137 | add_bridge(handle); |
1154 | else | 1138 | else |
1155 | err("cannot configure and start bridge\n"); | 1139 | err("cannot configure and start bridge\n"); |
@@ -1234,6 +1218,8 @@ static void _handle_hotplug_event_bridge(struct work_struct *work) | |||
1234 | handle = hp_work->handle; | 1218 | handle = hp_work->handle; |
1235 | type = hp_work->type; | 1219 | type = hp_work->type; |
1236 | 1220 | ||
1221 | acpi_scan_lock_acquire(); | ||
1222 | |||
1237 | if (acpi_bus_get_device(handle, &device)) { | 1223 | if (acpi_bus_get_device(handle, &device)) { |
1238 | /* This bridge must have just been physically inserted */ | 1224 | /* This bridge must have just been physically inserted */ |
1239 | handle_bridge_insertion(handle, type); | 1225 | handle_bridge_insertion(handle, type); |
@@ -1311,6 +1297,7 @@ static void _handle_hotplug_event_bridge(struct work_struct *work) | |||
1311 | } | 1297 | } |
1312 | 1298 | ||
1313 | out: | 1299 | out: |
1300 | acpi_scan_lock_release(); | ||
1314 | kfree(hp_work); /* allocated in handle_hotplug_event_bridge */ | 1301 | kfree(hp_work); /* allocated in handle_hotplug_event_bridge */ |
1315 | } | 1302 | } |
1316 | 1303 | ||
@@ -1357,6 +1344,8 @@ static void _handle_hotplug_event_func(struct work_struct *work) | |||
1357 | 1344 | ||
1358 | func = (struct acpiphp_func *)context; | 1345 | func = (struct acpiphp_func *)context; |
1359 | 1346 | ||
1347 | acpi_scan_lock_acquire(); | ||
1348 | |||
1360 | switch (type) { | 1349 | switch (type) { |
1361 | case ACPI_NOTIFY_BUS_CHECK: | 1350 | case ACPI_NOTIFY_BUS_CHECK: |
1362 | /* bus re-enumerate */ | 1351 | /* bus re-enumerate */ |
@@ -1387,6 +1376,7 @@ static void _handle_hotplug_event_func(struct work_struct *work) | |||
1387 | break; | 1376 | break; |
1388 | } | 1377 | } |
1389 | 1378 | ||
1379 | acpi_scan_lock_release(); | ||
1390 | kfree(hp_work); /* allocated in handle_hotplug_event_func */ | 1380 | kfree(hp_work); /* allocated in handle_hotplug_event_func */ |
1391 | } | 1381 | } |
1392 | 1382 | ||
diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c index f64ca92253da..574421bc2fa6 100644 --- a/drivers/pci/hotplug/sgi_hotplug.c +++ b/drivers/pci/hotplug/sgi_hotplug.c | |||
@@ -412,7 +412,6 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
412 | if (SN_ACPI_BASE_SUPPORT() && ssdt) { | 412 | if (SN_ACPI_BASE_SUPPORT() && ssdt) { |
413 | unsigned long long adr; | 413 | unsigned long long adr; |
414 | struct acpi_device *pdevice; | 414 | struct acpi_device *pdevice; |
415 | struct acpi_device *device; | ||
416 | acpi_handle phandle; | 415 | acpi_handle phandle; |
417 | acpi_handle chandle = NULL; | 416 | acpi_handle chandle = NULL; |
418 | acpi_handle rethandle; | 417 | acpi_handle rethandle; |
@@ -426,6 +425,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
426 | pdevice = NULL; | 425 | pdevice = NULL; |
427 | } | 426 | } |
428 | 427 | ||
428 | acpi_scan_lock_acquire(); | ||
429 | /* | 429 | /* |
430 | * Walk the rootbus node's immediate children looking for | 430 | * Walk the rootbus node's immediate children looking for |
431 | * the slot's device node(s). There can be more than | 431 | * the slot's device node(s). There can be more than |
@@ -448,20 +448,18 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
448 | if (ACPI_SUCCESS(ret) && | 448 | if (ACPI_SUCCESS(ret) && |
449 | (adr>>16) == (slot->device_num + 1)) { | 449 | (adr>>16) == (slot->device_num + 1)) { |
450 | 450 | ||
451 | ret = acpi_bus_add(&device, pdevice, chandle, | 451 | ret = acpi_bus_scan(chandle); |
452 | ACPI_BUS_TYPE_DEVICE); | ||
453 | if (ACPI_FAILURE(ret)) { | 452 | if (ACPI_FAILURE(ret)) { |
454 | printk(KERN_ERR "%s: acpi_bus_add " | 453 | printk(KERN_ERR "%s: acpi_bus_scan " |
455 | "failed (0x%x) for slot %d " | 454 | "failed (0x%x) for slot %d " |
456 | "func %d\n", __func__, | 455 | "func %d\n", __func__, |
457 | ret, (int)(adr>>16), | 456 | ret, (int)(adr>>16), |
458 | (int)(adr&0xffff)); | 457 | (int)(adr&0xffff)); |
459 | /* try to continue on */ | 458 | /* try to continue on */ |
460 | } else { | ||
461 | acpi_bus_start(device); | ||
462 | } | 459 | } |
463 | } | 460 | } |
464 | } | 461 | } |
462 | acpi_scan_lock_release(); | ||
465 | } | 463 | } |
466 | 464 | ||
467 | /* Call the driver for the new device */ | 465 | /* Call the driver for the new device */ |
@@ -512,6 +510,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
512 | /* Get the rootbus node pointer */ | 510 | /* Get the rootbus node pointer */ |
513 | phandle = PCI_CONTROLLER(slot->pci_bus)->acpi_handle; | 511 | phandle = PCI_CONTROLLER(slot->pci_bus)->acpi_handle; |
514 | 512 | ||
513 | acpi_scan_lock_acquire(); | ||
515 | /* | 514 | /* |
516 | * Walk the rootbus node's immediate children looking for | 515 | * Walk the rootbus node's immediate children looking for |
517 | * the slot's device node(s). There can be more than | 516 | * the slot's device node(s). There can be more than |
@@ -539,10 +538,10 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
539 | ret = acpi_bus_get_device(chandle, | 538 | ret = acpi_bus_get_device(chandle, |
540 | &device); | 539 | &device); |
541 | if (ACPI_SUCCESS(ret)) | 540 | if (ACPI_SUCCESS(ret)) |
542 | acpi_bus_trim(device, 1); | 541 | acpi_bus_trim(device); |
543 | } | 542 | } |
544 | } | 543 | } |
545 | 544 | acpi_scan_lock_release(); | |
546 | } | 545 | } |
547 | 546 | ||
548 | /* Free the SN resources assigned to the Linux device.*/ | 547 | /* Free the SN resources assigned to the Linux device.*/ |