x86: perf: rapl: use unified perf_event_sysfs_show instead of special interface
Subsystems (2)
PATCH 1/1 x86: perf: 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 <[email protected]>
--- arch/x86/kernel/cpu/perf_event_intel_rapl.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_rapl.c +5 -18
@@ -109,11 +109,11 @@ static struct kobj_attribute format_attr_##_var = \#define RAPL_CNTR_WIDTH 32/* 32-bit rapl counters */ -#define RAPL_EVENT_ATTR_STR (_name, v, str) \ -static struct perf_pmu_events_attr event_attr_##v = { \ - .attr = __ATTR(_name, 0444, rapl_sysfs_show, NULL), \ - .id = 0, \ - .event_str = str, \ +#define RAPL_EVENT_ATTR_STR (_name, v, str) \ +static struct perf_pmu_events_attr event_attr_##v = { \ + .attr = __ATTR(_name, 0444, perf_event_sysfs_show, NULL), \ + .id = 0, \ + .event_str = str, \ };struct rapl_pmu {
@@ -405,19 +405,6 @@ static struct attribute_group rapl_pmu_attr_group = { .attrs = rapl_pmu_attrs, }; -static ssize_t rapl_sysfs_show (struct device *dev, -struct device_attribute *attr, -char *page) -{ -struct perf_pmu_events_attr *pmu_attr = \ - container_of(attr, struct perf_pmu_events_attr, attr); - -if (pmu_attr->event_str) -return sprintf (page,"%s" , pmu_attr->event_str); - -return 0 ; -} -RAPL_EVENT_ATTR_STR (energy-cores, rapl_cores,"event=0x01" );RAPL_EVENT_ATTR_STR (energy-pkg , rapl_pkg,"event=0x02" );RAPL_EVENT_ATTR_STR (energy-ram , rapl_ram,"event=0x03" );
Signature · 1 line
2.1.4
tip-bot for Huang Rui
merge bot[tip:perf/core] perf/x86/rapl: Use unified perf_event_sysfs_show instead of special interface
perf/x86/rapl: Use unified perf_event_sysfs_show instead of special interface
Commit-ID: d3bcd64bbc35076a80c56918c905ddb167d097d8 Gitweb: http://git.kernel.org/tip/d3bcd64bbc35076a80c56918c905ddb167d097d8 Author: Huang Rui <[email protected]> AuthorDate: Fri, 4 Dec 2015 18:07:41 +0800 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 6 Jan 2016 11:15:35 +0100
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 <[email protected]>
Signed-off-by Peter Zijlstra (Intel) <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Dasaratharaman Chandramouli<[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Robert Richter <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Vince Weaver <[email protected]>
Signed-off-by Ingo Molnar <[email protected]>
--- arch/x86/kernel/cpu/perf_event_intel_rapl.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_rapl.c +5 -18
@@ -109,11 +109,11 @@ static struct kobj_attribute format_attr_##_var = \#define RAPL_CNTR_WIDTH 32/* 32-bit rapl counters */ -#define RAPL_EVENT_ATTR_STR (_name, v, str) \ -static struct perf_pmu_events_attr event_attr_##v = { \ - .attr = __ATTR(_name, 0444, rapl_sysfs_show, NULL), \ - .id = 0, \ - .event_str = str, \ +#define RAPL_EVENT_ATTR_STR (_name, v, str) \ +static struct perf_pmu_events_attr event_attr_##v = { \ + .attr = __ATTR(_name, 0444, perf_event_sysfs_show, NULL), \ + .id = 0, \ + .event_str = str, \ };struct rapl_pmu {
@@ -405,19 +405,6 @@ static struct attribute_group rapl_pmu_attr_group = { .attrs = rapl_pmu_attrs, }; -static ssize_t rapl_sysfs_show (struct device *dev, -struct device_attribute *attr, -char *page) -{ -struct perf_pmu_events_attr *pmu_attr = \ - container_of(attr, struct perf_pmu_events_attr, attr); - -if (pmu_attr->event_str) -return sprintf (page,"%s" , pmu_attr->event_str); - -return 0 ; -} -RAPL_EVENT_ATTR_STR (energy-cores, rapl_cores,"event=0x01" );RAPL_EVENT_ATTR_STR (energy-pkg , rapl_pkg,"event=0x02" );RAPL_EVENT_ATTR_STR (energy-ram , rapl_ram,"event=0x03" );