Skip to contentSkip to conversation

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

PATCH Superseded Allen Pais 2 participants 4 messages Sep 13, 2017

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Allen Pais

author
#0 lore raw

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

---
 drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c +1 -1
index e882b55..d822918 100644
@@ -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.
Signature · 1 line
2.7.4
#1 lore raw

You need a changelog.

Quoted 10 lines · Allen Pais
---
 drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c +0 -0
index e882b55..d822918 100644

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c static enum ia_css_frame_format yuv422_copy_formats[] = { · line 454

Quoted 5 lines
drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c +1 -1
@@ -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

author
#2 lore raw
Quoted 6 lines

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c static enum ia_css_frame_format yuv422_copy_formats[] = { · line 454

Quoted 3 lines
drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c +1 -1
-#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

#3 lore raw

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