forked from luck/tmp_suning_uos_patched
97f2645f35
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: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Kees 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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
140 lines
3.0 KiB
C
140 lines
3.0 KiB
C
/*
|
|
* Access to user system call parameters and results
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
* for more details.
|
|
*
|
|
* See asm-generic/syscall.h for descriptions of what we must do here.
|
|
*
|
|
* Copyright (C) 2012 Ralf Baechle <ralf@linux-mips.org>
|
|
*/
|
|
|
|
#ifndef __ASM_MIPS_SYSCALL_H
|
|
#define __ASM_MIPS_SYSCALL_H
|
|
|
|
#include <linux/compiler.h>
|
|
#include <uapi/linux/audit.h>
|
|
#include <linux/elf-em.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/uaccess.h>
|
|
#include <asm/ptrace.h>
|
|
#include <asm/unistd.h>
|
|
|
|
#ifndef __NR_syscall /* Only defined if _MIPS_SIM == _MIPS_SIM_ABI32 */
|
|
#define __NR_syscall 4000
|
|
#endif
|
|
|
|
static inline long syscall_get_nr(struct task_struct *task,
|
|
struct pt_regs *regs)
|
|
{
|
|
return current_thread_info()->syscall;
|
|
}
|
|
|
|
static inline unsigned long mips_get_syscall_arg(unsigned long *arg,
|
|
struct task_struct *task, struct pt_regs *regs, unsigned int n)
|
|
{
|
|
unsigned long usp __maybe_unused = regs->regs[29];
|
|
|
|
switch (n) {
|
|
case 0: case 1: case 2: case 3:
|
|
*arg = regs->regs[4 + n];
|
|
|
|
return 0;
|
|
|
|
#ifdef CONFIG_32BIT
|
|
case 4: case 5: case 6: case 7:
|
|
return get_user(*arg, (int *)usp + n);
|
|
#endif
|
|
|
|
#ifdef CONFIG_64BIT
|
|
case 4: case 5: case 6: case 7:
|
|
#ifdef CONFIG_MIPS32_O32
|
|
if (test_thread_flag(TIF_32BIT_REGS))
|
|
return get_user(*arg, (int *)usp + n);
|
|
else
|
|
#endif
|
|
*arg = regs->regs[4 + n];
|
|
|
|
return 0;
|
|
#endif
|
|
|
|
default:
|
|
BUG();
|
|
}
|
|
|
|
unreachable();
|
|
}
|
|
|
|
static inline long syscall_get_return_value(struct task_struct *task,
|
|
struct pt_regs *regs)
|
|
{
|
|
return regs->regs[2];
|
|
}
|
|
|
|
static inline void syscall_rollback(struct task_struct *task,
|
|
struct pt_regs *regs)
|
|
{
|
|
/* Do nothing */
|
|
}
|
|
|
|
static inline void syscall_set_return_value(struct task_struct *task,
|
|
struct pt_regs *regs,
|
|
int error, long val)
|
|
{
|
|
if (error) {
|
|
regs->regs[2] = -error;
|
|
regs->regs[7] = -1;
|
|
} else {
|
|
regs->regs[2] = val;
|
|
regs->regs[7] = 0;
|
|
}
|
|
}
|
|
|
|
static inline void syscall_get_arguments(struct task_struct *task,
|
|
struct pt_regs *regs,
|
|
unsigned int i, unsigned int n,
|
|
unsigned long *args)
|
|
{
|
|
int ret;
|
|
/* O32 ABI syscall() - Either 64-bit with O32 or 32-bit */
|
|
if ((IS_ENABLED(CONFIG_32BIT) ||
|
|
test_tsk_thread_flag(task, TIF_32BIT_REGS)) &&
|
|
(regs->regs[2] == __NR_syscall))
|
|
i++;
|
|
|
|
while (n--)
|
|
ret |= mips_get_syscall_arg(args++, task, regs, i++);
|
|
|
|
/*
|
|
* No way to communicate an error because this is a void function.
|
|
*/
|
|
#if 0
|
|
return ret;
|
|
#endif
|
|
}
|
|
|
|
extern const unsigned long sys_call_table[];
|
|
extern const unsigned long sys32_call_table[];
|
|
extern const unsigned long sysn32_call_table[];
|
|
|
|
static inline int syscall_get_arch(void)
|
|
{
|
|
int arch = AUDIT_ARCH_MIPS;
|
|
#ifdef CONFIG_64BIT
|
|
if (!test_thread_flag(TIF_32BIT_REGS)) {
|
|
arch |= __AUDIT_ARCH_64BIT;
|
|
/* N32 sets only TIF_32BIT_ADDR */
|
|
if (test_thread_flag(TIF_32BIT_ADDR))
|
|
arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32;
|
|
}
|
|
#endif
|
|
#if defined(__LITTLE_ENDIAN)
|
|
arch |= __AUDIT_ARCH_LE;
|
|
#endif
|
|
return arch;
|
|
}
|
|
|
|
#endif /* __ASM_MIPS_SYSCALL_H */
|