powerpc/eeh: Refactor EEH flag accessors
There are multiple global EEH flags. Almost each flag has its own accessor, which doesn't make sense. The patch refactors EEH flag accessors so that they look unified: eeh_add_flag(): Add EEH flag eeh_clear_flag(): Clear EEH flag eeh_has_flag(): Check if one specific flag has been set eeh_enabled(): Check if EEH functionality has been enabled Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:

committed by
Benjamin Herrenschmidt

parent
a3032ca9f8
commit
05b1721d9f
@@ -206,36 +206,28 @@ extern int eeh_subsystem_flags;
|
||||
extern struct eeh_ops *eeh_ops;
|
||||
extern raw_spinlock_t confirm_error_lock;
|
||||
|
||||
static inline bool eeh_enabled(void)
|
||||
{
|
||||
if ((eeh_subsystem_flags & EEH_FORCE_DISABLED) ||
|
||||
!(eeh_subsystem_flags & EEH_ENABLED))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void eeh_set_enable(bool mode)
|
||||
{
|
||||
if (mode)
|
||||
eeh_subsystem_flags |= EEH_ENABLED;
|
||||
else
|
||||
eeh_subsystem_flags &= ~EEH_ENABLED;
|
||||
}
|
||||
|
||||
static inline void eeh_probe_mode_set(int flag)
|
||||
static inline void eeh_add_flag(int flag)
|
||||
{
|
||||
eeh_subsystem_flags |= flag;
|
||||
}
|
||||
|
||||
static inline int eeh_probe_mode_devtree(void)
|
||||
static inline void eeh_clear_flag(int flag)
|
||||
{
|
||||
return (eeh_subsystem_flags & EEH_PROBE_MODE_DEVTREE);
|
||||
eeh_subsystem_flags &= ~flag;
|
||||
}
|
||||
|
||||
static inline int eeh_probe_mode_dev(void)
|
||||
static inline bool eeh_has_flag(int flag)
|
||||
{
|
||||
return (eeh_subsystem_flags & EEH_PROBE_MODE_DEV);
|
||||
return !!(eeh_subsystem_flags & flag);
|
||||
}
|
||||
|
||||
static inline bool eeh_enabled(void)
|
||||
{
|
||||
if (eeh_has_flag(EEH_FORCE_DISABLED) ||
|
||||
!eeh_has_flag(EEH_ENABLED))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void eeh_serialize_lock(unsigned long *flags)
|
||||
@@ -314,8 +306,6 @@ static inline bool eeh_enabled(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline void eeh_set_enable(bool mode) { }
|
||||
|
||||
static inline int eeh_init(void)
|
||||
{
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user