From: Qi Liu <liuqi115@huawei.com>
To: <linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <will@kernel.org>
Cc: <linuxarm@huawei.com>,
Khuong Dinh <khuong@os.amperecomputing.com>,
"Mark Rutland" <mark.rutland@arm.com>
Subject: [PATCH v4 5/7] drivers/perf: Simplify EVENT ATTR macro in xgene_pmu.c
Date: Wed, 9 Jun 2021 14:41:01 +0800 [thread overview]
Message-ID: <1623220863-58233-6-git-send-email-liuqi115@huawei.com> (raw)
In-Reply-To: <1623220863-58233-1-git-send-email-liuqi115@huawei.com>
Use common macro PMU_EVENT_ATTR_ID to simplify XGENE_PMU_EVENT_ATTR
Cc: Khuong Dinh <khuong@os.amperecomputing.com>
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Qi Liu <liuqi115@huawei.com>
---
drivers/perf/xgene_pmu.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/perf/xgene_pmu.c b/drivers/perf/xgene_pmu.c
index 62d9425..2b6d476 100644
--- a/drivers/perf/xgene_pmu.c
+++ b/drivers/perf/xgene_pmu.c
@@ -278,17 +278,14 @@ static const struct attribute_group mc_pmu_v3_format_attr_group = {
static ssize_t xgene_pmu_event_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
- struct dev_ext_attribute *eattr;
+ struct perf_pmu_events_attr *pmu_attr =
+ container_of(attr, struct perf_pmu_events_attr, attr);
- eattr = container_of(attr, struct dev_ext_attribute, attr);
- return sysfs_emit(buf, "config=0x%lx\n", (unsigned long) eattr->var);
+ return sysfs_emit(buf, "config=0x%llx\n", pmu_attr->id);
}
#define XGENE_PMU_EVENT_ATTR(_name, _config) \
- (&((struct dev_ext_attribute[]) { \
- { .attr = __ATTR(_name, S_IRUGO, xgene_pmu_event_show, NULL), \
- .var = (void *) _config, } \
- })[0].attr.attr)
+ PMU_EVENT_ATTR_ID(_name, xgene_pmu_event_show, _config)
static struct attribute *l3c_pmu_events_attrs[] = {
XGENE_PMU_EVENT_ATTR(cycle-count, 0x00),
--
2.7.4
next prev parent reply other threads:[~2021-06-09 6:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-09 6:40 [PATCH v4 0/7] drivers/perf: Use general macro to simplify event attributes Qi Liu
2021-06-09 6:40 ` [PATCH v4 1/7] perf: Add EVENT_ATTR_ID " Qi Liu
2021-06-09 6:40 ` [PATCH v4 2/7] drivers/perf: Simplify EVENT ATTR macro in SMMU PMU driver Qi Liu
2021-06-09 6:40 ` [PATCH v4 3/7] drivers/perf: Simplify EVENT ATTR macro in qcom_l2_pmu.c Qi Liu
2021-06-09 6:41 ` [PATCH v4 4/7] drivers/perf: Simplify EVENT ATTR macro in qcom_l3_pmu.c Qi Liu
2021-06-09 6:41 ` Qi Liu [this message]
2021-06-09 6:41 ` [PATCH v4 6/7] drivers/perf: Simplify EVENT ATTR macro in fsl_imx8_ddr_perf.c Qi Liu
2021-06-09 6:41 ` [PATCH v4 7/7] arm64: perf: Simplify EVENT ATTR macro in perf_event.c Qi Liu
2021-06-11 16:15 ` [PATCH v4 0/7] drivers/perf: Use general macro to simplify event attributes Will Deacon
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=1623220863-58233-6-git-send-email-liuqi115@huawei.com \
--to=liuqi115@huawei.com \
--cc=khuong@os.amperecomputing.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=mark.rutland@arm.com \
--cc=will@kernel.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;
as well as URLs for NNTP newsgroup(s).