Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1731454 > unrolled thread

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

Started byAllen Pais <allen.lkml@gmail.com>
First post2017-09-13 10:40 +0200
Last post2017-09-13 11:00 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] drivers:staging/media:Use ARRAY_SIZE() for the size calculation of the array Allen Pais <allen.lkml@gmail.com> - 2017-09-13 10:40 +0200
    Re: [PATCH v2] drivers:staging/media:Use ARRAY_SIZE() for the size  calculation of the array Dan Carpenter <dan.carpenter@oracle.com> - 2017-09-13 10:50 +0200
      Re: [PATCH v2] drivers:staging/media:Use ARRAY_SIZE() for the size  calculation of the array Allen <allen.lkml@gmail.com> - 2017-09-13 11:00 +0200

#1731454 — [PATCH v2] drivers:staging/media:Use ARRAY_SIZE() for the size calculation of the array

FromAllen Pais <allen.lkml@gmail.com>
Date2017-09-13 10:40 +0200
Subject[PATCH v2] drivers:staging/media:Use ARRAY_SIZE() for the size calculation of the array
Message-ID<upbnb-4Xu-9@gated-at.bofh.it>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
 drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

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..bee3043 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
@@ -451,8 +451,6 @@ static enum ia_css_frame_format yuv422_copy_formats[] = {
 	IA_CSS_FRAME_FORMAT_YUYV
 };
 
-#define array_length(array) (sizeof(array)/sizeof(array[0]))
-
 /* Verify whether the selected output format is can be produced
  * by the copy binary given the stream format.
  * */
@@ -468,7 +466,7 @@ verify_copy_out_frame_format(struct ia_css_pipe *pipe)
 	switch (pipe->stream->config.input_config.format) {
 	case IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY:
 	case IA_CSS_STREAM_FORMAT_YUV420_8:
-		for (i=0; i<array_length(yuv420_copy_formats) && !found; i++)
+		for (i=0; i<ARRAY_SIZE(yuv420_copy_formats) && !found; i++)
 			found = (out_fmt == yuv420_copy_formats[i]);
 		break;
 	case IA_CSS_STREAM_FORMAT_YUV420_10:
@@ -476,7 +474,7 @@ verify_copy_out_frame_format(struct ia_css_pipe *pipe)
 		found = (out_fmt == IA_CSS_FRAME_FORMAT_YUV420_16);
 		break;
 	case IA_CSS_STREAM_FORMAT_YUV422_8:
-		for (i=0; i<array_length(yuv422_copy_formats) && !found; i++)
+		for (i=0; i<ARRAY_SIZE(yuv422_copy_formats) && !found; i++)
 			found = (out_fmt == yuv422_copy_formats[i]);
 		break;
 	case IA_CSS_STREAM_FORMAT_YUV422_10:
-- 
2.7.4

[toc] | [next] | [standalone]


#1731466 — Re: [PATCH v2] drivers:staging/media:Use ARRAY_SIZE() for the size calculation of the array

FromDan Carpenter <dan.carpenter@oracle.com>
Date2017-09-13 10:50 +0200
SubjectRe: [PATCH v2] drivers:staging/media:Use ARRAY_SIZE() for the size calculation of the array
Message-ID<upbwS-50A-25@gated-at.bofh.it>
In reply to#1731454
On Wed, Sep 13, 2017 at 02:09:25PM +0530, Allen Pais wrote:
> Signed-off-by: Allen Pais <allen.lkml@gmail.com>

This is going through linux-media and maybe they won't insist on some
kind of commit message, but I know Greg does.

regards,
dan carpenter

[toc] | [prev] | [next] | [standalone]


#1731467 — Re: [PATCH v2] drivers:staging/media:Use ARRAY_SIZE() for the size calculation of the array

FromAllen <allen.lkml@gmail.com>
Date2017-09-13 11:00 +0200
SubjectRe: [PATCH v2] drivers:staging/media:Use ARRAY_SIZE() for the size calculation of the array
Message-ID<upbGx-542-1@gated-at.bofh.it>
In reply to#1731466
>
> This is going through linux-media and maybe they won't insist on some
> kind of commit message, but I know Greg does.

 Okay. I sent out a V3.

-- 
       - Allen

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web