From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 008BC1A0318 for ; Thu, 18 Sep 2014 04:52:24 +1000 (EST) Received: from /spool/local by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 17 Sep 2014 12:52:22 -0600 Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 2A1041FF003E for ; Wed, 17 Sep 2014 12:52:19 -0600 (MDT) Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s8HIqKLx49217610 for ; Wed, 17 Sep 2014 20:52:20 +0200 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 s8HIqIdl006159 for ; Wed, 17 Sep 2014 12:52:20 -0600 From: Sukadev Bhattiprolu To: Arnaldo Carvalho de Melo , ak@linux.intel.com, Jiri Olsa , peterz@infradead.org, eranian@google.com, Paul Mackerras Subject: [PATCH v3 03/10] perf: provide sysfs_show for struct perf_pmu_events_attr Date: Wed, 17 Sep 2014 11:51:56 -0700 Message-Id: <1410979923-7722-4-git-send-email-sukadev@linux.vnet.ibm.com> In-Reply-To: <1410979923-7722-1-git-send-email-sukadev@linux.vnet.ibm.com> References: <1410979923-7722-1-git-send-email-sukadev@linux.vnet.ibm.com> Cc: Michael Ellerman , linux-kernel@vger.kernel.org, dev@codyps.com, linuxppc-dev@lists.ozlabs.org, Anshuman Khandual 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 707617a..cef4a56 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -882,6 +882,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 f9c1ed0..cf1a423 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -8100,6 +8100,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.7.9.5