Patchwork drivers:staging/media:Use ARRAY_SIZE() for the size calculation of the array

login
register
mail settings
Submitter Allen
Date Sept. 13, 2017, 8:04 a.m.
Message ID <1505289879-26163-1-git-send-email-allen.lkml@gmail.com>
Download mbox | patch
Permalink /patch/9950649/
State New
Headers show

Comments

Allen - Sept. 13, 2017, 8:04 a.m.
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
 drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Dan Carpenter - Sept. 13, 2017, 8:22 a.m.
You need a changelog.

On Wed, Sep 13, 2017 at 01:34:39PM +0530, Allen Pais wrote:
> Signed-off-by: Allen Pais <allen.lkml@gmail.com>
> ---
>  drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
> index e882b55..d822918 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
> @@ -451,7 +451,7 @@ static enum ia_css_frame_format yuv422_copy_formats[] = {
>  	IA_CSS_FRAME_FORMAT_YUYV
>  };
>  
> -#define array_length(array) (sizeof(array)/sizeof(array[0]))
> +#define array_length(array) (ARRAY_SIZE(array))

Just get rid of this array_length macro and use ARRAY_SIZE() directly.

regards,
dan carpenter
Allen - Sept. 13, 2017, 8:39 a.m.
>>
>> -#define array_length(array) (sizeof(array)/sizeof(array[0]))
>> +#define array_length(array) (ARRAY_SIZE(array))
>
> Just get rid of this array_length macro and use ARRAY_SIZE() directly.
>

 Sure.

       - Allen
Dan Carpenter - Sept. 13, 2017, 8:45 a.m.
Also change the subject prefix to: [media] atomisp: so it's:

Subject: [PATCH v2] [media] atomisp: Use ARRAY_SIZE() instead of open coding it

regards,
dan carpenter

Patch

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
index e882b55..d822918 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
@@ -451,7 +451,7 @@  static enum ia_css_frame_format yuv422_copy_formats[] = {
 	IA_CSS_FRAME_FORMAT_YUYV
 };
 
-#define array_length(array) (sizeof(array)/sizeof(array[0]))
+#define array_length(array) (ARRAY_SIZE(array))
 
 /* Verify whether the selected output format is can be produced
  * by the copy binary given the stream format.