diff options
author | Huang Rui <ray.huang@amd.com> | 2015-12-04 05:07:41 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-01-06 05:15:35 -0500 |
commit | d3bcd64bbc35076a80c56918c905ddb167d097d8 (patch) | |
tree | 892f5f501cbfdad3f6f2ba23cbba38bad64d724f | |
parent | 673d188ba5b1cef6f9a41a5a18b490b2831c3ea5 (diff) |
perf/x86/rapl: Use unified perf_event_sysfs_show instead of special interface
Actually, rapl_sysfs_show is a duplicate of perf_event_sysfs_show. We
prefer to use the unified interface.
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Dasaratharaman Chandramouli<dasaratharaman.chandramouli@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robert Richter <rric@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Link: http://lkml.kernel.org/r/1449223661-2437-1-git-send-email-ray.huang@amd.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel_rapl.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_intel_rapl.c b/arch/x86/kernel/cpu/perf_event_intel_rapl.c index fb5843dc7b83..24a351ad628d 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_rapl.c +++ b/arch/x86/kernel/cpu/perf_event_intel_rapl.c | |||
@@ -109,11 +109,11 @@ static struct kobj_attribute format_attr_##_var = \ | |||
109 | 109 | ||
110 | #define RAPL_CNTR_WIDTH 32 /* 32-bit rapl counters */ | 110 | #define RAPL_CNTR_WIDTH 32 /* 32-bit rapl counters */ |
111 | 111 | ||
112 | #define RAPL_EVENT_ATTR_STR(_name, v, str) \ | 112 | #define RAPL_EVENT_ATTR_STR(_name, v, str) \ |
113 | static struct perf_pmu_events_attr event_attr_##v = { \ | 113 | static struct perf_pmu_events_attr event_attr_##v = { \ |
114 | .attr = __ATTR(_name, 0444, rapl_sysfs_show, NULL), \ | 114 | .attr = __ATTR(_name, 0444, perf_event_sysfs_show, NULL), \ |
115 | .id = 0, \ | 115 | .id = 0, \ |
116 | .event_str = str, \ | 116 | .event_str = str, \ |
117 | }; | 117 | }; |
118 | 118 | ||
119 | struct rapl_pmu { | 119 | struct rapl_pmu { |
@@ -405,19 +405,6 @@ static struct attribute_group rapl_pmu_attr_group = { | |||
405 | .attrs = rapl_pmu_attrs, | 405 | .attrs = rapl_pmu_attrs, |
406 | }; | 406 | }; |
407 | 407 | ||
408 | static ssize_t rapl_sysfs_show(struct device *dev, | ||
409 | struct device_attribute *attr, | ||
410 | char *page) | ||
411 | { | ||
412 | struct perf_pmu_events_attr *pmu_attr = \ | ||
413 | container_of(attr, struct perf_pmu_events_attr, attr); | ||
414 | |||
415 | if (pmu_attr->event_str) | ||
416 | return sprintf(page, "%s", pmu_attr->event_str); | ||
417 | |||
418 | return 0; | ||
419 | } | ||
420 | |||
421 | RAPL_EVENT_ATTR_STR(energy-cores, rapl_cores, "event=0x01"); | 408 | RAPL_EVENT_ATTR_STR(energy-cores, rapl_cores, "event=0x01"); |
422 | RAPL_EVENT_ATTR_STR(energy-pkg , rapl_pkg, "event=0x02"); | 409 | RAPL_EVENT_ATTR_STR(energy-pkg , rapl_pkg, "event=0x02"); |
423 | RAPL_EVENT_ATTR_STR(energy-ram , rapl_ram, "event=0x03"); | 410 | RAPL_EVENT_ATTR_STR(energy-ram , rapl_ram, "event=0x03"); |