x86/fpu: Use 'struct fpu' in fpu__save()
authorIngo Molnar <mingo@kernel.org>
Thu, 23 Apr 2015 15:57:24 +0000 (17:57 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 19 May 2015 13:47:28 +0000 (15:47 +0200)
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>
arch/x86/include/asm/i387.h
arch/x86/kernel/fpu/core.c
arch/x86/kernel/traps.c

index e69989f95da5497ff6705132b945718345deb8d6..e3b42c5379bcbbe110c3502b2f33ffd0bde2ad89 100644 (file)
@@ -100,7 +100,7 @@ static inline int user_has_fpu(void)
        return current->thread.fpu.has_fpu;
 }
 
-extern void fpu__save(struct task_struct *tsk);
+extern void fpu__save(struct fpu *fpu);
 
 #endif /* __ASSEMBLY__ */
 
index 7c05300822533a7bcbc0f5c014cb96d4c09f00c9..b685e9e904916ea958b6420a8ea543382191345a 100644 (file)
@@ -142,11 +142,9 @@ static void __save_fpu(struct fpu *fpu)
  *
  * 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 != &current->thread.fpu);
 
        preempt_disable();
        if (fpu->has_fpu) {
@@ -240,7 +238,7 @@ static void fpu_copy(struct task_struct *dst, struct task_struct *src)
                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);
        }
 }
index 22ad90a40dbf17f7e39407e8c7a0820b65159ee0..8abcd6a6f3dc6dfe231c81a153375fb9327b58a8 100644 (file)
@@ -730,7 +730,7 @@ static void math_error(struct pt_regs *regs, int error_code, int trapnr)
        /*
         * 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;