Skip to content

Commit b36e78b

Browse files
geertuRussell King (Oracle)
authored andcommitted
ARM: 9354/1: ptrace: Use bitfield helpers
The isa_mode() macro extracts two fields, and recombines them into a single value. Make this more obvious by using the FIELD_GET() helper, and shifting the result into its final resting place. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
1 parent b9920fd commit b36e78b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

arch/arm/include/asm/ptrace.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <uapi/asm/ptrace.h>
1111

1212
#ifndef __ASSEMBLY__
13+
#include <linux/bitfield.h>
1314
#include <linux/types.h>
1415

1516
struct pt_regs {
@@ -35,8 +36,8 @@ struct svc_pt_regs {
3536

3637
#ifndef CONFIG_CPU_V7M
3738
#define isa_mode(regs) \
38-
((((regs)->ARM_cpsr & PSR_J_BIT) >> (__ffs(PSR_J_BIT) - 1)) | \
39-
(((regs)->ARM_cpsr & PSR_T_BIT) >> (__ffs(PSR_T_BIT))))
39+
(FIELD_GET(PSR_J_BIT, (regs)->ARM_cpsr) << 1 | \
40+
FIELD_GET(PSR_T_BIT, (regs)->ARM_cpsr))
4041
#else
4142
#define isa_mode(regs) 1 /* Thumb */
4243
#endif

0 commit comments

Comments
 (0)