Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 97f2645f authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Linus Torvalds
Browse files

tree-wide: replace config_enabled() with IS_ENABLED()

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/1465215656-20569-1-git-send-email-yamada.masahiro@socionext.com


Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: default avatarKees Cook <keescook@chromium.org>
Cc: Stas Sergeev <stsp@list.ru>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: Joshua Kinard <kumba@gentoo.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Markos Chandras <markos.chandras@imgtec.com>
Cc: "Dmitry V. Levin" <ldv@altlinux.org>
Cc: yu-cheng yu <yu-cheng.yu@intel.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Will Drewry <wad@chromium.org>
Cc: Nikolay Martynov <mar.kolya@gmail.com>
Cc: Huacai Chen <chenhc@lemote.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Cc: Rafal Milecki <zajec5@gmail.com>
Cc: James Cowgill <James.Cowgill@imgtec.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Alex Smith <alex.smith@imgtec.com>
Cc: Adam Buchbinder <adam.buchbinder@gmail.com>
Cc: Qais Yousef <qais.yousef@imgtec.com>
Cc: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Brian Norris <computersforpeace@gmail.com>
Cc: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
Cc: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Roland McGrath <roland@hack.frob.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: Kalle Valo <kvalo@qca.qualcomm.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Tony Wu <tung7970@gmail.com>
Cc: Huaitong Han <huaitong.han@intel.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Juergen Gross <jgross@suse.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andrea Gelmini <andrea.gelmini@gelma.net>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Rabin Vincent <rabin@rab.in>
Cc: "Maciej W. Rozycki" <macro@imgtec.com>
Cc: David Daney <david.daney@cavium.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1c8cb409
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -462,7 +462,7 @@ static inline unsigned int mips_cm_max_vp_width(void)
	if (mips_cm_revision() >= CM_REV_CM3)
	if (mips_cm_revision() >= CM_REV_CM3)
		return read_gcr_sys_config2() & CM_GCR_SYS_CONFIG2_MAXVPW_MSK;
		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 smp_num_siblings;


	return 1;
	return 1;
+8 −8
Original line number Original line Diff line number Diff line
@@ -159,7 +159,7 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
		 * it better already be global)
		 * it better already be global)
		 */
		 */
		if (pte_none(*buddy)) {
		if (pte_none(*buddy)) {
			if (!config_enabled(CONFIG_XPA))
			if (!IS_ENABLED(CONFIG_XPA))
				buddy->pte_low |= _PAGE_GLOBAL;
				buddy->pte_low |= _PAGE_GLOBAL;
			buddy->pte_high |= _PAGE_GLOBAL;
			buddy->pte_high |= _PAGE_GLOBAL;
		}
		}
@@ -172,7 +172,7 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt


	htw_stop();
	htw_stop();
	/* Preserve global status for the pair */
	/* Preserve global status for the pair */
	if (config_enabled(CONFIG_XPA)) {
	if (IS_ENABLED(CONFIG_XPA)) {
		if (ptep_buddy(ptep)->pte_high & _PAGE_GLOBAL)
		if (ptep_buddy(ptep)->pte_high & _PAGE_GLOBAL)
			null.pte_high = _PAGE_GLOBAL;
			null.pte_high = _PAGE_GLOBAL;
	} else {
	} else {
@@ -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)
static inline pte_t pte_wrprotect(pte_t pte)
{
{
	pte.pte_low  &= ~_PAGE_WRITE;
	pte.pte_low  &= ~_PAGE_WRITE;
	if (!config_enabled(CONFIG_XPA))
	if (!IS_ENABLED(CONFIG_XPA))
		pte.pte_low &= ~_PAGE_SILENT_WRITE;
		pte.pte_low &= ~_PAGE_SILENT_WRITE;
	pte.pte_high &= ~_PAGE_SILENT_WRITE;
	pte.pte_high &= ~_PAGE_SILENT_WRITE;
	return pte;
	return pte;
@@ -328,7 +328,7 @@ static inline pte_t pte_wrprotect(pte_t pte)
static inline pte_t pte_mkclean(pte_t pte)
static inline pte_t pte_mkclean(pte_t pte)
{
{
	pte.pte_low  &= ~_PAGE_MODIFIED;
	pte.pte_low  &= ~_PAGE_MODIFIED;
	if (!config_enabled(CONFIG_XPA))
	if (!IS_ENABLED(CONFIG_XPA))
		pte.pte_low &= ~_PAGE_SILENT_WRITE;
		pte.pte_low &= ~_PAGE_SILENT_WRITE;
	pte.pte_high &= ~_PAGE_SILENT_WRITE;
	pte.pte_high &= ~_PAGE_SILENT_WRITE;
	return pte;
	return pte;
@@ -337,7 +337,7 @@ static inline pte_t pte_mkclean(pte_t pte)
static inline pte_t pte_mkold(pte_t pte)
static inline pte_t pte_mkold(pte_t pte)
{
{
	pte.pte_low  &= ~_PAGE_ACCESSED;
	pte.pte_low  &= ~_PAGE_ACCESSED;
	if (!config_enabled(CONFIG_XPA))
	if (!IS_ENABLED(CONFIG_XPA))
		pte.pte_low &= ~_PAGE_SILENT_READ;
		pte.pte_low &= ~_PAGE_SILENT_READ;
	pte.pte_high &= ~_PAGE_SILENT_READ;
	pte.pte_high &= ~_PAGE_SILENT_READ;
	return pte;
	return pte;
@@ -347,7 +347,7 @@ static inline pte_t pte_mkwrite(pte_t pte)
{
{
	pte.pte_low |= _PAGE_WRITE;
	pte.pte_low |= _PAGE_WRITE;
	if (pte.pte_low & _PAGE_MODIFIED) {
	if (pte.pte_low & _PAGE_MODIFIED) {
		if (!config_enabled(CONFIG_XPA))
		if (!IS_ENABLED(CONFIG_XPA))
			pte.pte_low |= _PAGE_SILENT_WRITE;
			pte.pte_low |= _PAGE_SILENT_WRITE;
		pte.pte_high |= _PAGE_SILENT_WRITE;
		pte.pte_high |= _PAGE_SILENT_WRITE;
	}
	}
@@ -358,7 +358,7 @@ static inline pte_t pte_mkdirty(pte_t pte)
{
{
	pte.pte_low |= _PAGE_MODIFIED;
	pte.pte_low |= _PAGE_MODIFIED;
	if (pte.pte_low & _PAGE_WRITE) {
	if (pte.pte_low & _PAGE_WRITE) {
		if (!config_enabled(CONFIG_XPA))
		if (!IS_ENABLED(CONFIG_XPA))
			pte.pte_low |= _PAGE_SILENT_WRITE;
			pte.pte_low |= _PAGE_SILENT_WRITE;
		pte.pte_high |= _PAGE_SILENT_WRITE;
		pte.pte_high |= _PAGE_SILENT_WRITE;
	}
	}
@@ -369,7 +369,7 @@ static inline pte_t pte_mkyoung(pte_t pte)
{
{
	pte.pte_low |= _PAGE_ACCESSED;
	pte.pte_low |= _PAGE_ACCESSED;
	if (!(pte.pte_low & _PAGE_NO_READ)) {
	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_low |= _PAGE_SILENT_READ;
		pte.pte_high |= _PAGE_SILENT_READ;
		pte.pte_high |= _PAGE_SILENT_READ;
	}
	}
+2 −2
Original line number Original line Diff line number Diff line
@@ -16,10 +16,10 @@ static inline const int *get_compat_mode1_syscalls(void)
		0, /* null terminated */
		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;
		return syscalls_O32;


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


	BUG();
	BUG();
+2 −2
Original line number Original line Diff line number Diff line
@@ -19,8 +19,8 @@ extern struct mips_abi mips_abi_32;
		((ka)->sa.sa_flags & SA_SIGINFO))
		((ka)->sa.sa_flags & SA_SIGINFO))
#else
#else
#define sig_uses_siginfo(ka, abi)                               \
#define sig_uses_siginfo(ka, abi)                               \
	(config_enabled(CONFIG_64BIT) ? 1 :                     \
	(IS_ENABLED(CONFIG_64BIT) ? 1 :                     \
		(config_enabled(CONFIG_TRAD_SIGNALS) ?          \
		(IS_ENABLED(CONFIG_TRAD_SIGNALS) ?          \
			((ka)->sa.sa_flags & SA_SIGINFO) : 1) )
			((ka)->sa.sa_flags & SA_SIGINFO) : 1) )
#endif
#endif


+1 −1
Original line number Original line Diff line number Diff line
@@ -99,7 +99,7 @@ static inline void syscall_get_arguments(struct task_struct *task,
{
{
	int ret;
	int ret;
	/* O32 ABI syscall() - Either 64-bit with O32 or 32-bit */
	/* 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)) &&
	    test_tsk_thread_flag(task, TIF_32BIT_REGS)) &&
	    (regs->regs[2] == __NR_syscall))
	    (regs->regs[2] == __NR_syscall))
		i++;
		i++;
Loading