From: Rishab Madhugiri <rishab.madhugiri@gmail.com>
To: hansg@kernel.org, mchehab@kernel.org, gregkh@linuxfoundation.org
Cc: andy@kernel.org, sakari.ailus@linux.intel.com,
linux-staging@lists.linux.dev, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org, error27@gmail.com,
Rishab Madhugiri <rishab.madhugiri@gmail.com>
Subject: [PATCH v3] staging: media: atomisp: Use ARRAY_SIZE macro
Date: Sun, 16 Aug 2026 01:01:26 +0000 [thread overview]
Message-ID: <20260816010126.159514-1-rishab.madhugiri@gmail.com> (raw)
Clean up loop bound calculation by replacing sizeof(bds_factors) /
sizeof(struct bayer_ds_factor) with the ARRAY_SIZE() helper macro
to improve readability and maintainability. Move loop counter
increment to the same line as the for loop and declare the loop
counter locally.
Signed-off-by: Rishab Madhugiri <rishab.madhugiri@gmail.com>
---
v3: Declare loop counter variable locally in the for loop and remove
previous function-scope declaration as suggested by Andy Shevchenko.
v2: Move loop increment to the same line as the for statement as
suggested by Dan Carpenter.
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
index 0ee52637e..eacd7ee5c 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
@@ -2118,7 +2118,6 @@ static void __configure_video_pp_input(struct atomisp_sub_device *asd,
static const struct bayer_ds_factor bds_factors[] = {
{8, 1}, {6, 1}, {4, 1}, {3, 1}, {2, 1}, {3, 2}
};
- unsigned int i;
if (width == 0 && height == 0)
return;
@@ -2160,8 +2159,7 @@ static void __configure_video_pp_input(struct atomisp_sub_device *asd,
bayer_ds_out_res->width = effective_res->width;
bayer_ds_out_res->height = effective_res->height;
- for (i = 0; i < sizeof(bds_factors) / sizeof(struct bayer_ds_factor);
- i++) {
+ for (unsigned int i = 0; i < ARRAY_SIZE(bds_factors); i++) {
if (effective_res->width >= out_width *
bds_factors[i].numerator / bds_factors[i].denominator &&
effective_res->height >= out_height *
--
2.43.0
next reply other threads:[~2026-08-16 1:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-16 1:01 Rishab Madhugiri [this message]
2026-08-17 8:10 ` [PATCH v3] staging: media: atomisp: Use ARRAY_SIZE macro Andy Shevchenko
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=20260816010126.159514-1-rishab.madhugiri@gmail.com \
--to=rishab.madhugiri@gmail.com \
--cc=andy@kernel.org \
--cc=error27@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox