usb: gadget: f_mtp: Avoid race between mtp_read and mtp_function_disable
[GitHub/exynos8895/android_kernel_samsung_universal8895.git] / arch / arm64 / include / asm / current.h
CommitLineData
4ca3c2cf
MR
1#ifndef __ASM_CURRENT_H
2#define __ASM_CURRENT_H
3
4#include <linux/compiler.h>
5
6#include <asm/sysreg.h>
7
8#ifndef __ASSEMBLY__
9
10#ifdef CONFIG_THREAD_INFO_IN_TASK
11struct task_struct;
12
b32ed105
MR
13/*
14 * We don't use read_sysreg() as we want the compiler to cache the value where
15 * possible.
16 */
4ca3c2cf
MR
17static __always_inline struct task_struct *get_current(void)
18{
b32ed105
MR
19 unsigned long sp_el0;
20
21 asm ("mrs %0, sp_el0" : "=r" (sp_el0));
22
23 return (struct task_struct *)sp_el0;
4ca3c2cf
MR
24}
25#define current get_current()
26#else
27#include <linux/thread_info.h>
28#define get_current() (current_thread_info()->task)
29#define current get_current()
30#endif
31
32#endif /* __ASSEMBLY__ */
33
34#endif /* __ASM_CURRENT_H */
35