Thread (11 messages) flat view 11 messages, 2 authors, 2021-05-18
STALE1909d

Revision v1 of 4 in this series.

Revisions (4)
  1. v1 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 [diff vs current]

[PATCH 4/9] drivers/perf: Remove redundant macro and functions in qcom_l2_pmu.c

From: Qi Liu <hidden>
Date: 2021-05-18 07:24:12
Also in: lkml
Subsystem: arm pmu profiling and debugging, arm/qualcomm mailing list, the rest · Maintainers: Will Deacon, Mark Rutland, Linus Torvalds

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

Signed-off-by: Qi Liu <redacted>
---
 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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help