* [tip:perf/core] perf bpf: Add license(NAME) helper
@ 2018-05-16 18:03 tip-bot for Arnaldo Carvalho de Melo
0 siblings, 0 replies; only message in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2018-05-16 18:03 UTC (permalink / raw)
To: linux-tip-commits
Cc: dsahern, tglx, acme, hpa, jolsa, mingo, namhyung, adrian.hunter,
wangnan0, linux-kernel
Commit-ID: 1f477305ab462e2fd1fa8a4c4fa425ad752b3175
Gitweb: https://git.kernel.org/tip/1f477305ab462e2fd1fa8a4c4fa425ad752b3175
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Fri, 4 May 2018 15:18:31 -0300
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 15 May 2018 14:31:24 -0300
perf bpf: Add license(NAME) helper
To further reduce boilerplate.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-vst6hj335s0ebxzqltes3nsc@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/examples/bpf/5sec.c | 3 +--
tools/perf/examples/bpf/empty.c | 3 +--
tools/perf/include/bpf/bpf.h | 5 +++++
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/tools/perf/examples/bpf/5sec.c b/tools/perf/examples/bpf/5sec.c
index 3d1ed34aec8b..6fc3697ac749 100644
--- a/tools/perf/examples/bpf/5sec.c
+++ b/tools/perf/examples/bpf/5sec.c
@@ -40,5 +40,4 @@ int func(void *ctx, int err, long sec)
return sec == 5;
}
-char _license[] SEC("license") = "GPL";
-int _version SEC("version") = LINUX_VERSION_CODE;
+license(GPL);
diff --git a/tools/perf/examples/bpf/empty.c b/tools/perf/examples/bpf/empty.c
index 86f97763355d..3776d26db9e7 100644
--- a/tools/perf/examples/bpf/empty.c
+++ b/tools/perf/examples/bpf/empty.c
@@ -1,4 +1,3 @@
#include <bpf.h>
-char _license[] SEC("license") = "GPL";
-int _version SEC("version") = LINUX_VERSION_CODE;
+license(GPL);
diff --git a/tools/perf/include/bpf/bpf.h b/tools/perf/include/bpf/bpf.h
index 003afcab4e51..cdfd18b9c318 100644
--- a/tools/perf/include/bpf/bpf.h
+++ b/tools/perf/include/bpf/bpf.h
@@ -2,4 +2,9 @@
#ifndef _PERF_BPF_H
#define _PERF_BPF_H
#define SEC(NAME) __attribute__((section(NAME), used))
+
+#define license(name) \
+char _license[] SEC("license") = #name; \
+int _version SEC("version") = LINUX_VERSION_CODE;
+
#endif /* _PERF_BPF_H */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-05-16 18:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-16 18:03 [tip:perf/core] perf bpf: Add license(NAME) helper tip-bot for Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome