[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YZvCtN/WNyogs9JZ@shell.armlinux.org.uk>
Date: Mon, 22 Nov 2021 16:17:56 +0000
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Geert Uytterhoeven <geert+renesas@...der.be>
Cc: Oleg Nesterov <oleg@...hat.com>,
Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ARM: ptrace: Use bitfield helpers
On Mon, Nov 22, 2021 at 04:53:41PM +0100, Geert Uytterhoeven wrote:
> The isa_mode() macro extracts two fields, and recombines them into a
> single value. The shift value of the J-bit may look off-by-one to the
> casual reader, as it is the net result of the extraction and
> recombination steps.
I'd recommend avoiding the suggestion that the explicit "- 1" could
be misinterpreted as an off-by-one error.
> #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) | \
I'd suggest getting rid of the extra unnecessary parens there.
Too many parens leads to a decrease in readability.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists