Linux Tegra architecture development
 help / color / mirror / Atom feed
* [PATCH] staging: media: tegra-video: prefer using the BIT macro
@ 2026-05-17  6:05 Diego Fernando Mancera Gómez
  2026-05-18  5:08 ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Diego Fernando Mancera Gómez @ 2026-05-17  6:05 UTC (permalink / raw)
  To: thierry.reding, jonathanh, skomatineni, luca.ceresoli, gregkh
  Cc: mchehab, linux-media, linux-tegra, linux-staging,
	Diego Fernando Mancera Gómez

Replace open-coded bit shifts (1 << 28) with the standard kernel BIT
macro. This improves code uniformity, matches style guidelines, and
prevents accidental signed overflow issues.

Signed-off-by: Diego Fernando Mancera Gómez <diegomancera.dev@gmail.com>
---
 drivers/staging/media/tegra-video/tegra20.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/tegra-video/tegra20.c b/drivers/staging/media/tegra-video/tegra20.c
index e513e6ccb..08fa234af 100644
--- a/drivers/staging/media/tegra-video/tegra20.c
+++ b/drivers/staging/media/tegra-video/tegra20.c
@@ -177,7 +177,7 @@ enum tegra_vi_out {
 #define       CSI_SKIP_PACKET_THRESHOLD(n)		(((n) & 0xff) << 16)
 #define TEGRA_CSI_PIXEL_STREAM_CONTROL0(n)		(0x0018 + (n) * 0x2c)
 #define       CSI_PP_PAD_FRAME_PAD0S			(0 << 28)
-#define       CSI_PP_PAD_FRAME_PAD1S			(1 << 28)
+#define       CSI_PP_PAD_FRAME_PAD1S			BIT(28)
 #define       CSI_PP_PAD_FRAME_NOPAD			(2 << 28)
 #define       CSI_PP_HEADER_EC_ENABLE			BIT(27)
 #define       CSI_PP_PAD_SHORT_LINE_PAD0S		(0 << 24)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: media: tegra-video: prefer using the BIT macro
  2026-05-17  6:05 [PATCH] staging: media: tegra-video: prefer using the BIT macro Diego Fernando Mancera Gómez
@ 2026-05-18  5:08 ` Dan Carpenter
  2026-05-18  6:04   ` Diego Fernando Mancera Gomez
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2026-05-18  5:08 UTC (permalink / raw)
  To: Diego Fernando Mancera Gómez
  Cc: thierry.reding, jonathanh, skomatineni, luca.ceresoli, gregkh,
	mchehab, linux-media, linux-tegra, linux-staging

On Sun, May 17, 2026 at 12:05:11AM -0600, Diego Fernando Mancera Gómez wrote:
> Replace open-coded bit shifts (1 << 28) with the standard kernel BIT
> macro. This improves code uniformity, matches style guidelines, and
> prevents accidental signed overflow issues.

It doesn't prevent any "accidental signed overflow issues".

> 
> Signed-off-by: Diego Fernando Mancera Gómez <diegomancera.dev@gmail.com>
> ---
>  drivers/staging/media/tegra-video/tegra20.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/tegra-video/tegra20.c b/drivers/staging/media/tegra-video/tegra20.c
> index e513e6ccb..08fa234af 100644
> --- a/drivers/staging/media/tegra-video/tegra20.c
> +++ b/drivers/staging/media/tegra-video/tegra20.c
> @@ -177,7 +177,7 @@ enum tegra_vi_out {
>  #define       CSI_SKIP_PACKET_THRESHOLD(n)		(((n) & 0xff) << 16)
>  #define TEGRA_CSI_PIXEL_STREAM_CONTROL0(n)		(0x0018 + (n) * 0x2c)
>  #define       CSI_PP_PAD_FRAME_PAD0S			(0 << 28)
> -#define       CSI_PP_PAD_FRAME_PAD1S			(1 << 28)
> +#define       CSI_PP_PAD_FRAME_PAD1S			BIT(28)
>  #define       CSI_PP_PAD_FRAME_NOPAD			(2 << 28)

This change makes the code  less readable.  There are two bits, 28 and
29 and they mean something.  0 meand pad0, 1 means pad1, and 2 means
no pad.  The patch jumbles the pattern.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: media: tegra-video: prefer using the BIT macro
  2026-05-18  5:08 ` Dan Carpenter
@ 2026-05-18  6:04   ` Diego Fernando Mancera Gomez
  0 siblings, 0 replies; 3+ messages in thread
From: Diego Fernando Mancera Gomez @ 2026-05-18  6:04 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: thierry.reding, jonathanh, skomatineni, luca.ceresoli, gregkh,
	mchehab, linux-media, linux-tegra, linux-staging

Hi Dan,

Thank you for the clear explanation. You are absolutely right; I
completely missed the sequential pattern of the values being shifted
into that register field, and using BIT() there obscures the logic.

I also appreciate the correction on the commit message regarding the
signed overflow.

I will drop this patch. Thanks for taking the time to review it.

Best regards,

Diego

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-18  6:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-17  6:05 [PATCH] staging: media: tegra-video: prefer using the BIT macro Diego Fernando Mancera Gómez
2026-05-18  5:08 ` Dan Carpenter
2026-05-18  6:04   ` Diego Fernando Mancera Gomez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox