Commit 17e21854 authored by Hidetoshi Seto's avatar Hidetoshi Seto Committed by Jesse Barnes

PCI: aerdrv: rework do_recovery

Move dev_printks for debug into do_recovery().
This allows do_recovery() to return void.
Signed-off-by: default avatarHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Reviewed-by: default avatarKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 88da13bf
...@@ -465,8 +465,7 @@ static pci_ers_result_t reset_link(struct pcie_device *aerdev, ...@@ -465,8 +465,7 @@ static pci_ers_result_t reset_link(struct pcie_device *aerdev,
* error detected message to all downstream drivers within a hierarchy in * error detected message to all downstream drivers within a hierarchy in
* question and return the returned code. * question and return the returned code.
*/ */
static pci_ers_result_t do_recovery(struct pcie_device *aerdev, static void do_recovery(struct pcie_device *aerdev, struct pci_dev *dev,
struct pci_dev *dev,
int severity) int severity)
{ {
pci_ers_result_t status, result = PCI_ERS_RESULT_RECOVERED; pci_ers_result_t status, result = PCI_ERS_RESULT_RECOVERED;
...@@ -484,10 +483,8 @@ static pci_ers_result_t do_recovery(struct pcie_device *aerdev, ...@@ -484,10 +483,8 @@ static pci_ers_result_t do_recovery(struct pcie_device *aerdev,
if (severity == AER_FATAL) { if (severity == AER_FATAL) {
result = reset_link(aerdev, dev); result = reset_link(aerdev, dev);
if (result != PCI_ERS_RESULT_RECOVERED) { if (result != PCI_ERS_RESULT_RECOVERED)
/* TODO: Should panic here? */ goto failed;
return result;
}
} }
if (status == PCI_ERS_RESULT_CAN_RECOVER) if (status == PCI_ERS_RESULT_CAN_RECOVER)
...@@ -508,13 +505,22 @@ static pci_ers_result_t do_recovery(struct pcie_device *aerdev, ...@@ -508,13 +505,22 @@ static pci_ers_result_t do_recovery(struct pcie_device *aerdev,
report_slot_reset); report_slot_reset);
} }
if (status == PCI_ERS_RESULT_RECOVERED) if (status != PCI_ERS_RESULT_RECOVERED)
broadcast_error_message(dev, goto failed;
broadcast_error_message(dev,
state, state,
"resume", "resume",
report_resume); report_resume);
return status; dev_printk(KERN_DEBUG, &dev->dev,
"AER driver successfully recovered\n");
return;
failed:
/* TODO: Should kernel panic here? */
dev_printk(KERN_DEBUG, &dev->dev,
"AER driver didn't recover\n");
} }
/** /**
...@@ -529,7 +535,6 @@ static void handle_error_source(struct pcie_device *aerdev, ...@@ -529,7 +535,6 @@ static void handle_error_source(struct pcie_device *aerdev,
struct pci_dev *dev, struct pci_dev *dev,
struct aer_err_info *info) struct aer_err_info *info)
{ {
pci_ers_result_t status = 0;
int pos; int pos;
if (info->severity == AER_CORRECTABLE) { if (info->severity == AER_CORRECTABLE) {
...@@ -541,17 +546,8 @@ static void handle_error_source(struct pcie_device *aerdev, ...@@ -541,17 +546,8 @@ static void handle_error_source(struct pcie_device *aerdev,
if (pos) if (pos)
pci_write_config_dword(dev, pos + PCI_ERR_COR_STATUS, pci_write_config_dword(dev, pos + PCI_ERR_COR_STATUS,
info->status); info->status);
} else { } else
status = do_recovery(aerdev, dev, info->severity); do_recovery(aerdev, dev, info->severity);
if (status == PCI_ERS_RESULT_RECOVERED) {
dev_printk(KERN_DEBUG, &dev->dev, "AER driver "
"successfully recovered\n");
} else {
/* TODO: Should kernel panic here? */
dev_printk(KERN_DEBUG, &dev->dev, "AER driver didn't "
"recover\n");
}
}
} }
/** /**
......
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