* [PATCH 1/2] perf: Fix errors reported by checkpatch.pl scripts
@ 2016-07-28 2:05 Rui Teng
2016-07-28 2:05 ` [PATCH 2/2] perf: Use __weak definition from <linux/compiler.h> Rui Teng
0 siblings, 1 reply; 3+ messages in thread
From: Rui Teng @ 2016-07-28 2:05 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, alexander.shishkin, peterz, Arnaldo Carvalho de Melo, Rui Teng
Clear all the errors and also some warnings reported by checkpatch.pl scripts
for file tools/perf/util/header.c
Signed-off-by: Rui Teng <rui.teng@linux.vnet.ibm.com>
---
| 60 ++++++++++++++++++++++++++----------------------
1 file changed, 33 insertions(+), 27 deletions(-)
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 8f0db40..8d76d55 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -256,7 +256,8 @@ static int __write_cpudesc(int fd, const char *cpuinfo_proc)
while (*q && isspace(*q))
q++;
if (q != (p+1))
- while ((*r++ = *q++));
+ while ((*r++ = *q++))
+ ;
}
p++;
}
@@ -278,6 +279,7 @@ static int write_cpudesc(int fd, struct perf_header *h __maybe_unused,
for (i = 0; i < ARRAY_SIZE(cpuinfo_procs); i++) {
int ret;
+
ret = __write_cpudesc(fd, cpuinfo_procs[i]);
if (ret >= 0)
return ret;
@@ -479,7 +481,7 @@ try_threads:
}
ret = 0;
done:
- if(fp)
+ if (fp)
fclose(fp);
free(buf);
return ret;
@@ -1036,24 +1038,28 @@ static int write_cache(int fd, struct perf_header *h __maybe_unused,
struct cpu_cache_level *c = &caches[i];
#define _W(v) \
+ do { \
ret = do_write(fd, &c->v, sizeof(u32)); \
if (ret < 0) \
- goto out;
+ goto out; \
+ } while (0)
- _W(level)
- _W(line_size)
- _W(sets)
- _W(ways)
+ _W(level);
+ _W(line_size);
+ _W(sets);
+ _W(ways);
#undef _W
#define _W(v) \
+ do { \
ret = do_write_string(fd, (const char *) c->v); \
if (ret < 0) \
- goto out;
+ goto out; \
+ } while (0)
- _W(type)
- _W(size)
- _W(map)
+ _W(type);
+ _W(size);
+ _W(map);
#undef _W
}
@@ -1312,8 +1318,7 @@ static void print_numa_topology(struct perf_header *ph, int fd __maybe_unused,
for (i = 0; i < ph->env.nr_numa_nodes; i++) {
n = &ph->env.numa_nodes[i];
- fprintf(fp, "# node%u meminfo : total = %"PRIu64" kB,"
- " free = %"PRIu64" kB\n",
+ fprintf(fp, "# node%u meminfo : total = %"PRIu64" kB, free = %"PRIu64" kB\n",
n->node, n->mem_total, n->mem_free);
fprintf(fp, "# node%u cpu list : ", n->node);
@@ -1570,6 +1575,7 @@ static int process_tracing_data(struct perf_file_section *section __maybe_unused
int fd, void *data)
{
ssize_t ret = trace_report(fd, data, false);
+
return ret < 0 ? -1 : 0;
}
@@ -1862,8 +1868,7 @@ static int process_cpu_topology(struct perf_file_section *section,
nr = bswap_32(nr);
if (nr > (u32)cpu_nr) {
- pr_debug("socket_id number is too big."
- "You may need to upgrade the perf tool.\n");
+ pr_debug("socket_id number is too big. You may need to upgrade the perf tool.\n");
goto free_cpu;
}
@@ -2226,8 +2231,8 @@ static int perf_file_section__fprintf_info(struct perf_file_section *section,
struct header_print_data *hd = data;
if (lseek(fd, section->offset, SEEK_SET) == (off_t)-1) {
- pr_debug("Failed to lseek to %" PRIu64 " offset for feature "
- "%d, continuing...\n", section->offset, feat);
+ pr_debug("Failed to lseek to %" PRIu64 " offset for feature %d, continuing...\n",
+ section->offset, feat);
return 0;
}
if (feat >= HEADER_LAST_FEATURE) {
@@ -2251,6 +2256,7 @@ int perf_header__fprintf_info(struct perf_session *session, FILE *fp, bool full)
struct header_print_data hd;
struct perf_header *header = &session->header;
int fd = perf_data_file__fd(session->file);
+
hd.fp = fp;
hd.full = full;
@@ -2668,8 +2674,8 @@ static int perf_file_section__process(struct perf_file_section *section,
int feat, int fd, void *data)
{
if (lseek(fd, section->offset, SEEK_SET) == (off_t)-1) {
- pr_debug("Failed to lseek to %" PRIu64 " offset for feature "
- "%d, continuing...\n", section->offset, feat);
+ pr_debug("Failed to lseek to %" PRIu64 " offset for feature %d, continuing...\n",
+ section->offset, feat);
return 0;
}
@@ -2751,16 +2757,16 @@ static int read_attr(int fd, struct perf_header *ph,
/* assume ABI0 */
sz = PERF_ATTR_SIZE_VER0;
} else if (sz > our_sz) {
- pr_debug("file uses a more recent and unsupported ABI"
- " (%zu bytes extra)\n", sz - our_sz);
+ pr_debug("file uses a more recent and unsupported ABI (%zu bytes extra)\n",
+ sz - our_sz);
return -1;
}
/* what we have not yet read and that we know about */
left = sz - PERF_ATTR_SIZE_VER0;
if (left) {
void *ptr = attr;
- ptr += PERF_ATTR_SIZE_VER0;
+ ptr += PERF_ATTR_SIZE_VER0;
ret = readn(fd, ptr, left);
}
/* read perf_file_section, ids are read in caller */
@@ -3002,7 +3008,7 @@ perf_event__synthesize_event_update_scale(struct perf_tool *tool,
ev_data = (struct event_update_event_scale *) ev->data;
ev_data->scale = evsel->scale;
- err = process(tool, (union perf_event*) ev, NULL, NULL);
+ err = process(tool, (union perf_event *) ev, NULL, NULL);
free(ev);
return err;
}
@@ -3021,7 +3027,7 @@ perf_event__synthesize_event_update_name(struct perf_tool *tool,
return -ENOMEM;
strncpy(ev->data, evsel->name, len);
- err = process(tool, (union perf_event*) ev, NULL, NULL);
+ err = process(tool, (union perf_event *) ev, NULL, NULL);
free(ev);
return err;
}
@@ -3052,7 +3058,7 @@ perf_event__synthesize_event_update_cpus(struct perf_tool *tool,
evsel->own_cpus,
type, max);
- err = process(tool, (union perf_event*) ev, NULL, NULL);
+ err = process(tool, (union perf_event *) ev, NULL, NULL);
free(ev);
return err;
}
@@ -3146,9 +3152,8 @@ int perf_event__process_attr(struct perf_tool *tool __maybe_unused,
if (perf_evsel__alloc_id(evsel, 1, n_ids))
return -ENOMEM;
- for (i = 0; i < n_ids; i++) {
+ for (i = 0; i < n_ids; i++)
perf_evlist__id_add(evlist, evsel, 0, i, event->attr.id[i]);
- }
symbol_conf.nr_events = evlist->nr_entries;
@@ -3269,6 +3274,7 @@ int perf_event__process_tracing_data(struct perf_tool *tool __maybe_unused,
}
if (session->repipe) {
int retw = write(STDOUT_FILENO, buf, padding);
+
if (retw <= 0 || retw != padding) {
pr_err("%s: repiping tracing data padding", __func__);
return -1;
--
2.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 2/2] perf: Use __weak definition from <linux/compiler.h>
2016-07-28 2:05 [PATCH 1/2] perf: Fix errors reported by checkpatch.pl scripts Rui Teng
@ 2016-07-28 2:05 ` Rui Teng
2016-08-24 9:24 ` [tip:perf/core] perf tools: Use __weak definition from linux/compiler.h tip-bot for Rui Teng
0 siblings, 1 reply; 3+ messages in thread
From: Rui Teng @ 2016-07-28 2:05 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, alexander.shishkin, peterz, Arnaldo Carvalho de Melo, Rui Teng
Replace __attribute__((weak)) to __weak definition
Signed-off-by: Rui Teng <rui.teng@linux.vnet.ibm.com>
---
| 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 8d76d55..576addd 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -830,8 +830,7 @@ static int write_group_desc(int fd, struct perf_header *h __maybe_unused,
* default get_cpuid(): nothing gets recorded
* actual implementation must be in arch/$(ARCH)/util/header.c
*/
-int __attribute__ ((weak)) get_cpuid(char *buffer __maybe_unused,
- size_t sz __maybe_unused)
+int __weak get_cpuid(char *buffer __maybe_unused, size_t sz __maybe_unused)
{
return -1;
}
--
2.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread* [tip:perf/core] perf tools: Use __weak definition from linux/compiler.h
2016-07-28 2:05 ` [PATCH 2/2] perf: Use __weak definition from <linux/compiler.h> Rui Teng
@ 2016-08-24 9:24 ` tip-bot for Rui Teng
0 siblings, 0 replies; 3+ messages in thread
From: tip-bot for Rui Teng @ 2016-08-24 9:24 UTC (permalink / raw)
To: linux-tip-commits
Cc: mingo, hpa, acme, rui.teng, linux-kernel, tglx,
alexander.shishkin, peterz
Commit-ID: 11d8f870c8eb8dd41ade688fbad6946ad69243fe
Gitweb: http://git.kernel.org/tip/11d8f870c8eb8dd41ade688fbad6946ad69243fe
Author: Rui Teng <rui.teng@linux.vnet.ibm.com>
AuthorDate: Thu, 28 Jul 2016 10:05:57 +0800
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300
perf tools: Use __weak definition from linux/compiler.h
Replace __attribute__((weak)) with __weak definition
Signed-off-by: Rui Teng <rui.teng@linux.vnet.ibm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1469671557-2256-2-git-send-email-rui.teng@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
| 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 8f0db40..85dd0db 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -828,8 +828,7 @@ static int write_group_desc(int fd, struct perf_header *h __maybe_unused,
* default get_cpuid(): nothing gets recorded
* actual implementation must be in arch/$(ARCH)/util/header.c
*/
-int __attribute__ ((weak)) get_cpuid(char *buffer __maybe_unused,
- size_t sz __maybe_unused)
+int __weak get_cpuid(char *buffer __maybe_unused, size_t sz __maybe_unused)
{
return -1;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-24 9:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-28 2:05 [PATCH 1/2] perf: Fix errors reported by checkpatch.pl scripts Rui Teng
2016-07-28 2:05 ` [PATCH 2/2] perf: Use __weak definition from <linux/compiler.h> Rui Teng
2016-08-24 9:24 ` [tip:perf/core] perf tools: Use __weak definition from linux/compiler.h tip-bot for Rui Teng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®