lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1621322628-9945-5-git-send-email-liuqi115@huawei.com>
Date:   Tue, 18 May 2021 15:23:43 +0800
From:   Qi Liu <liuqi115@...wei.com>
To:     <will@...nel.org>, <mark.rutland@....com>, <john.garry@...wei.com>
CC:     <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>, <linuxarm@...wei.com>,
        <zhangshaokun@...ilicon.com>
Subject: [PATCH 4/9] drivers/perf: Remove redundant macro and functions in qcom_l2_pmu.c

Remove L2CACHE_EVENT_ATTR and l2cache_pmu_event_show(), as there is
a general function for this.

Signed-off-by: Qi Liu <liuqi115@...wei.com>
---
 drivers/perf/qcom_l2_pmu.c | 37 +++++++++++--------------------------
 1 file changed, 11 insertions(+), 26 deletions(-)

diff --git a/drivers/perf/qcom_l2_pmu.c b/drivers/perf/qcom_l2_pmu.c
index fc54a80..aa3ae21 100644
--- a/drivers/perf/qcom_l2_pmu.c
+++ b/drivers/perf/qcom_l2_pmu.c
@@ -670,33 +670,18 @@ static const struct attribute_group l2_cache_pmu_format_group = {
 	.attrs = l2_cache_pmu_formats,
 };
 
-static ssize_t l2cache_pmu_event_show(struct device *dev,
-				      struct device_attribute *attr, char *page)
-{
-	struct perf_pmu_events_attr *pmu_attr;
-
-	pmu_attr = container_of(attr, struct perf_pmu_events_attr, attr);
-	return sysfs_emit(page, "event=0x%02llx\n", pmu_attr->id);
-}
-
-#define L2CACHE_EVENT_ATTR(_name, _id)					     \
-	(&((struct perf_pmu_events_attr[]) {				     \
-		{ .attr = __ATTR(_name, 0444, l2cache_pmu_event_show, NULL), \
-		  .id = _id, }						     \
-	})[0].attr.attr)
-
 static struct attribute *l2_cache_pmu_events[] = {
-	L2CACHE_EVENT_ATTR(cycles, L2_EVENT_CYCLES),
-	L2CACHE_EVENT_ATTR(dcache-ops, L2_EVENT_DCACHE_OPS),
-	L2CACHE_EVENT_ATTR(icache-ops, L2_EVENT_ICACHE_OPS),
-	L2CACHE_EVENT_ATTR(tlbi, L2_EVENT_TLBI),
-	L2CACHE_EVENT_ATTR(barriers, L2_EVENT_BARRIERS),
-	L2CACHE_EVENT_ATTR(total-reads, L2_EVENT_TOTAL_READS),
-	L2CACHE_EVENT_ATTR(total-writes, L2_EVENT_TOTAL_WRITES),
-	L2CACHE_EVENT_ATTR(total-requests, L2_EVENT_TOTAL_REQUESTS),
-	L2CACHE_EVENT_ATTR(ldrex, L2_EVENT_LDREX),
-	L2CACHE_EVENT_ATTR(strex, L2_EVENT_STREX),
-	L2CACHE_EVENT_ATTR(clrex, L2_EVENT_CLREX),
+	PMU_EVENT_ATTR_ID(cycles, L2_EVENT_CYCLES),
+	PMU_EVENT_ATTR_ID(dcache-ops, L2_EVENT_DCACHE_OPS),
+	PMU_EVENT_ATTR_ID(icache-ops, L2_EVENT_ICACHE_OPS),
+	PMU_EVENT_ATTR_ID(tlbi, L2_EVENT_TLBI),
+	PMU_EVENT_ATTR_ID(barriers, L2_EVENT_BARRIERS),
+	PMU_EVENT_ATTR_ID(total-reads, L2_EVENT_TOTAL_READS),
+	PMU_EVENT_ATTR_ID(total-writes, L2_EVENT_TOTAL_WRITES),
+	PMU_EVENT_ATTR_ID(total-requests, L2_EVENT_TOTAL_REQUESTS),
+	PMU_EVENT_ATTR_ID(ldrex, L2_EVENT_LDREX),
+	PMU_EVENT_ATTR_ID(strex, L2_EVENT_STREX),
+	PMU_EVENT_ATTR_ID(clrex, L2_EVENT_CLREX),
 	NULL
 };
 
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ