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


Groups > linux.kernel > #1725357 > unrolled thread

[PATCH 1/6] perf tools: Use ARRAY_SIZE macro

Started byThomas Meyer <thomas@m3y3r.de>
First post2017-09-01 23:40 +0200
Last post2017-09-01 23:40 +0200
Articles 3 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/6] perf tools: Use ARRAY_SIZE macro Thomas Meyer <thomas@m3y3r.de> - 2017-09-01 23:40 +0200
    [PATCH 6/6] x86/platform/intel-mid: Use ARRAY_SIZE macro Thomas Meyer <thomas@m3y3r.de> - 2017-09-01 23:40 +0200
    [PATCH 3/6] ia64: Use ARRAY_SIZE macro Thomas Meyer <thomas@m3y3r.de> - 2017-09-01 23:40 +0200

#1725357 — [PATCH 1/6] perf tools: Use ARRAY_SIZE macro

FromThomas Meyer <thomas@m3y3r.de>
Date2017-09-01 23:40 +0200
Subject[PATCH 1/6] perf tools: Use ARRAY_SIZE macro
Message-ID<ul1Pr-2fo-9@gated-at.bofh.it>
Found by a coccinelle run with:
make coccicheck MODE=patch COCCI=scripts/coccinelle/misc/array_size.cocci

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
 tools/perf/tests/bpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c
index 5876da126b58..4e7b5b63ac28 100644
--- a/tools/perf/tests/bpf.c
+++ b/tools/perf/tests/bpf.c
@@ -309,7 +309,7 @@ static int check_env(void)
 	}
 
 	err = bpf_load_program(BPF_PROG_TYPE_KPROBE, insns,
-			       sizeof(insns) / sizeof(insns[0]),
+			       ARRAY_SIZE(insns),
 			       license, kver_int, NULL, 0);
 	if (err < 0) {
 		pr_err("Missing basic BPF support, skip this test: %s\n",
-- 
2.11.0

[toc] | [next] | [standalone]


#1725359 — [PATCH 6/6] x86/platform/intel-mid: Use ARRAY_SIZE macro

FromThomas Meyer <thomas@m3y3r.de>
Date2017-09-01 23:40 +0200
Subject[PATCH 6/6] x86/platform/intel-mid: Use ARRAY_SIZE macro
Message-ID<ul1Ps-2fo-23@gated-at.bofh.it>
In reply to#1725357
Found by a coccinelle run with:
make coccicheck MODE=patch COCCI=scripts/coccinelle/misc/array_size.cocci

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
 arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c b/arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c
index 74283875c7e8..8e2fbd35a9e6 100644
--- a/arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c
+++ b/arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c
@@ -64,7 +64,7 @@ static int __init pb_keys_init(void)
 	struct gpio_keys_button *gb = gpio_button;
 	int i, num, good = 0;
 
-	num = sizeof(gpio_button) / sizeof(struct gpio_keys_button);
+	num = ARRAY_SIZE(gpio_button);
 	for (i = 0; i < num; i++) {
 		gb[i].gpio = get_gpio_by_name(gb[i].desc);
 		pr_debug("info[%2d]: name = %s, gpio = %d\n", i, gb[i].desc,
-- 
2.11.0

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


#1725362 — [PATCH 3/6] ia64: Use ARRAY_SIZE macro

FromThomas Meyer <thomas@m3y3r.de>
Date2017-09-01 23:40 +0200
Subject[PATCH 3/6] ia64: Use ARRAY_SIZE macro
Message-ID<ul1Ps-2fo-31@gated-at.bofh.it>
In reply to#1725357
Found by a coccinelle run with:
make coccicheck MODE=patch COCCI=scripts/coccinelle/misc/array_size.cocci

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
 arch/ia64/kernel/perfmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 09f86ebfcc7b..f1be357a4288 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -4653,7 +4653,7 @@ static pfm_cmd_desc_t pfm_cmd_tab[]={
 /* 32 */PFM_CMD(pfm_write_ibrs, PFM_CMD_PCLRWS, PFM_CMD_ARG_MANY, pfarg_dbreg_t, NULL),
 /* 33 */PFM_CMD(pfm_write_dbrs, PFM_CMD_PCLRWS, PFM_CMD_ARG_MANY, pfarg_dbreg_t, NULL)
 };
-#define PFM_CMD_COUNT	(sizeof(pfm_cmd_tab)/sizeof(pfm_cmd_desc_t))
+#define PFM_CMD_COUNT	ARRAY_SIZE(pfm_cmd_tab)
 
 static int
 pfm_check_task_state(pfm_context_t *ctx, int cmd, unsigned long flags)
-- 
2.11.0

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web