MIPS: bitops: ins start position is always an immediate
authorPaul Burton <paul.burton@mips.com>
Tue, 1 Oct 2019 21:53:29 +0000 (21:53 +0000)
committerPaul Burton <paul.burton@mips.com>
Mon, 7 Oct 2019 16:42:42 +0000 (09:42 -0700)
The start position for an ins instruction is always encoded as an
immediate, so allowing registers to be used by the inline asm makes no
sense. It should never happen anyway since a bit index should always be
small enough to be treated as an immediate, but remove the nonsensical
"r" for sanity.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Cc: linux-mips@vger.kernel.org
Cc: Huacai Chen <chenhc@lemote.com>
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: linux-kernel@vger.kernel.org
arch/mips/include/asm/bitops.h

index 0f5329e32e877fe3fc9876da15808b39b7204f37..03532ae9f5289ede836f6df7b725bf4d7458bcb7 100644 (file)
@@ -85,7 +85,7 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
                        "       " __INS "%0, %3, %2, 1                  \n"
                        "       " __SC "%0, %1                          \n"
                        : "=&r" (temp), "+" GCC_OFF_SMALL_ASM() (*m)
-                       : "ir" (bit), "r" (~0)
+                       : "i" (bit), "r" (~0)
                        : __LLSC_CLOBBER);
                } while (unlikely(!temp));
                return;
@@ -150,7 +150,7 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
                        "       " __INS "%0, $0, %2, 1                  \n"
                        "       " __SC "%0, %1                          \n"
                        : "=&r" (temp), "+" GCC_OFF_SMALL_ASM() (*m)
-                       : "ir" (bit)
+                       : "i" (bit)
                        : __LLSC_CLOBBER);
                } while (unlikely(!temp));
                return;
@@ -383,7 +383,7 @@ static inline int test_and_clear_bit(unsigned long nr,
                        "       " __INS "%0, $0, %3, 1                  \n"
                        "       " __SC  "%0, %1                         \n"
                        : "=&r" (temp), "+" GCC_OFF_SMALL_ASM() (*m), "=&r" (res)
-                       : "ir" (bit)
+                       : "i" (bit)
                        : __LLSC_CLOBBER);
                } while (unlikely(!temp));
        } else {