powerpc/eeh: Small refactor of eeh_handle_normal_event()
The control flow of eeh_handle_normal_event() is a bit tricky. Break out one of the error handling paths - rather than be in an else block, we'll make it part of the regular body of the function and put a 'goto out;' in the true limb of the if. Signed-off-by: Daniel Axtens <dja@axtens.net> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20211015070628.1331635-1-dja@axtens.net
This commit is contained in:
parent
1e7684dc4f
commit
10b34ece13
@ -1054,45 +1054,46 @@ void eeh_handle_normal_event(struct eeh_pe *pe)
|
||||
}
|
||||
|
||||
pr_info("EEH: Recovery successful.\n");
|
||||
} else {
|
||||
/*
|
||||
* About 90% of all real-life EEH failures in the field
|
||||
* are due to poorly seated PCI cards. Only 10% or so are
|
||||
* due to actual, failed cards.
|
||||
*/
|
||||
pr_err("EEH: Unable to recover from failure from PHB#%x-PE#%x.\n"
|
||||
"Please try reseating or replacing it\n",
|
||||
pe->phb->global_number, pe->addr);
|
||||
goto out;
|
||||
}
|
||||
|
||||
eeh_slot_error_detail(pe, EEH_LOG_PERM);
|
||||
/*
|
||||
* About 90% of all real-life EEH failures in the field
|
||||
* are due to poorly seated PCI cards. Only 10% or so are
|
||||
* due to actual, failed cards.
|
||||
*/
|
||||
pr_err("EEH: Unable to recover from failure from PHB#%x-PE#%x.\n"
|
||||
"Please try reseating or replacing it\n",
|
||||
pe->phb->global_number, pe->addr);
|
||||
|
||||
/* Notify all devices that they're about to go down. */
|
||||
eeh_set_channel_state(pe, pci_channel_io_perm_failure);
|
||||
eeh_set_irq_state(pe, false);
|
||||
eeh_pe_report("error_detected(permanent failure)", pe,
|
||||
eeh_report_failure, NULL);
|
||||
eeh_slot_error_detail(pe, EEH_LOG_PERM);
|
||||
|
||||
/* Mark the PE to be removed permanently */
|
||||
eeh_pe_state_mark(pe, EEH_PE_REMOVED);
|
||||
/* Notify all devices that they're about to go down. */
|
||||
eeh_set_channel_state(pe, pci_channel_io_perm_failure);
|
||||
eeh_set_irq_state(pe, false);
|
||||
eeh_pe_report("error_detected(permanent failure)", pe,
|
||||
eeh_report_failure, NULL);
|
||||
|
||||
/*
|
||||
* Shut down the device drivers for good. We mark
|
||||
* all removed devices correctly to avoid access
|
||||
* the their PCI config any more.
|
||||
*/
|
||||
if (pe->type & EEH_PE_VF) {
|
||||
eeh_pe_dev_traverse(pe, eeh_rmv_device, NULL);
|
||||
eeh_pe_dev_mode_mark(pe, EEH_DEV_REMOVED);
|
||||
} else {
|
||||
eeh_pe_state_clear(pe, EEH_PE_PRI_BUS, true);
|
||||
eeh_pe_dev_mode_mark(pe, EEH_DEV_REMOVED);
|
||||
/* Mark the PE to be removed permanently */
|
||||
eeh_pe_state_mark(pe, EEH_PE_REMOVED);
|
||||
|
||||
pci_lock_rescan_remove();
|
||||
pci_hp_remove_devices(bus);
|
||||
pci_unlock_rescan_remove();
|
||||
/* The passed PE should no longer be used */
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* Shut down the device drivers for good. We mark
|
||||
* all removed devices correctly to avoid access
|
||||
* the their PCI config any more.
|
||||
*/
|
||||
if (pe->type & EEH_PE_VF) {
|
||||
eeh_pe_dev_traverse(pe, eeh_rmv_device, NULL);
|
||||
eeh_pe_dev_mode_mark(pe, EEH_DEV_REMOVED);
|
||||
} else {
|
||||
eeh_pe_state_clear(pe, EEH_PE_PRI_BUS, true);
|
||||
eeh_pe_dev_mode_mark(pe, EEH_DEV_REMOVED);
|
||||
|
||||
pci_lock_rescan_remove();
|
||||
pci_hp_remove_devices(bus);
|
||||
pci_unlock_rescan_remove();
|
||||
/* The passed PE should no longer be used */
|
||||
return;
|
||||
}
|
||||
|
||||
out:
|
||||
|
Loading…
Reference in New Issue
Block a user