From: Luca Ceresoli <luca.ceresoli@bootlin.com>
To: "A.T. Jefferies" <alextjefferies@gmail.com>
Cc: thierry.reding@gmail.com, jonathanh@nvidia.com,
skomatineni@nvidia.com, mchehab@kernel.org,
gregkh@linuxfoundation.org, linux-media@vger.kernel.org,
linux-tegra@vger.kernel.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: media: tegra-video: use BIT() macro instead of shift
Date: Fri, 25 Jul 2025 10:09:43 +0200 [thread overview]
Message-ID: <20250725100943.0a974c7c@booty> (raw)
In-Reply-To: <20250723231757.15443-1-alextjefferies@gmail.com>
Hello A.T. Jefferies,
On Wed, 23 Jul 2025 23:17:57 +0000
"A.T. Jefferies" <alextjefferies@gmail.com> wrote:
> Replace two instances of (1 << X) with BIT(X) in tegra20.c to follow
> kernel coding style guidelines and improve clarity. The BIT() macro
> also ensures proper type handling for larger shifts.
>
> Signed-off-by: A.T. Jefferies <alextjefferies@gmail.com>
> ---
> drivers/staging/media/tegra-video/tegra20.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/media/tegra-video/tegra20.c b/drivers/staging/media/tegra-video/tegra20.c
> index 7b8f8f810b35..1473f1b1f203 100644
> --- a/drivers/staging/media/tegra-video/tegra20.c
> +++ b/drivers/staging/media/tegra-video/tegra20.c
> @@ -42,7 +42,7 @@
> #define VI_INPUT_BT656 BIT(25)
> #define VI_INPUT_YUV_INPUT_FORMAT_SFT 8 /* bits [9:8] */
> #define VI_INPUT_YUV_INPUT_FORMAT_UYVY (0 << VI_INPUT_YUV_INPUT_FORMAT_SFT)
> -#define VI_INPUT_YUV_INPUT_FORMAT_VYUY (1 << VI_INPUT_YUV_INPUT_FORMAT_SFT)
> +#define VI_INPUT_YUV_INPUT_FORMAT_VYUY BIT(VI_INPUT_YUV_INPUT_FORMAT_SFT)
> #define VI_INPUT_YUV_INPUT_FORMAT_YUYV (2 << VI_INPUT_YUV_INPUT_FORMAT_SFT)
> #define VI_INPUT_YUV_INPUT_FORMAT_YVYU (3 << VI_INPUT_YUV_INPUT_FORMAT_SFT)
Thanks for your patch. However I'm afraid I don't think this is a good
idea. 1 is just one out of 4 possible values out of 4 possible values
for a multi-bit register field. All the 4 should use the same style.
BIT() is perfect for single-bit register fields. It's not for multi-bit
fields.
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
prev parent reply other threads:[~2025-07-25 8:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-23 23:17 [PATCH] staging: media: tegra-video: use BIT() macro instead of shift A.T. Jefferies
2025-07-25 8:09 ` Luca Ceresoli [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=20250725100943.0a974c7c@booty \
--to=luca.ceresoli@bootlin.com \
--cc=alextjefferies@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=linux-tegra@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=skomatineni@nvidia.com \
--cc=thierry.reding@gmail.com \
/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.