summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/eeh_driver.c
diff options
context:
space:
mode:
authorSam Bobroff <sbobroff@linux.ibm.com>2018-05-25 13:11:36 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2018-06-03 20:43:40 +1000
commite2b810d51b2b36d41e3e5522e12cc752e0d865ec (patch)
tree38e971c7c50cbced656c5a5c510c1d2590a6c6bf /arch/powerpc/kernel/eeh_driver.c
parent309ed3a7157a50edeeddfe49bd527a7347f76237 (diff)
downloadlinux-e2b810d51b2b36d41e3e5522e12cc752e0d865ec.tar.bz2
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: Sam Bobroff <sbobroff@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/kernel/eeh_driver.c')
-rw-r--r--arch/powerpc/kernel/eeh_driver.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c
index ea51c909f8c9..127f2bb41e38 100644
--- a/arch/powerpc/kernel/eeh_driver.c
+++ b/arch/powerpc/kernel/eeh_driver.c
@@ -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);