Skip to content

Commit

Permalink
powerpc/eeh: Cleanup on eeh_subsystem_enabled
Browse files Browse the repository at this point in the history
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: Gavin Shan <[email protected]>
Signed-off-by: Benjamin Herrenschmidt <[email protected]>
  • Loading branch information
shangw authored and ozbenh committed Feb 17, 2014
1 parent 5b2e198 commit 2ec5a0a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
21 changes: 19 additions & 2 deletions arch/powerpc/include/asm/eeh.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,20 @@ struct 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 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_DEVTREE (1<<1) /* From device tree */

Expand Down Expand Up @@ -246,7 +256,7 @@ void eeh_remove_device(struct pci_dev *);
* If this macro yields TRUE, the caller relays to eeh_check_failure()
* 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
Expand All @@ -257,6 +267,13 @@ void eeh_remove_device(struct pci_dev *);

#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)
{
return 0;
Expand Down
12 changes: 6 additions & 6 deletions arch/powerpc/kernel/eeh.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
/* Platform dependent EEH operations */
struct eeh_ops *eeh_ops = NULL;

int eeh_subsystem_enabled;
bool eeh_subsystem_enabled = false;
EXPORT_SYMBOL(eeh_subsystem_enabled);

/*
Expand Down Expand Up @@ -364,7 +364,7 @@ int eeh_dev_check_failure(struct eeh_dev *edev)

eeh_stats.total_mmio_ffs++;

if (!eeh_subsystem_enabled)
if (!eeh_enabled())
return 0;

if (!edev) {
Expand Down Expand Up @@ -822,7 +822,7 @@ int eeh_init(void)
return ret;
}

if (eeh_subsystem_enabled)
if (eeh_enabled())
pr_info("EEH: PCI Enhanced I/O Error Handling Enabled\n");
else
pr_warning("EEH: No capable adapters found\n");
Expand Down Expand Up @@ -897,7 +897,7 @@ void eeh_add_device_late(struct pci_dev *dev)
struct device_node *dn;
struct eeh_dev *edev;

if (!dev || !eeh_subsystem_enabled)
if (!dev || !eeh_enabled())
return;

pr_debug("EEH: Adding device %s\n", pci_name(dev));
Expand Down Expand Up @@ -1005,7 +1005,7 @@ void eeh_remove_device(struct pci_dev *dev)
{
struct eeh_dev *edev;

if (!dev || !eeh_subsystem_enabled)
if (!dev || !eeh_enabled())
return;
edev = pci_dev_to_eeh_dev(dev);

Expand Down Expand Up @@ -1045,7 +1045,7 @@ void eeh_remove_device(struct pci_dev *dev)

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_total_mmio_ffs=%llu\n", eeh_stats.total_mmio_ffs);
} else {
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/powernv/eeh-powernv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
* while accessing I/O stuff
*/
eeh_subsystem_enabled = 1;
eeh_set_enable(true);

/* Save memory bars */
eeh_save_bars(edev);
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/pseries/eeh_pseries.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag)
enable = 1;

if (enable) {
eeh_subsystem_enabled = 1;
eeh_set_enable(true);
eeh_add_to_parent_pe(edev);

pr_debug("%s: EEH enabled on %s PHB#%d-PE#%x, config addr#%x\n",
Expand Down

0 comments on commit 2ec5a0a

Please sign in to comment.