perf tests: Use ARRAY_SIZE() were applicable

We were using a homebrew equivalent, use the macro that is used
everywhere for this function.
Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-bp3wokafua1ecairau77jcy0@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 23b6339b
...@@ -19,8 +19,6 @@ static struct test_format { ...@@ -19,8 +19,6 @@ static struct test_format {
{ "krava23", "config2:28-29,38\n", }, { "krava23", "config2:28-29,38\n", },
}; };
#define TEST_FORMATS_CNT (sizeof(test_formats) / sizeof(struct test_format))
/* Simulated users input. */ /* Simulated users input. */
static struct parse_events_term test_terms[] = { static struct parse_events_term test_terms[] = {
{ {
...@@ -78,7 +76,6 @@ static struct parse_events_term test_terms[] = { ...@@ -78,7 +76,6 @@ static struct parse_events_term test_terms[] = {
.type_term = PARSE_EVENTS__TERM_TYPE_USER, .type_term = PARSE_EVENTS__TERM_TYPE_USER,
}, },
}; };
#define TERMS_CNT (sizeof(test_terms) / sizeof(struct parse_events_term))
/* /*
* Prepare format directory data, exported by kernel * Prepare format directory data, exported by kernel
...@@ -93,7 +90,7 @@ static char *test_format_dir_get(void) ...@@ -93,7 +90,7 @@ static char *test_format_dir_get(void)
if (!mkdtemp(dir)) if (!mkdtemp(dir))
return NULL; return NULL;
for (i = 0; i < TEST_FORMATS_CNT; i++) { for (i = 0; i < ARRAY_SIZE(test_formats); i++) {
static char name[PATH_MAX]; static char name[PATH_MAX];
struct test_format *format = &test_formats[i]; struct test_format *format = &test_formats[i];
FILE *file; FILE *file;
...@@ -130,14 +127,12 @@ static struct list_head *test_terms_list(void) ...@@ -130,14 +127,12 @@ static struct list_head *test_terms_list(void)
static LIST_HEAD(terms); static LIST_HEAD(terms);
unsigned int i; unsigned int i;
for (i = 0; i < TERMS_CNT; i++) for (i = 0; i < ARRAY_SIZE(test_terms); i++)
list_add_tail(&test_terms[i].list, &terms); list_add_tail(&test_terms[i].list, &terms);
return &terms; return &terms;
} }
#undef TERMS_CNT
int test__pmu(void) int test__pmu(void)
{ {
char *format = test_format_dir_get(); char *format = test_format_dir_get();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment