Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[pandora-kernel.git] / arch / arm / vfp / vfpmodule.c
index 9d265d5..dedbb44 100644 (file)
@@ -40,10 +40,19 @@ unsigned int VFP_arch;
 static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v)
 {
        struct thread_info *thread = v;
-       union vfp_state *vfp = &thread->vfpstate;
+       union vfp_state *vfp;
 
-       switch (cmd) {
-       case THREAD_NOTIFY_FLUSH:
+       if (likely(cmd == THREAD_NOTIFY_SWITCH)) {
+               /*
+                * Always disable VFP so we can lazily save/restore the
+                * old state.
+                */
+               fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_ENABLE);
+               return NOTIFY_DONE;
+       }
+
+       vfp = &thread->vfpstate;
+       if (cmd == THREAD_NOTIFY_FLUSH) {
                /*
                 * Per-thread VFP initialisation.
                 */
@@ -56,29 +65,12 @@ static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v)
                 * Disable VFP to ensure we initialise it first.
                 */
                fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_ENABLE);
-
-               /*
-                * FALLTHROUGH: Ensure we don't try to overwrite our newly
-                * initialised state information on the first fault.
-                */
-
-       case THREAD_NOTIFY_RELEASE:
-               /*
-                * Per-thread VFP cleanup.
-                */
-               if (last_VFP_context == vfp)
-                       last_VFP_context = NULL;
-               break;
-
-       case THREAD_NOTIFY_SWITCH:
-               /*
-                * Always disable VFP so we can lazily save/restore the
-                * old state.
-                */
-               fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_ENABLE);
-               break;
        }
 
+       /* flush and release case: Per-thread VFP cleanup. */
+       if (last_VFP_context == vfp)
+               last_VFP_context = NULL;
+
        return NOTIFY_DONE;
 }
 
@@ -131,7 +123,7 @@ static void vfp_raise_exceptions(u32 exceptions, u32 inst, u32 fpscr, struct pt_
 
        pr_debug("VFP: raising exceptions %08x\n", exceptions);
 
-       if (exceptions == (u32)-1) {
+       if (exceptions == VFP_EXCEPTION_ERROR) {
                vfp_panic("unhandled bounce");
                vfp_raise_sigfpe(0, regs);
                return;
@@ -170,7 +162,7 @@ static void vfp_raise_exceptions(u32 exceptions, u32 inst, u32 fpscr, struct pt_
  */
 static u32 vfp_emulate_instruction(u32 inst, u32 fpscr, struct pt_regs *regs)
 {
-       u32 exceptions = (u32)-1;
+       u32 exceptions = VFP_EXCEPTION_ERROR;
 
        pr_debug("VFP: emulate: INST=0x%08x SCR=0x%08x\n", inst, fpscr);