Web lists-archives.com

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




Hi Allen,

> -----Original Message-----
> From: platform-driver-x86-owner@xxxxxxxxxxxxxxx [mailto:platform-driver-
> x86-owner@xxxxxxxxxxxxxxx] On Behalf Of Allen Pais
> Sent: Wednesday, September 13, 2017 1:33 PM
> To: linux-kernel@xxxxxxxxxxxxxxx
> Cc: Chakravarty, Souvik K <souvik.k.chakravarty@xxxxxxxxx>; platform-
> driver-x86@xxxxxxxxxxxxxxx; Allen Pais <allen.lkml@xxxxxxxxx>
> Subject: [PATCH] drivers:platform/x86:Use ARRAY_SIZE() for the size
> calculation of the array.
> 
> Signed-off-by: Allen Pais <allen.lkml@xxxxxxxxx>
> ---
>  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