x86/fpu: Use 'struct fpu' in fpu__save()
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>
diff --git a/arch/x86/include/asm/i387.h b/arch/x86/include/asm/i387.h
index e69989f..e3b42c5 100644
--- a/arch/x86/include/asm/i387.h
+++ b/arch/x86/include/asm/i387.h
@@ -100,7 +100,7 @@
return current->thread.fpu.has_fpu;
}
-extern void fpu__save(struct task_struct *tsk);
+extern void fpu__save(struct fpu *fpu);
#endif /* __ASSEMBLY__ */
diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
index 7c05300..b685e9e 100644
--- a/arch/x86/kernel/fpu/core.c
+++ b/arch/x86/kernel/fpu/core.c
@@ -142,11 +142,9 @@
*
* This only ever gets called for the current task.
*/
-void fpu__save(struct task_struct *tsk)
+void fpu__save(struct fpu *fpu)
{
- struct fpu *fpu = &tsk->thread.fpu;
-
- WARN_ON(tsk != current);
+ WARN_ON(fpu != ¤t->thread.fpu);
preempt_disable();
if (fpu->has_fpu) {
@@ -240,7 +238,7 @@
memset(&dst->thread.fpu.state->xsave, 0, xstate_size);
__save_fpu(dst_fpu);
} else {
- fpu__save(src);
+ fpu__save(src_fpu);
memcpy(dst_fpu->state, src_fpu->state, xstate_size);
}
}
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 22ad90a..8abcd6a 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -730,7 +730,7 @@
/*
* Save the info for the exception handler and clear the error.
*/
- fpu__save(task);
+ fpu__save(&task->thread.fpu);
task->thread.trap_nr = trapnr;
task->thread.error_code = error_code;
info.si_signo = SIGFPE;