提交 e2b810d5 编写于 作者: S Sam Bobroff 提交者: Michael Ellerman

powerpc/eeh: Introduce eeh_edev_actionable()

The same test is done in every EEH report function, so factor it out.

Since eeh_dev_removed() needs to be moved higher up in the file,
simplify it a little while we're at it.
Signed-off-by: NSam Bobroff <sbobroff@linux.ibm.com>
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
上级 309ed3a7
......@@ -68,6 +68,17 @@ static enum pci_ers_result pci_ers_merge_result(enum pci_ers_result old,
return old;
}
static bool eeh_dev_removed(struct eeh_dev *edev)
{
return !edev || (edev->mode & EEH_DEV_REMOVED);
}
static bool eeh_edev_actionable(struct eeh_dev *edev)
{
return (edev->pdev && !eeh_dev_removed(edev) &&
!eeh_pe_passed(edev->pe));
}
/**
* eeh_pcid_get - Get the PCI device driver
* @pdev: PCI device
......@@ -169,15 +180,6 @@ static void eeh_enable_irq(struct pci_dev *dev)
}
}
static bool eeh_dev_removed(struct eeh_dev *edev)
{
/* EEH device removed ? */
if (!edev || (edev->mode & EEH_DEV_REMOVED))
return true;
return false;
}
static void *eeh_dev_save_state(struct eeh_dev *edev, void *userdata)
{
struct pci_dev *pdev;
......@@ -218,7 +220,7 @@ static void *eeh_report_error(struct eeh_dev *edev, void *userdata)
enum pci_ers_result rc, *res = userdata;
struct pci_driver *driver;
if (!dev || eeh_dev_removed(edev) || eeh_pe_passed(edev->pe))
if (!eeh_edev_actionable(edev))
return NULL;
device_lock(&dev->dev);
......@@ -262,7 +264,7 @@ static void *eeh_report_mmio_enabled(struct eeh_dev *edev, void *userdata)
enum pci_ers_result rc, *res = userdata;
struct pci_driver *driver;
if (!dev || eeh_dev_removed(edev) || eeh_pe_passed(edev->pe))
if (!eeh_edev_actionable(edev))
return NULL;
device_lock(&dev->dev);
......@@ -301,7 +303,7 @@ static void *eeh_report_reset(struct eeh_dev *edev, void *userdata)
enum pci_ers_result rc, *res = userdata;
struct pci_driver *driver;
if (!dev || eeh_dev_removed(edev) || eeh_pe_passed(edev->pe))
if (!eeh_edev_actionable(edev))
return NULL;
device_lock(&dev->dev);
......@@ -371,7 +373,7 @@ static void *eeh_report_resume(struct eeh_dev *edev, void *userdata)
bool was_in_error;
struct pci_driver *driver;
if (!dev || eeh_dev_removed(edev) || eeh_pe_passed(edev->pe))
if (!eeh_edev_actionable(edev))
return NULL;
device_lock(&dev->dev);
......@@ -418,7 +420,7 @@ static void *eeh_report_failure(struct eeh_dev *edev, void *userdata)
struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
struct pci_driver *driver;
if (!dev || eeh_dev_removed(edev) || eeh_pe_passed(edev->pe))
if (!eeh_edev_actionable(edev))
return NULL;
device_lock(&dev->dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册