Skip to content

Commit

Permalink
powerpc/inst: Refactor ___get_user_instr()
Browse files Browse the repository at this point in the history
PPC64 version of ___get_user_instr() can be used for PPC32 as well,
by simply disabling the suffix part with IS_ENABLED(CONFIG_PPC64).

Signed-off-by: Christophe Leroy <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://lore.kernel.org/r/1f0ede830ccb33a659119a55cb590820c27004db.1638208156.git.christophe.leroy@csgroup.eu
  • Loading branch information
chleroy authored and mpe committed Dec 9, 2021
1 parent 37eb7ca commit 3261d99
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions arch/powerpc/include/asm/inst.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

#include <asm/ppc-opcode.h>

#ifdef CONFIG_PPC64

#define ___get_user_instr(gu_op, dest, ptr) \
({ \
long __gui_ret; \
Expand All @@ -16,7 +14,7 @@
__chk_user_ptr(ptr); \
__gui_ret = gu_op(__prefix, __gui_ptr); \
if (__gui_ret == 0) { \
if ((__prefix >> 26) == OP_PREFIX) { \
if (IS_ENABLED(CONFIG_PPC64) && (__prefix >> 26) == OP_PREFIX) { \
__gui_ret = gu_op(__suffix, __gui_ptr + 1); \
__gui_inst = ppc_inst_prefix(__prefix, __suffix); \
} else { \
Expand All @@ -27,13 +25,6 @@
} \
__gui_ret; \
})
#else /* !CONFIG_PPC64 */
#define ___get_user_instr(gu_op, dest, ptr) \
({ \
__chk_user_ptr(ptr); \
gu_op((dest).val, (u32 __user *)(ptr)); \
})
#endif /* CONFIG_PPC64 */

#define get_user_instr(x, ptr) ___get_user_instr(get_user, x, ptr)

Expand Down Expand Up @@ -71,7 +62,7 @@ static inline u32 ppc_inst_suffix(struct ppc_inst x)
}

#else
#define ppc_inst_prefix(x, y) ppc_inst(x)
#define ppc_inst_prefix(x, y) ((void)y, ppc_inst(x))

static inline u32 ppc_inst_suffix(struct ppc_inst x)
{
Expand Down

0 comments on commit 3261d99

Please sign in to comment.