lkml.org 
[lkml]   [2024]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] ARM: ptrace: Use bitfield helpers
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@redhat.com>


\
 
 \ /
  Last update: 2024-05-27 15:05    [W:0.071 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site