[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240215174945.GA29299@redhat.com>
Date: Thu, 15 Feb 2024 18:50:11 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Geert Uytterhoeven <geert+renesas@...der.be>
Cc: Russell King <linux@...linux.org.uk>,
Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [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@...hat.com>
Powered by blists - more mailing lists