Use get_op() instead of open coding, and remove unneeded line splits.

And remove unneeded local variable initialisation.

Signed-off-by: Christophe Leroy <christophe.le...@csgroup.eu>
---
 arch/powerpc/include/asm/inst.h | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/include/asm/inst.h b/arch/powerpc/include/asm/inst.h
index 57c31e712e67..17f74429d5d6 100644
--- a/arch/powerpc/include/asm/inst.h
+++ b/arch/powerpc/include/asm/inst.h
@@ -3,12 +3,13 @@
 #define _ASM_POWERPC_INST_H
 
 #include <asm/ppc-opcode.h>
+#include <asm/disassemble.h>
 
 #ifdef CONFIG_PPC64
 
 #define ___get_user_instr(gu_op, dest, ptr)                            \
 ({                                                                     \
-       long __gui_ret = 0;                                             \
+       long __gui_ret;                                                 \
        unsigned int __user *__gui_ptr = (unsigned int __user *)ptr;    \
        struct ppc_inst __gui_inst;                                     \
        unsigned int __prefix, __suffix;                                \
@@ -16,10 +17,9 @@
        __chk_user_ptr(ptr);                                            \
        __gui_ret = gu_op(__prefix, __gui_ptr);                         \
        if (__gui_ret == 0) {                                           \
-               if ((__prefix >> 26) == OP_PREFIX) {                    \
+               if (get_op(__prefix) == OP_PREFIX) {                    \
                        __gui_ret = gu_op(__suffix, __gui_ptr + 1);     \
-                       __gui_inst = ppc_inst_prefix(__prefix,          \
-                                                    __suffix);         \
+                       __gui_inst = ppc_inst_prefix(__prefix, __suffix); \
                } else {                                                \
                        __gui_inst = ppc_inst(__prefix);                \
                }                                                       \
@@ -36,11 +36,9 @@
 })
 #endif /* CONFIG_PPC64 */
 
-#define get_user_instr(x, ptr) \
-       ___get_user_instr(get_user, x, ptr)
+#define get_user_instr(x, ptr) ___get_user_instr(get_user, x, ptr)
 
-#define __get_user_instr(x, ptr) \
-       ___get_user_instr(__get_user, x, ptr)
+#define __get_user_instr(x, ptr) ___get_user_instr(__get_user, x, ptr)
 
 /*
  * Instruction data type for POWER
@@ -60,7 +58,7 @@ static inline u32 ppc_inst_val(struct ppc_inst x)
 
 static inline int ppc_inst_primary_opcode(struct ppc_inst x)
 {
-       return ppc_inst_val(x) >> 26;
+       return get_op(ppc_inst_val(x));
 }
 
 #ifdef CONFIG_PPC64
@@ -75,13 +73,12 @@ static inline u32 ppc_inst_suffix(struct ppc_inst x)
 
 static inline bool ppc_inst_prefixed(struct ppc_inst x)
 {
-       return (ppc_inst_primary_opcode(x) == 1) && ppc_inst_suffix(x) != 0xff;
+       return ppc_inst_primary_opcode(x) == OP_PREFIX && ppc_inst_suffix(x) != 
0xff;
 }
 
 static inline struct ppc_inst ppc_inst_swab(struct ppc_inst x)
 {
-       return ppc_inst_prefix(swab32(ppc_inst_val(x)),
-                              swab32(ppc_inst_suffix(x)));
+       return ppc_inst_prefix(swab32(ppc_inst_val(x)), 
swab32(ppc_inst_suffix(x)));
 }
 
 static inline struct ppc_inst ppc_inst_read(const struct ppc_inst *ptr)
@@ -89,7 +86,7 @@ static inline struct ppc_inst ppc_inst_read(const struct 
ppc_inst *ptr)
        u32 val, suffix;
 
        val = *(u32 *)ptr;
-       if ((val >> 26) == OP_PREFIX) {
+       if (get_op(val) == OP_PREFIX) {
                suffix = *((u32 *)ptr + 1);
                return ppc_inst_prefix(val, suffix);
        } else {
-- 
2.25.0

Reply via email to