[PATCH v2] ARM: ptrace: Use bitfield helpers
Oleg Nesterov
oleg at redhat.com
Thu Feb 15 09:50:11 PST 2024
Sorry for the noise, can't resist...
I am replying only because I wasn't aware of bitfield.h and useful
helpers there.
Thank you ;)
On 02/15, Geert Uytterhoeven wrote:
>
> #ifndef __ASSEMBLY__
> +#include <linux/bitfield.h>
> #include <linux/types.h>
>
> struct pt_regs {
> @@ -35,8 +36,8 @@ struct svc_pt_regs {
>
> #ifndef CONFIG_CPU_V7M
> #define isa_mode(regs) \
> - ((((regs)->ARM_cpsr & PSR_J_BIT) >> (__ffs(PSR_J_BIT) - 1)) | \
> - (((regs)->ARM_cpsr & PSR_T_BIT) >> (__ffs(PSR_T_BIT))))
> + (FIELD_GET(PSR_J_BIT, (regs)->ARM_cpsr) << 1 | \
> + FIELD_GET(PSR_T_BIT, (regs)->ARM_cpsr))
Reviewed-by: Oleg Nesterov <oleg at redhat.com>
More information about the linux-arm-kernel
mailing list