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


Groups > linux.kernel > #1731532 > unrolled thread

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

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

Back to article view | Back to linux.kernel


Contents

  [PATCH v3] drivers:platform/x86:Use ARRAY_SIZE() for the size calculation of the array. Allen Pais <allen.lkml@gmail.com> - 2017-09-13 13:00 +0200
    Re: [PATCH v3] drivers:platform/x86:Use ARRAY_SIZE() for the size  calculation of the array. Darren Hart <dvhart@infradead.org> - 2017-09-23 00:00 +0200

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

FromAllen Pais <allen.lkml@gmail.com>
Date2017-09-13 13:00 +0200
Subject[PATCH v3] drivers:platform/x86:Use ARRAY_SIZE() for the size calculation of the array.
Message-ID<updyF-6jl-1@gated-at.bofh.it>
 Use ARRAY_SIZE() macro instead of TELEM_EVT_LEN().

v3: Replace TELEM_EVT_LEN() with ARRAY_SIZE().

Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
 drivers/platform/x86/intel_telemetry_debugfs.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/platform/x86/intel_telemetry_debugfs.c b/drivers/platform/x86/intel_telemetry_debugfs.c
index d4fc42b..74e518d 100644
--- a/drivers/platform/x86/intel_telemetry_debugfs.c
+++ b/drivers/platform/x86/intel_telemetry_debugfs.c
@@ -76,8 +76,6 @@
 #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_DEBUGFS_CPU(model, data) \
 	{ X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned long)&data}
 
@@ -304,13 +302,13 @@ static struct telemetry_debugfs_conf telem_apl_debugfs_conf = {
 	.ioss_d0ix_data = telem_apl_ioss_d0ix_data,
 	.ioss_pg_data = telem_apl_ioss_pg_data,
 
-	.pss_idle_evts = TELEM_EVT_LEN(telem_apl_pss_idle_data),
-	.pcs_idle_blkd_evts = TELEM_EVT_LEN(telem_apl_pcs_idle_blkd_data),
-	.pcs_s0ix_blkd_evts = TELEM_EVT_LEN(telem_apl_pcs_s0ix_blkd_data),
-	.pss_ltr_evts = TELEM_EVT_LEN(telem_apl_pss_ltr_data),
-	.pss_wakeup_evts = TELEM_EVT_LEN(telem_apl_pss_wakeup),
-	.ioss_d0ix_evts = TELEM_EVT_LEN(telem_apl_ioss_d0ix_data),
-	.ioss_pg_evts = TELEM_EVT_LEN(telem_apl_ioss_pg_data),
+	.pss_idle_evts = ARRAY_SIZE(telem_apl_pss_idle_data),
+	.pcs_idle_blkd_evts = ARRAY_SIZE(telem_apl_pcs_idle_blkd_data),
+	.pcs_s0ix_blkd_evts = ARRAY_SIZE(telem_apl_pcs_s0ix_blkd_data),
+	.pss_ltr_evts = ARRAY_SIZE(telem_apl_pss_ltr_data),
+	.pss_wakeup_evts = ARRAY_SIZE(telem_apl_pss_wakeup),
+	.ioss_d0ix_evts = ARRAY_SIZE(telem_apl_ioss_d0ix_data),
+	.ioss_pg_evts = ARRAY_SIZE(telem_apl_ioss_pg_data),
 
 	.pstates_id = TELEM_APL_PSS_PSTATES_ID,
 	.pss_idle_id = TELEM_APL_PSS_IDLE_ID,
-- 
2.7.4

[toc] | [next] | [standalone]


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

FromDarren Hart <dvhart@infradead.org>
Date2017-09-23 00:00 +0200
SubjectRe: [PATCH v3] drivers:platform/x86:Use ARRAY_SIZE() for the size calculation of the array.
Message-ID<usE9k-2Uu-15@gated-at.bofh.it>
In reply to#1731532
On Wed, Sep 13, 2017 at 04:29:31PM +0530, Allen Pais wrote:
>  Use ARRAY_SIZE() macro instead of TELEM_EVT_LEN().
> 
> v3: Replace TELEM_EVT_LEN() with ARRAY_SIZE().
> 
> Signed-off-by: Allen Pais <allen.lkml@gmail.com>

Thanks Allen, queued for testing with minor changelog changes.

> ---

Note: in the future, the changelog (Since v1:, Since v2: goes here, below the
--- line. Also, don't delete the previous changes. See:

Documentation/process/submitting-patches.rst

14) The canonical patch format
-- 
Darren Hart
VMware Open Source Technology Center

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web