Re: [PATCH] staging: media: atomisp: Use ARRAY_SIZE macro

Dan Carpenter <[email protected]>
Newsgroups org.kernel.vger.linux-media,dev.linux.lists.linux-staging,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Thu, Aug 13, 2026 at 02:03:54AM +0000, Rishab Madhugiri wrote:
> 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.
> 
> Signed-off-by: Rishab Madhugiri <[email protected]>
> ---
>  drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> index 0ee52637e..83519dd8a 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> @@ -2160,7 +2160,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);
> +	for (i = 0; i < ARRAY_SIZE(bds_factors);
>  	     i++) {

The i++ fits on that line now, so move it up as well.

regards,
dan carpenter

>  		if (effective_res->width >= out_width *
>  		    bds_factors[i].numerator / bds_factors[i].denominator &&
> -- 
> 2.43.0
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.