All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drivers:platform/x86:Use ARRAY_SIZE() for the size calculation of the array.
@ 2017-09-13  8:54 Allen Pais
  2017-09-13 10:02 ` Bjørn Mork
  0 siblings, 1 reply; 5+ messages in thread
From: Allen Pais @ 2017-09-13  8:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: souvik.k.chakravarty, platform-driver-x86, Allen Pais

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..6b63b3d 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] drivers:platform/x86:Use ARRAY_SIZE() for the size calculation of the array.
  2017-09-13  8:54 [PATCH v2] drivers:platform/x86:Use ARRAY_SIZE() for the size calculation of the array Allen Pais
@ 2017-09-13 10:02 ` Bjørn Mork
  2017-09-13 10:17     ` Chakravarty, Souvik K
  0 siblings, 1 reply; 5+ messages in thread
From: Bjørn Mork @ 2017-09-13 10:02 UTC (permalink / raw)
  To: Allen Pais; +Cc: linux-kernel, souvik.k.chakravarty, platform-driver-x86

Allen Pais <allen.lkml@gmail.com> writes:

> 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..6b63b3d 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}

What's the point?  Why not simply replace all instances of TELEM_EVT_LEN
with ARRAY_SIZE?



Bjørn

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v2] drivers:platform/x86:Use ARRAY_SIZE() for the size calculation of the array.
  2017-09-13 10:02 ` Bjørn Mork
@ 2017-09-13 10:17     ` Chakravarty, Souvik K
  0 siblings, 0 replies; 5+ messages in thread
From: Chakravarty, Souvik K @ 2017-09-13 10:17 UTC (permalink / raw)
  To: Bjørn Mork, Allen Pais; +Cc: linux-kernel, platform-driver-x86



> -----Original Message-----
> From: platform-driver-x86-owner@vger.kernel.org [mailto:platform-driver-
> x86-owner@vger.kernel.org] On Behalf Of Bjørn Mork
> Sent: Wednesday, September 13, 2017 3:32 PM
> To: Allen Pais <allen.lkml@gmail.com>
> Cc: linux-kernel@vger.kernel.org; Chakravarty, Souvik K
> <souvik.k.chakravarty@intel.com>; platform-driver-x86@vger.kernel.org
> Subject: Re: [PATCH v2] drivers:platform/x86:Use ARRAY_SIZE() for the size
> calculation of the array.
> 
> Allen Pais <allen.lkml@gmail.com> writes:
> 
> > 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..6b63b3d 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}
> 
> What's the point?  Why not simply replace all instances of TELEM_EVT_LEN
> with ARRAY_SIZE?
I was about to say this too, although I should have probably said this in the first spin itself.

> 
> 
> 
> Bjørn

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v2] drivers:platform/x86:Use ARRAY_SIZE() for the size calculation of the array.
@ 2017-09-13 10:17     ` Chakravarty, Souvik K
  0 siblings, 0 replies; 5+ messages in thread
From: Chakravarty, Souvik K @ 2017-09-13 10:17 UTC (permalink / raw)
  To: Bjørn Mork, Allen Pais; +Cc: linux-kernel, platform-driver-x86



> -----Original Message-----
> From: platform-driver-x86-owner@vger.kernel.org [mailto:platform-driver-
> x86-owner@vger.kernel.org] On Behalf Of Bjørn Mork
> Sent: Wednesday, September 13, 2017 3:32 PM
> To: Allen Pais <allen.lkml@gmail.com>
> Cc: linux-kernel@vger.kernel.org; Chakravarty, Souvik K
> <souvik.k.chakravarty@intel.com>; platform-driver-x86@vger.kernel.org
> Subject: Re: [PATCH v2] drivers:platform/x86:Use ARRAY_SIZE() for the size
> calculation of the array.
> 
> Allen Pais <allen.lkml@gmail.com> writes:
> 
> > 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..6b63b3d 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}
> 
> What's the point?  Why not simply replace all instances of TELEM_EVT_LEN
> with ARRAY_SIZE?
I was about to say this too, although I should have probably said this in the first spin itself.

> 
> 
> 
> Bjørn

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] drivers:platform/x86:Use ARRAY_SIZE() for the size calculation of the array.
  2017-09-13 10:17     ` Chakravarty, Souvik K
  (?)
@ 2017-09-13 10:52     ` Allen
  -1 siblings, 0 replies; 5+ messages in thread
From: Allen @ 2017-09-13 10:52 UTC (permalink / raw)
  To: Chakravarty, Souvik K; +Cc: Bjørn Mork, linux-kernel, platform-driver-x86

>>
>> What's the point?  Why not simply replace all instances of TELEM_EVT_LEN
>> with ARRAY_SIZE?
> I was about to say this too, although I should have probably said this in the first spin itself.
>

 I'll have it done and send out v3.

- Allen

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-09-13 10:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-13  8:54 [PATCH v2] drivers:platform/x86:Use ARRAY_SIZE() for the size calculation of the array Allen Pais
2017-09-13 10:02 ` Bjørn Mork
2017-09-13 10:17   ` Chakravarty, Souvik K
2017-09-13 10:17     ` Chakravarty, Souvik K
2017-09-13 10:52     ` Allen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.