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


Groups > linux.kernel > #1731438 > unrolled thread

[PATCH] 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:10 +0200
Last post2017-09-13 10:50 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

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

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

FromAllen Pais <allen.lkml@gmail.com>
Date2017-09-13 10:10 +0200
Subject[PATCH] drivers:staging/media:Use ARRAY_SIZE() for the size calculation of the array
Message-ID<upaU9-4Kl-1@gated-at.bofh.it>
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))
 
 /* Verify whether the selected output format is can be produced
  * by the copy binary given the stream format.
-- 
2.7.4

[toc] | [next] | [standalone]


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

FromDan Carpenter <dan.carpenter@oracle.com>
Date2017-09-13 10:30 +0200
SubjectRe: [PATCH] drivers:staging/media:Use ARRAY_SIZE() for the size calculation of the array
Message-ID<upbdw-4Um-3@gated-at.bofh.it>
In reply to#1731438
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

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


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

FromAllen <allen.lkml@gmail.com>
Date2017-09-13 10:40 +0200
SubjectRe: [PATCH] drivers:staging/media:Use ARRAY_SIZE() for the size calculation of the array
Message-ID<upbnb-4Xu-3@gated-at.bofh.it>
In reply to#1731448
>>
>> -#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

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


#1731457 — Re: [PATCH] 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] drivers:staging/media:Use ARRAY_SIZE() for the size calculation of the array
Message-ID<upbwR-50A-3@gated-at.bofh.it>
In reply to#1731451
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web