From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from e31.co.us.ibm.com (e31.co.us.ibm.com [32.97.110.149]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 6C0861A05BD for ; Wed, 3 Dec 2014 13:04:18 +1100 (AEDT) Received: from /spool/local by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 2 Dec 2014 19:04:16 -0700 Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 0D0F819D8040 for ; Tue, 2 Dec 2014 18:52:55 -0700 (MST) Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id sB324v8E46661758 for ; Tue, 2 Dec 2014 19:04:57 -0700 Received: from d03av03.boulder.ibm.com (localhost [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id sB324Dgi029996 for ; Tue, 2 Dec 2014 19:04:14 -0700 From: Sukadev Bhattiprolu To: Arnaldo Carvalho de Melo , Jiri Olsa , Michael Ellerman , Paul Mackerras Subject: [PATCH v5 1/6] perf: provide sysfs_show for struct perf_pmu_events_attr Date: Tue, 2 Dec 2014 18:03:50 -0800 Message-Id: <1417572235-8197-2-git-send-email-sukadev@linux.vnet.ibm.com> In-Reply-To: <1417572235-8197-1-git-send-email-sukadev@linux.vnet.ibm.com> References: <1417572235-8197-1-git-send-email-sukadev@linux.vnet.ibm.com> Cc: peterz@infradead.org, linuxppc-dev@lists.ozlabs.org, dev@codyps.com, linux-kernel@vger.kernel.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Cody P Schafer (struct perf_pmu_events_attr) is defined in include/linux/perf_event.h, but the only "show" for it is in x86 and contains x86 specific stuff. Make a generic one for those of us who are just using the event_str. CC: Sukadev Bhattiprolu CC: Haren Myneni CC: Cody P Schafer Signed-off-by: Cody P Schafer --- include/linux/perf_event.h | 3 +++ kernel/events/core.c | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 486e84c..58f59bd 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -897,6 +897,9 @@ struct perf_pmu_events_attr { const char *event_str; }; +ssize_t perf_event_sysfs_show(struct device *dev, struct device_attribute *attr, + char *page); + #define PMU_EVENT_ATTR(_name, _var, _id, _show) \ static struct perf_pmu_events_attr _var = { \ .attr = __ATTR(_name, 0444, _show, NULL), \ diff --git a/kernel/events/core.c b/kernel/events/core.c index 3e19d3e..1e92387 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -8276,6 +8276,14 @@ void __init perf_event_init(void) != 1024); } +ssize_t perf_event_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); + return sprintf(page, "%s\n", pmu_attr->event_str); +} + static int __init perf_event_sysfs_init(void) { struct pmu *pmu; -- 1.8.3.1