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


Groups > linux.kernel > #1731442 > unrolled thread

[PATCH] drivers:platform/x86: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 11:00 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] drivers:platform/x86: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:platform/x86:Use ARRAY_SIZE() for the size  calculation of the array. "Chakravarty, Souvik K" <souvik.k.chakravarty@intel.com> - 2017-09-13 10:50 +0200
      Re: [PATCH] drivers:platform/x86:Use ARRAY_SIZE() for the size  calculation of the array. Allen <allen.lkml@gmail.com> - 2017-09-13 11:00 +0200

#1731442 — [PATCH] drivers:platform/x86: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:platform/x86:Use ARRAY_SIZE() for the size calculation of the array.
Message-ID<upaUa-4Kl-17@gated-at.bofh.it>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
 drivers/platform/x86/intel_telemetry_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/intel_telemetry_debugfs.c b/drivers/platform/x86/intel_telemetry_debugfs.c
index d4fc42b..3ccc7ac 100644
--- a/drivers/platform/x86/intel_telemetry_debugfs.c
+++ b/drivers/platform/x86/intel_telemetry_debugfs.c
@@ -76,7 +76,7 @@
 #define TELEM_IOSS_DX_D0IX_EVTS		25
 #define TELEM_IOSS_PG_EVTS		30
 
-#define TELEM_EVT_LEN(x) (sizeof(x)/sizeof((x)[0]))
+#define TELEM_EVT_LEN(x) (ARRAY_SIZE(x))
 
 #define TELEM_DEBUGFS_CPU(model, data) \
 	{ X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned long)&data}
-- 
2.7.4

[toc] | [next] | [standalone]


#1731465 — RE: [PATCH] drivers:platform/x86:Use ARRAY_SIZE() for the size calculation of the array.

From"Chakravarty, Souvik K" <souvik.k.chakravarty@intel.com>
Date2017-09-13 10:50 +0200
SubjectRE: [PATCH] drivers:platform/x86:Use ARRAY_SIZE() for the size calculation of the array.
Message-ID<upbwS-50A-19@gated-at.bofh.it>
In reply to#1731442
Hi Allen,

> -----Original Message-----
> From: platform-driver-x86-owner@vger.kernel.org [mailto:platform-driver-
> x86-owner@vger.kernel.org] On Behalf Of Allen Pais
> Sent: Wednesday, September 13, 2017 1:33 PM
> To: linux-kernel@vger.kernel.org
> Cc: Chakravarty, Souvik K <souvik.k.chakravarty@intel.com>; platform-
> driver-x86@vger.kernel.org; Allen Pais <allen.lkml@gmail.com>
> Subject: [PATCH] drivers:platform/x86:Use ARRAY_SIZE() for the size
> calculation of the array.
> 
> Signed-off-by: Allen Pais <allen.lkml@gmail.com>
> ---
>  drivers/platform/x86/intel_telemetry_debugfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/intel_telemetry_debugfs.c
> b/drivers/platform/x86/intel_telemetry_debugfs.c
> index d4fc42b..3ccc7ac 100644
> --- a/drivers/platform/x86/intel_telemetry_debugfs.c
> +++ b/drivers/platform/x86/intel_telemetry_debugfs.c
> @@ -76,7 +76,7 @@
>  #define TELEM_IOSS_DX_D0IX_EVTS		25
>  #define TELEM_IOSS_PG_EVTS		30
> 
> -#define TELEM_EVT_LEN(x) (sizeof(x)/sizeof((x)[0]))
> +#define TELEM_EVT_LEN(x) (ARRAY_SIZE(x))
The outer parenthesis seems redundant to me.

> 
>  #define TELEM_DEBUGFS_CPU(model, data) \
>  	{ X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned
> long)&data}
> --
> 2.7.4

BR,
Souvik

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


#1731471 — Re: [PATCH] drivers:platform/x86:Use ARRAY_SIZE() for the size calculation of the array.

FromAllen <allen.lkml@gmail.com>
Date2017-09-13 11:00 +0200
SubjectRe: [PATCH] drivers:platform/x86:Use ARRAY_SIZE() for the size calculation of the array.
Message-ID<upbGx-542-15@gated-at.bofh.it>
In reply to#1731465
>>  #define TELEM_IOSS_PG_EVTS           30
>>
>> -#define TELEM_EVT_LEN(x) (sizeof(x)/sizeof((x)[0]))
>> +#define TELEM_EVT_LEN(x) (ARRAY_SIZE(x))
> The outer parenthesis seems redundant to me.
>

Will send out a v2. Thanks.

       - Allen

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web