From: Oleg Nesterov <oleg@redhat.com>
To: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: "Russell King" <linux@armlinux.org.uk>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] ARM: ptrace: Use bitfield helpers
Date: Thu, 15 Feb 2024 18:50:11 +0100 [thread overview]
Message-ID: <20240215174945.GA29299@redhat.com> (raw)
In-Reply-To: <f73e6deb1bef9696661a62498ee5a56ac9a389ce.1708005130.git.geert+renesas@glider.be>
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>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Oleg Nesterov <oleg@redhat.com>
To: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: "Russell King" <linux@armlinux.org.uk>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] ARM: ptrace: Use bitfield helpers
Date: Thu, 15 Feb 2024 18:50:11 +0100 [thread overview]
Message-ID: <20240215174945.GA29299@redhat.com> (raw)
In-Reply-To: <f73e6deb1bef9696661a62498ee5a56ac9a389ce.1708005130.git.geert+renesas@glider.be>
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>
next prev parent reply other threads:[~2024-02-15 17:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-15 13:54 [PATCH v2] ARM: ptrace: Use bitfield helpers Geert Uytterhoeven
2024-02-15 13:54 ` Geert Uytterhoeven
2024-02-15 17:50 ` Oleg Nesterov [this message]
2024-02-15 17:50 ` Oleg Nesterov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240215174945.GA29299@redhat.com \
--to=oleg@redhat.com \
--cc=geert+renesas@glider.be \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.