summaryrefslogtreecommitdiff
path: root/arch/x86/kernel/fpu/core.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2015-04-24 02:13:09 +0200
committerIngo Molnar <mingo@kernel.org>2015-05-19 15:47:29 +0200
commitdb2b1d3ad1cdae9f268d6db54b6127b09933da3d (patch)
tree2c85e43528860496631d417ec23e634d3a292029 /arch/x86/kernel/fpu/core.c
parentc69e098b1f90c0d520c4d5b5bff9f2ede95b13a8 (diff)
x86/fpu: Use 'struct fpu' in fpstate_alloc_init()
Migrate this function to pure 'struct fpu' usage. Reviewed-by: Borislav Petkov <bp@alien8.de> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/fpu/core.c')
-rw-r--r--arch/x86/kernel/fpu/core.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
index a84358575235..183e69dfd4d0 100644
--- a/arch/x86/kernel/fpu/core.c
+++ b/arch/x86/kernel/fpu/core.c
@@ -263,12 +263,11 @@ int fpu__copy(struct fpu *dst_fpu, struct fpu *src_fpu)
*
* Can fail.
*/
-int fpstate_alloc_init(struct task_struct *curr)
+int fpstate_alloc_init(struct fpu *fpu)
{
- struct fpu *fpu = &curr->thread.fpu;
int ret;
- if (WARN_ON_ONCE(curr != current))
+ if (WARN_ON_ONCE(fpu != &current->thread.fpu))
return -EINVAL;
if (WARN_ON_ONCE(fpu->fpstate_active))
return -EINVAL;
@@ -276,11 +275,11 @@ int fpstate_alloc_init(struct task_struct *curr)
/*
* Memory allocation at the first usage of the FPU and other state.
*/
- ret = fpstate_alloc(&curr->thread.fpu);
+ ret = fpstate_alloc(fpu);
if (ret)
return ret;
- fpstate_init(&curr->thread.fpu);
+ fpstate_init(fpu);
/* Safe to do for the current task: */
fpu->fpstate_active = 1;
@@ -360,7 +359,7 @@ void fpu__restore(void)
/*
* does a slab alloc which can sleep
*/
- if (fpstate_alloc_init(tsk)) {
+ if (fpstate_alloc_init(fpu)) {
/*
* ran out of memory!
*/
@@ -396,7 +395,7 @@ void fpu__flush_thread(struct task_struct *tsk)
} else {
if (!fpu->fpstate_active) {
/* kthread execs. TODO: cleanup this horror. */
- if (WARN_ON(fpstate_alloc_init(tsk)))
+ if (WARN_ON(fpstate_alloc_init(fpu)))
force_sig(SIGKILL, tsk);
user_fpu_begin();
}