Skip to content

Commit

Permalink
tree-wide: replace config_enabled() with IS_ENABLED()
Browse files Browse the repository at this point in the history
The use of config_enabled() against config options is ambiguous.  In
practical terms, config_enabled() is equivalent to IS_BUILTIN(), but the
author might have used it for the meaning of IS_ENABLED().  Using
IS_ENABLED(), IS_BUILTIN(), IS_MODULE() etc.  makes the intention
clearer.

This commit replaces config_enabled() with IS_ENABLED() where possible.
This commit is only touching bool config options.

I noticed two cases where config_enabled() is used against a tristate
option:

 - config_enabled(CONFIG_HWMON)
  [ drivers/net/wireless/ath/ath10k/thermal.c ]

 - config_enabled(CONFIG_BACKLIGHT_CLASS_DEVICE)
  [ drivers/gpu/drm/gma500/opregion.c ]

I did not touch them because they should be converted to IS_BUILTIN()
in order to keep the logic, but I was not sure it was the authors'
intention.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Masahiro Yamada <[email protected]>
Acked-by: Kees Cook <[email protected]>
Cc: Stas Sergeev <[email protected]>
Cc: Matt Redfearn <[email protected]>
Cc: Joshua Kinard <[email protected]>
Cc: Jiri Slaby <[email protected]>
Cc: Bjorn Helgaas <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Markos Chandras <[email protected]>
Cc: "Dmitry V. Levin" <[email protected]>
Cc: yu-cheng yu <[email protected]>
Cc: James Hogan <[email protected]>
Cc: Brian Gerst <[email protected]>
Cc: Johannes Berg <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Will Drewry <[email protected]>
Cc: Nikolay Martynov <[email protected]>
Cc: Huacai Chen <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: Leonid Yegoshin <[email protected]>
Cc: Rafal Milecki <[email protected]>
Cc: James Cowgill <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Ralf Baechle <[email protected]>
Cc: Alex Smith <[email protected]>
Cc: Adam Buchbinder <[email protected]>
Cc: Qais Yousef <[email protected]>
Cc: Jiang Liu <[email protected]>
Cc: Mikko Rapeli <[email protected]>
Cc: Paul Gortmaker <[email protected]>
Cc: Denys Vlasenko <[email protected]>
Cc: Brian Norris <[email protected]>
Cc: Hidehiro Kawai <[email protected]>
Cc: "Luis R. Rodriguez" <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: "Kirill A. Shutemov" <[email protected]>
Cc: Roland McGrath <[email protected]>
Cc: Paul Burton <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Viresh Kumar <[email protected]>
Cc: Tony Wu <[email protected]>
Cc: Huaitong Han <[email protected]>
Cc: Sumit Semwal <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Cc: Juergen Gross <[email protected]>
Cc: Jason Cooper <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Andrea Gelmini <[email protected]>
Cc: David Woodhouse <[email protected]>
Cc: Marc Zyngier <[email protected]>
Cc: Rabin Vincent <[email protected]>
Cc: "Maciej W. Rozycki" <[email protected]>
Cc: David Daney <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
masahir0y authored and torvalds committed Aug 4, 2016
1 parent 1c8cb40 commit 97f2645
Show file tree
Hide file tree
Showing 48 changed files with 135 additions and 135 deletions.
2 changes: 1 addition & 1 deletion arch/mips/include/asm/mips-cm.h
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ static inline unsigned int mips_cm_max_vp_width(void)
if (mips_cm_revision() >= CM_REV_CM3)
return read_gcr_sys_config2() & CM_GCR_SYS_CONFIG2_MAXVPW_MSK;

if (config_enabled(CONFIG_SMP))
if (IS_ENABLED(CONFIG_SMP))
return smp_num_siblings;

return 1;
Expand Down
16 changes: 8 additions & 8 deletions arch/mips/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
* it better already be global)
*/
if (pte_none(*buddy)) {
if (!config_enabled(CONFIG_XPA))
if (!IS_ENABLED(CONFIG_XPA))
buddy->pte_low |= _PAGE_GLOBAL;
buddy->pte_high |= _PAGE_GLOBAL;
}
Expand All @@ -172,7 +172,7 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt

htw_stop();
/* Preserve global status for the pair */
if (config_enabled(CONFIG_XPA)) {
if (IS_ENABLED(CONFIG_XPA)) {
if (ptep_buddy(ptep)->pte_high & _PAGE_GLOBAL)
null.pte_high = _PAGE_GLOBAL;
} else {
Expand Down Expand Up @@ -319,7 +319,7 @@ static inline int pte_young(pte_t pte) { return pte.pte_low & _PAGE_ACCESSED; }
static inline pte_t pte_wrprotect(pte_t pte)
{
pte.pte_low &= ~_PAGE_WRITE;
if (!config_enabled(CONFIG_XPA))
if (!IS_ENABLED(CONFIG_XPA))
pte.pte_low &= ~_PAGE_SILENT_WRITE;
pte.pte_high &= ~_PAGE_SILENT_WRITE;
return pte;
Expand All @@ -328,7 +328,7 @@ static inline pte_t pte_wrprotect(pte_t pte)
static inline pte_t pte_mkclean(pte_t pte)
{
pte.pte_low &= ~_PAGE_MODIFIED;
if (!config_enabled(CONFIG_XPA))
if (!IS_ENABLED(CONFIG_XPA))
pte.pte_low &= ~_PAGE_SILENT_WRITE;
pte.pte_high &= ~_PAGE_SILENT_WRITE;
return pte;
Expand All @@ -337,7 +337,7 @@ static inline pte_t pte_mkclean(pte_t pte)
static inline pte_t pte_mkold(pte_t pte)
{
pte.pte_low &= ~_PAGE_ACCESSED;
if (!config_enabled(CONFIG_XPA))
if (!IS_ENABLED(CONFIG_XPA))
pte.pte_low &= ~_PAGE_SILENT_READ;
pte.pte_high &= ~_PAGE_SILENT_READ;
return pte;
Expand All @@ -347,7 +347,7 @@ static inline pte_t pte_mkwrite(pte_t pte)
{
pte.pte_low |= _PAGE_WRITE;
if (pte.pte_low & _PAGE_MODIFIED) {
if (!config_enabled(CONFIG_XPA))
if (!IS_ENABLED(CONFIG_XPA))
pte.pte_low |= _PAGE_SILENT_WRITE;
pte.pte_high |= _PAGE_SILENT_WRITE;
}
Expand All @@ -358,7 +358,7 @@ static inline pte_t pte_mkdirty(pte_t pte)
{
pte.pte_low |= _PAGE_MODIFIED;
if (pte.pte_low & _PAGE_WRITE) {
if (!config_enabled(CONFIG_XPA))
if (!IS_ENABLED(CONFIG_XPA))
pte.pte_low |= _PAGE_SILENT_WRITE;
pte.pte_high |= _PAGE_SILENT_WRITE;
}
Expand All @@ -369,7 +369,7 @@ static inline pte_t pte_mkyoung(pte_t pte)
{
pte.pte_low |= _PAGE_ACCESSED;
if (!(pte.pte_low & _PAGE_NO_READ)) {
if (!config_enabled(CONFIG_XPA))
if (!IS_ENABLED(CONFIG_XPA))
pte.pte_low |= _PAGE_SILENT_READ;
pte.pte_high |= _PAGE_SILENT_READ;
}
Expand Down
4 changes: 2 additions & 2 deletions arch/mips/include/asm/seccomp.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ static inline const int *get_compat_mode1_syscalls(void)
0, /* null terminated */
};

if (config_enabled(CONFIG_MIPS32_O32) && test_thread_flag(TIF_32BIT_REGS))
if (IS_ENABLED(CONFIG_MIPS32_O32) && test_thread_flag(TIF_32BIT_REGS))
return syscalls_O32;

if (config_enabled(CONFIG_MIPS32_N32))
if (IS_ENABLED(CONFIG_MIPS32_N32))
return syscalls_N32;

BUG();
Expand Down
4 changes: 2 additions & 2 deletions arch/mips/include/asm/signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ extern struct mips_abi mips_abi_32;
((ka)->sa.sa_flags & SA_SIGINFO))
#else
#define sig_uses_siginfo(ka, abi) \
(config_enabled(CONFIG_64BIT) ? 1 : \
(config_enabled(CONFIG_TRAD_SIGNALS) ? \
(IS_ENABLED(CONFIG_64BIT) ? 1 : \
(IS_ENABLED(CONFIG_TRAD_SIGNALS) ? \
((ka)->sa.sa_flags & SA_SIGINFO) : 1) )
#endif

Expand Down
2 changes: 1 addition & 1 deletion arch/mips/include/asm/syscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static inline void syscall_get_arguments(struct task_struct *task,
{
int ret;
/* O32 ABI syscall() - Either 64-bit with O32 or 32-bit */
if ((config_enabled(CONFIG_32BIT) ||
if ((IS_ENABLED(CONFIG_32BIT) ||
test_tsk_thread_flag(task, TIF_32BIT_REGS)) &&
(regs->regs[2] == __NR_syscall))
i++;
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ extern u64 __ua_limit;
*/
static inline bool eva_kernel_access(void)
{
if (!config_enabled(CONFIG_EVA))
if (!IS_ENABLED(CONFIG_EVA))
return false;

return segment_eq(get_fs(), get_ds());
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/jz4740/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void __init device_tree_init(void)

const char *get_system_type(void)
{
if (config_enabled(CONFIG_MACH_JZ4780))
if (IS_ENABLED(CONFIG_MACH_JZ4780))
return "JZ4780";

return "JZ4740";
Expand Down
6 changes: 3 additions & 3 deletions arch/mips/kernel/cpu-bugs64.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ static inline void check_daddi(void)
panic(bug64hit, !DADDI_WAR ? daddiwar : nowar);
}

int daddiu_bug = config_enabled(CONFIG_CPU_MIPSR6) ? 0 : -1;
int daddiu_bug = IS_ENABLED(CONFIG_CPU_MIPSR6) ? 0 : -1;

static inline void check_daddiu(void)
{
Expand Down Expand Up @@ -314,14 +314,14 @@ static inline void check_daddiu(void)

void __init check_bugs64_early(void)
{
if (!config_enabled(CONFIG_CPU_MIPSR6)) {
if (!IS_ENABLED(CONFIG_CPU_MIPSR6)) {
check_mult_sh();
check_daddiu();
}
}

void __init check_bugs64(void)
{
if (!config_enabled(CONFIG_CPU_MIPSR6))
if (!IS_ENABLED(CONFIG_CPU_MIPSR6))
check_daddi();
}
4 changes: 2 additions & 2 deletions arch/mips/kernel/elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ int arch_check_elf(void *_ehdr, bool has_interpreter, void *_interp_ehdr,
return -ELIBBAD;
}

if (!config_enabled(CONFIG_MIPS_O32_FP64_SUPPORT))
if (!IS_ENABLED(CONFIG_MIPS_O32_FP64_SUPPORT))
return 0;

fp_abi = state->fp_abi;
Expand Down Expand Up @@ -285,7 +285,7 @@ void mips_set_personality_fp(struct arch_elf_state *state)
* not be worried about N32/N64 binaries.
*/

if (!config_enabled(CONFIG_MIPS_O32_FP64_SUPPORT))
if (!IS_ENABLED(CONFIG_MIPS_O32_FP64_SUPPORT))
return;

switch (state->overall_fp_mode) {
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/mips-cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ int mips_cm_probe(void)
mips_cm_probe_l2sync();

/* determine register width for this CM */
mips_cm_is64 = config_enabled(CONFIG_64BIT) && (mips_cm_revision() >= CM_REV_CM3);
mips_cm_is64 = IS_ENABLED(CONFIG_64BIT) && (mips_cm_revision() >= CM_REV_CM3);

for_each_possible_cpu(cpu)
spin_lock_init(&per_cpu(cm_core_lock, cpu));
Expand Down
34 changes: 17 additions & 17 deletions arch/mips/kernel/mips-r2-to-r6-emul.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static inline int mipsr6_emul(struct pt_regs *regs, u32 ir)
(s32)MIPSInst_SIMM(ir);
return 0;
case daddiu_op:
if (config_enabled(CONFIG_32BIT))
if (IS_ENABLED(CONFIG_32BIT))
break;

if (MIPSInst_RT(ir))
Expand Down Expand Up @@ -143,7 +143,7 @@ static inline int mipsr6_emul(struct pt_regs *regs, u32 ir)
(u32)regs->regs[MIPSInst_RT(ir)]);
return 0;
case dsll_op:
if (config_enabled(CONFIG_32BIT) || MIPSInst_RS(ir))
if (IS_ENABLED(CONFIG_32BIT) || MIPSInst_RS(ir))
break;

if (MIPSInst_RD(ir))
Expand All @@ -152,7 +152,7 @@ static inline int mipsr6_emul(struct pt_regs *regs, u32 ir)
MIPSInst_FD(ir));
return 0;
case dsrl_op:
if (config_enabled(CONFIG_32BIT) || MIPSInst_RS(ir))
if (IS_ENABLED(CONFIG_32BIT) || MIPSInst_RS(ir))
break;

if (MIPSInst_RD(ir))
Expand All @@ -161,7 +161,7 @@ static inline int mipsr6_emul(struct pt_regs *regs, u32 ir)
MIPSInst_FD(ir));
return 0;
case daddu_op:
if (config_enabled(CONFIG_32BIT) || MIPSInst_FD(ir))
if (IS_ENABLED(CONFIG_32BIT) || MIPSInst_FD(ir))
break;

if (MIPSInst_RD(ir))
Expand All @@ -170,7 +170,7 @@ static inline int mipsr6_emul(struct pt_regs *regs, u32 ir)
(u64)regs->regs[MIPSInst_RT(ir)];
return 0;
case dsubu_op:
if (config_enabled(CONFIG_32BIT) || MIPSInst_FD(ir))
if (IS_ENABLED(CONFIG_32BIT) || MIPSInst_FD(ir))
break;

if (MIPSInst_RD(ir))
Expand Down Expand Up @@ -498,7 +498,7 @@ static int dmult_func(struct pt_regs *regs, u32 ir)
s64 res;
s64 rt, rs;

if (config_enabled(CONFIG_32BIT))
if (IS_ENABLED(CONFIG_32BIT))
return SIGILL;

rt = regs->regs[MIPSInst_RT(ir)];
Expand Down Expand Up @@ -530,7 +530,7 @@ static int dmultu_func(struct pt_regs *regs, u32 ir)
u64 res;
u64 rt, rs;

if (config_enabled(CONFIG_32BIT))
if (IS_ENABLED(CONFIG_32BIT))
return SIGILL;

rt = regs->regs[MIPSInst_RT(ir)];
Expand Down Expand Up @@ -561,7 +561,7 @@ static int ddiv_func(struct pt_regs *regs, u32 ir)
{
s64 rt, rs;

if (config_enabled(CONFIG_32BIT))
if (IS_ENABLED(CONFIG_32BIT))
return SIGILL;

rt = regs->regs[MIPSInst_RT(ir)];
Expand All @@ -586,7 +586,7 @@ static int ddivu_func(struct pt_regs *regs, u32 ir)
{
u64 rt, rs;

if (config_enabled(CONFIG_32BIT))
if (IS_ENABLED(CONFIG_32BIT))
return SIGILL;

rt = regs->regs[MIPSInst_RT(ir)];
Expand Down Expand Up @@ -825,7 +825,7 @@ static int dclz_func(struct pt_regs *regs, u32 ir)
u64 res;
u64 rs;

if (config_enabled(CONFIG_32BIT))
if (IS_ENABLED(CONFIG_32BIT))
return SIGILL;

if (!MIPSInst_RD(ir))
Expand All @@ -852,7 +852,7 @@ static int dclo_func(struct pt_regs *regs, u32 ir)
u64 res;
u64 rs;

if (config_enabled(CONFIG_32BIT))
if (IS_ENABLED(CONFIG_32BIT))
return SIGILL;

if (!MIPSInst_RD(ir))
Expand Down Expand Up @@ -1484,7 +1484,7 @@ int mipsr2_decoder(struct pt_regs *regs, u32 inst, unsigned long *fcr31)
break;

case ldl_op:
if (config_enabled(CONFIG_32BIT)) {
if (IS_ENABLED(CONFIG_32BIT)) {
err = SIGILL;
break;
}
Expand Down Expand Up @@ -1603,7 +1603,7 @@ int mipsr2_decoder(struct pt_regs *regs, u32 inst, unsigned long *fcr31)
break;

case ldr_op:
if (config_enabled(CONFIG_32BIT)) {
if (IS_ENABLED(CONFIG_32BIT)) {
err = SIGILL;
break;
}
Expand Down Expand Up @@ -1722,7 +1722,7 @@ int mipsr2_decoder(struct pt_regs *regs, u32 inst, unsigned long *fcr31)
break;

case sdl_op:
if (config_enabled(CONFIG_32BIT)) {
if (IS_ENABLED(CONFIG_32BIT)) {
err = SIGILL;
break;
}
Expand Down Expand Up @@ -1840,7 +1840,7 @@ int mipsr2_decoder(struct pt_regs *regs, u32 inst, unsigned long *fcr31)
break;

case sdr_op:
if (config_enabled(CONFIG_32BIT)) {
if (IS_ENABLED(CONFIG_32BIT)) {
err = SIGILL;
break;
}
Expand Down Expand Up @@ -2072,7 +2072,7 @@ int mipsr2_decoder(struct pt_regs *regs, u32 inst, unsigned long *fcr31)
break;

case lld_op:
if (config_enabled(CONFIG_32BIT)) {
if (IS_ENABLED(CONFIG_32BIT)) {
err = SIGILL;
break;
}
Expand Down Expand Up @@ -2133,7 +2133,7 @@ int mipsr2_decoder(struct pt_regs *regs, u32 inst, unsigned long *fcr31)
break;

case scd_op:
if (config_enabled(CONFIG_32BIT)) {
if (IS_ENABLED(CONFIG_32BIT)) {
err = SIGILL;
break;
}
Expand Down
4 changes: 2 additions & 2 deletions arch/mips/kernel/pm-cps.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ int cps_pm_enter_state(enum cps_pm_state state)
}

/* Setup the VPE to run mips_cps_pm_restore when started again */
if (config_enabled(CONFIG_CPU_PM) && state == CPS_PM_POWER_GATED) {
if (IS_ENABLED(CONFIG_CPU_PM) && state == CPS_PM_POWER_GATED) {
/* Power gating relies upon CPS SMP */
if (!mips_cps_smp_in_use())
return -EINVAL;
Expand Down Expand Up @@ -387,7 +387,7 @@ static void * __init cps_gen_entry_code(unsigned cpu, enum cps_pm_state state)
memset(labels, 0, sizeof(labels));
memset(relocs, 0, sizeof(relocs));

if (config_enabled(CONFIG_CPU_PM) && state == CPS_PM_POWER_GATED) {
if (IS_ENABLED(CONFIG_CPU_PM) && state == CPS_PM_POWER_GATED) {
/* Power gating relies upon CPS SMP */
if (!mips_cps_smp_in_use())
goto out_err;
Expand Down
Loading

0 comments on commit 97f2645

Please sign in to comment.