Commit 54048cf8 authored by Sam Bobroff's avatar Sam Bobroff Committed by Michael Ellerman

powerpc/eeh: Factor out common code eeh_reset_device()

The caller will always pass NULL for 'rmv_data' when
'eeh_aware_driver' is true, so the first two calls to
eeh_pe_dev_traverse() can be combined without changing behaviour as
can the two arms of the final 'if' block.

This should not change behaviour.
Signed-off-by: default avatarSam Bobroff <sam.bobroff@au1.ibm.com>
Reviewed-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent d3136d77
...@@ -647,17 +647,13 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus, ...@@ -647,17 +647,13 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus,
* into pci_hp_add_devices(). * into pci_hp_add_devices().
*/ */
eeh_pe_state_mark(pe, EEH_PE_KEEP); eeh_pe_state_mark(pe, EEH_PE_KEEP);
if (!driver_eeh_aware) { if (driver_eeh_aware || (pe->type & EEH_PE_VF)) {
if (pe->type & EEH_PE_VF) { eeh_pe_dev_traverse(pe, eeh_rmv_device, rmv_data);
eeh_pe_dev_traverse(pe, eeh_rmv_device, NULL);
} else { } else {
pci_lock_rescan_remove(); pci_lock_rescan_remove();
pci_hp_remove_devices(bus); pci_hp_remove_devices(bus);
pci_unlock_rescan_remove(); pci_unlock_rescan_remove();
} }
} else {
eeh_pe_dev_traverse(pe, eeh_rmv_device, rmv_data);
}
/* /*
* Reset the pci controller. (Asserts RST#; resets config space). * Reset the pci controller. (Asserts RST#; resets config space).
...@@ -691,8 +687,9 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus, ...@@ -691,8 +687,9 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus,
* the device up before the scripts have taken it down, * the device up before the scripts have taken it down,
* potentially weird things happen. * potentially weird things happen.
*/ */
if (!driver_eeh_aware) { if (!driver_eeh_aware || rmv_data->removed) {
pr_info("EEH: Sleep 5s ahead of complete hotplug\n"); pr_info("EEH: Sleep 5s ahead of %s hotplug\n",
(driver_eeh_aware ? "partial" : "complete"));
ssleep(5); ssleep(5);
/* /*
...@@ -705,19 +702,10 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus, ...@@ -705,19 +702,10 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus,
if (pe->type & EEH_PE_VF) { if (pe->type & EEH_PE_VF) {
eeh_add_virt_device(edev, NULL); eeh_add_virt_device(edev, NULL);
} else { } else {
if (!driver_eeh_aware)
eeh_pe_state_clear(pe, EEH_PE_PRI_BUS); eeh_pe_state_clear(pe, EEH_PE_PRI_BUS);
pci_hp_add_devices(bus); pci_hp_add_devices(bus);
} }
} else if (rmv_data->removed) {
pr_info("EEH: Sleep 5s ahead of partial hotplug\n");
ssleep(5);
edev = list_first_entry(&pe->edevs, struct eeh_dev, list);
eeh_pe_traverse(pe, eeh_pe_detach_dev, NULL);
if (pe->type & EEH_PE_VF)
eeh_add_virt_device(edev, NULL);
else
pci_hp_add_devices(bus);
} }
eeh_pe_state_clear(pe, EEH_PE_KEEP); eeh_pe_state_clear(pe, EEH_PE_KEEP);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment