From: Steven Price <steven.price@arm.com>
To: Jinjie Ruan <ruanjinjie@huawei.com>,
boris.brezillon@collabora.com, liviu.dudau@arm.com,
maarten.lankhorst@linux.intel.com, mripard@kernel.org,
tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] drm/panthor: Use the BITS_PER_LONG macro
Date: Mon, 2 Sep 2024 10:23:08 +0100 [thread overview]
Message-ID: <33ff88fc-0372-48ed-b66e-85841eda83aa@arm.com> (raw)
In-Reply-To: <20240831024532.455361-1-ruanjinjie@huawei.com>
On 31/08/2024 03:45, Jinjie Ruan wrote:
> sizeof(unsigned long) * 8 is the number of bits in an unsigned long
> variable, replace it with BITS_PER_LONG macro to make them simpler.
>
> And fix the warning:
> WARNING: Comparisons should place the constant on the right side of the test
> #23: FILE: drivers/gpu/drm/panthor/panthor_mmu.c:2696:
> + if (BITS_PER_LONG < va_bits) {
>
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> ---
> drivers/gpu/drm/panthor/panthor_mmu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
> index d47972806d50..2a0c46391374 100644
> --- a/drivers/gpu/drm/panthor/panthor_mmu.c
> +++ b/drivers/gpu/drm/panthor/panthor_mmu.c
> @@ -2693,7 +2693,7 @@ int panthor_mmu_init(struct panthor_device *ptdev)
> * which passes iova as an unsigned long. Patch the mmu_features to reflect this
> * limitation.
> */
> - if (sizeof(unsigned long) * 8 < va_bits) {
> + if (va_bits > BITS_PER_LONG) {
> ptdev->gpu_info.mmu_features &= ~GENMASK(7, 0);
> ptdev->gpu_info.mmu_features |= sizeof(unsigned long) * 8;
Can you fix this to BITS_PER_LONG too? Since this code is clamping the
value in mmu_features it looks really odd to have the new value written
differently to the test in the 'if' statement.
Also, a minor point, but the "-next" tag in the subject is
pointless/confusing - this code is in mainline already (merged for
v6.10-rc1).
Thanks,
Steve
prev parent reply other threads:[~2024-09-02 9:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-31 2:45 Jinjie Ruan
2024-09-02 9:23 ` Steven Price [this message]
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=33ff88fc-0372-48ed-b66e-85841eda83aa@arm.com \
--to=steven.price@arm.com \
--cc=airlied@gmail.com \
--cc=boris.brezillon@collabora.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liviu.dudau@arm.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=ruanjinjie@huawei.com \
--cc=tzimmermann@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®