MIPS: BFP: Simplify code slightly.
authorRalf Baechle <ralf@linux-mips.org>
Tue, 3 Jun 2014 11:05:55 +0000 (13:05 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Wed, 4 Jun 2014 20:50:40 +0000 (22:50 +0200)
This keeps the if condition slightly simpler - it's going to become ore
complication.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/net/bpf_jit.c

index 98e9d2395598c41c2446a1f76e468a86e7b38615..a67b9753330b6a6259a2a1471b97a6d8d89b5643 100644 (file)
@@ -1240,7 +1240,10 @@ jmp_cmp:
                        emit_half_load(r_A, r_skb, off, ctx);
 #ifdef CONFIG_CPU_LITTLE_ENDIAN
                        /* This needs little endian fixup */
-                       if (!cpu_has_mips_r2) {
+                       if (cpu_has_mips_r2) {
+                               /* R2 and later have the wsbh instruction */
+                               emit_wsbh(r_A, r_A, ctx);
+                       } else {
                                /* Get first byte */
                                emit_andi(r_tmp_imm, r_A, 0xff, ctx);
                                /* Shift it */
@@ -1250,9 +1253,6 @@ jmp_cmp:
                                emit_andi(r_tmp_imm, r_tmp_imm, 0xff, ctx);
                                /* Put everyting together in r_A */
                                emit_or(r_A, r_tmp, r_tmp_imm, ctx);
-                       } else {
-                               /* R2 and later have the wsbh instruction */
-                               emit_wsbh(r_A, r_A, ctx);
                        }
 #endif
                        break;