From: kan.liang@linux.intel.com
To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
linux-kernel@vger.kernel.org
Cc: ak@linux.intel.com, eranian@google.com, irogers@google.com,
Kan Liang <kan.liang@linux.intel.com>
Subject: [PATCH 1/9] perf: Add PMU_FORMAT_ATTR_SHOW
Date: Thu, 1 Dec 2022 11:56:56 -0800 [thread overview]
Message-ID: <20221201195704.2330866-1-kan.liang@linux.intel.com> (raw)
From: Kan Liang <kan.liang@linux.intel.com>
The macro PMU_FORMAT_ATTR facilitates the definition of both the "show"
function and "format_attr". But it only works for a non-hybrid platform.
For a hybrid platform, the name "format_attr_hybrid_" is used.
The definition of the "show" function can be shared between a non-hybrid
platform and a hybrid platform. Add a new macro PMU_FORMAT_ATTR_SHOW.
No functional change. The PMU_FORMAT_ATTR_SHOW will be used in the
following patch.
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
---
include/linux/perf_event.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 0031f7b4d9ab..ab251c737f97 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1661,7 +1661,7 @@ static struct perf_pmu_events_attr _var = { \
.id = _id, } \
})[0].attr.attr)
-#define PMU_FORMAT_ATTR(_name, _format) \
+#define PMU_FORMAT_ATTR_SHOW(_name, _format) \
static ssize_t \
_name##_show(struct device *dev, \
struct device_attribute *attr, \
@@ -1670,6 +1670,9 @@ _name##_show(struct device *dev, \
BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \
return sprintf(page, _format "\n"); \
} \
+
+#define PMU_FORMAT_ATTR(_name, _format) \
+ PMU_FORMAT_ATTR_SHOW(_name, _format) \
\
static struct device_attribute format_attr_##_name = __ATTR_RO(_name)
--
2.35.1
next reply other threads:[~2022-12-01 19:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-01 19:56 kan.liang [this message]
2022-12-01 19:56 ` [PATCH 2/9] perf/x86: Add Meteor Lake support kan.liang
2022-12-01 19:56 ` [PATCH 3/9] perf/x86: Support Retire Latency kan.liang
2022-12-01 19:56 ` [PATCH 4/9] x86/cpufeatures: Add Architectural PerfMon Extension bit kan.liang
2022-12-01 19:57 ` [PATCH 5/9] perf/x86/intel: Support Architectural PerfMon Extension leaf kan.liang
2022-12-01 19:57 ` [PATCH 6/9] perf/x86/cstate: Add Meteor Lake support kan.liang
2022-12-01 19:57 ` [PATCH 7/9] perf/x86/msr: " kan.liang
2022-12-01 19:57 ` [PATCH 8/9] perf report: Support Retire Latency kan.liang
2022-12-01 19:57 ` [PATCH 9/9] perf script: " kan.liang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221201195704.2330866-1-kan.liang@linux.intel.com \
--to=kan.liang@linux.intel.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=eranian@google.com \
--cc=irogers@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®