Commit 2ec5a0ad authored by Gavin Shan's avatar Gavin Shan Committed by Benjamin Herrenschmidt

powerpc/eeh: Cleanup on eeh_subsystem_enabled

The patch cleans up variable eeh_subsystem_enabled so that we needn't
refer the variable directly from external. Instead, we will use
function eeh_enabled() and eeh_set_enable() to operate the variable.
Signed-off-by: default avatarGavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 5b2e198e
...@@ -172,10 +172,20 @@ struct eeh_ops { ...@@ -172,10 +172,20 @@ struct eeh_ops {
}; };
extern struct eeh_ops *eeh_ops; extern struct eeh_ops *eeh_ops;
extern int eeh_subsystem_enabled; extern bool eeh_subsystem_enabled;
extern raw_spinlock_t confirm_error_lock; extern raw_spinlock_t confirm_error_lock;
extern int eeh_probe_mode; extern int eeh_probe_mode;
static inline bool eeh_enabled(void)
{
return eeh_subsystem_enabled;
}
static inline void eeh_set_enable(bool mode)
{
eeh_subsystem_enabled = mode;
}
#define EEH_PROBE_MODE_DEV (1<<0) /* From PCI device */ #define EEH_PROBE_MODE_DEV (1<<0) /* From PCI device */
#define EEH_PROBE_MODE_DEVTREE (1<<1) /* From device tree */ #define EEH_PROBE_MODE_DEVTREE (1<<1) /* From device tree */
...@@ -246,7 +256,7 @@ void eeh_remove_device(struct pci_dev *); ...@@ -246,7 +256,7 @@ void eeh_remove_device(struct pci_dev *);
* If this macro yields TRUE, the caller relays to eeh_check_failure() * If this macro yields TRUE, the caller relays to eeh_check_failure()
* which does further tests out of line. * which does further tests out of line.
*/ */
#define EEH_POSSIBLE_ERROR(val, type) ((val) == (type)~0 && eeh_subsystem_enabled) #define EEH_POSSIBLE_ERROR(val, type) ((val) == (type)~0 && eeh_enabled())
/* /*
* Reads from a device which has been isolated by EEH will return * Reads from a device which has been isolated by EEH will return
...@@ -257,6 +267,13 @@ void eeh_remove_device(struct pci_dev *); ...@@ -257,6 +267,13 @@ void eeh_remove_device(struct pci_dev *);
#else /* !CONFIG_EEH */ #else /* !CONFIG_EEH */
static inline bool eeh_enabled(void)
{
return false;
}
static inline void eeh_set_enable(bool mode) { }
static inline int eeh_init(void) static inline int eeh_init(void)
{ {
return 0; return 0;
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
/* Platform dependent EEH operations */ /* Platform dependent EEH operations */
struct eeh_ops *eeh_ops = NULL; struct eeh_ops *eeh_ops = NULL;
int eeh_subsystem_enabled; bool eeh_subsystem_enabled = false;
EXPORT_SYMBOL(eeh_subsystem_enabled); EXPORT_SYMBOL(eeh_subsystem_enabled);
/* /*
...@@ -364,7 +364,7 @@ int eeh_dev_check_failure(struct eeh_dev *edev) ...@@ -364,7 +364,7 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
eeh_stats.total_mmio_ffs++; eeh_stats.total_mmio_ffs++;
if (!eeh_subsystem_enabled) if (!eeh_enabled())
return 0; return 0;
if (!edev) { if (!edev) {
...@@ -822,7 +822,7 @@ int eeh_init(void) ...@@ -822,7 +822,7 @@ int eeh_init(void)
return ret; return ret;
} }
if (eeh_subsystem_enabled) if (eeh_enabled())
pr_info("EEH: PCI Enhanced I/O Error Handling Enabled\n"); pr_info("EEH: PCI Enhanced I/O Error Handling Enabled\n");
else else
pr_warning("EEH: No capable adapters found\n"); pr_warning("EEH: No capable adapters found\n");
...@@ -897,7 +897,7 @@ void eeh_add_device_late(struct pci_dev *dev) ...@@ -897,7 +897,7 @@ void eeh_add_device_late(struct pci_dev *dev)
struct device_node *dn; struct device_node *dn;
struct eeh_dev *edev; struct eeh_dev *edev;
if (!dev || !eeh_subsystem_enabled) if (!dev || !eeh_enabled())
return; return;
pr_debug("EEH: Adding device %s\n", pci_name(dev)); pr_debug("EEH: Adding device %s\n", pci_name(dev));
...@@ -1005,7 +1005,7 @@ void eeh_remove_device(struct pci_dev *dev) ...@@ -1005,7 +1005,7 @@ void eeh_remove_device(struct pci_dev *dev)
{ {
struct eeh_dev *edev; struct eeh_dev *edev;
if (!dev || !eeh_subsystem_enabled) if (!dev || !eeh_enabled())
return; return;
edev = pci_dev_to_eeh_dev(dev); edev = pci_dev_to_eeh_dev(dev);
...@@ -1045,7 +1045,7 @@ void eeh_remove_device(struct pci_dev *dev) ...@@ -1045,7 +1045,7 @@ void eeh_remove_device(struct pci_dev *dev)
static int proc_eeh_show(struct seq_file *m, void *v) static int proc_eeh_show(struct seq_file *m, void *v)
{ {
if (0 == eeh_subsystem_enabled) { if (!eeh_enabled()) {
seq_printf(m, "EEH Subsystem is globally disabled\n"); seq_printf(m, "EEH Subsystem is globally disabled\n");
seq_printf(m, "eeh_total_mmio_ffs=%llu\n", eeh_stats.total_mmio_ffs); seq_printf(m, "eeh_total_mmio_ffs=%llu\n", eeh_stats.total_mmio_ffs);
} else { } else {
......
...@@ -145,7 +145,7 @@ static int powernv_eeh_dev_probe(struct pci_dev *dev, void *flag) ...@@ -145,7 +145,7 @@ static int powernv_eeh_dev_probe(struct pci_dev *dev, void *flag)
* Enable EEH explicitly so that we will do EEH check * Enable EEH explicitly so that we will do EEH check
* while accessing I/O stuff * while accessing I/O stuff
*/ */
eeh_subsystem_enabled = 1; eeh_set_enable(true);
/* Save memory bars */ /* Save memory bars */
eeh_save_bars(edev); eeh_save_bars(edev);
......
...@@ -265,7 +265,7 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag) ...@@ -265,7 +265,7 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag)
enable = 1; enable = 1;
if (enable) { if (enable) {
eeh_subsystem_enabled = 1; eeh_set_enable(true);
eeh_add_to_parent_pe(edev); eeh_add_to_parent_pe(edev);
pr_debug("%s: EEH enabled on %s PHB#%d-PE#%x, config addr#%x\n", pr_debug("%s: EEH enabled on %s PHB#%d-PE#%x, config addr#%x\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