[PATCH v2 5/9] drivers/perf: Remove redundant macro and functions in qcom_l3_pmu.c

From: Qi Liu
Date: Wed May 19 2021 - 05:53:36 EST


Remove L3CACHE_EVENT_ATTR and l3cache_pmu_event_show(), as there is
a general function for this.

Cc: Andy Gross <agross@xxxxxxxxxx>
Cc: Will Deacon <will@xxxxxxxxxx>
Cc: Mark Rutland <mark.rutland@xxxxxxx>
Signed-off-by: Qi Liu <liuqi115@xxxxxxxxxx>
---
drivers/perf/qcom_l3_pmu.c | 30 +++++++-----------------------
1 file changed, 7 insertions(+), 23 deletions(-)

diff --git a/drivers/perf/qcom_l3_pmu.c b/drivers/perf/qcom_l3_pmu.c
index bba0780..a163c9a 100644
--- a/drivers/perf/qcom_l3_pmu.c
+++ b/drivers/perf/qcom_l3_pmu.c
@@ -636,30 +636,14 @@ static const struct attribute_group qcom_l3_cache_pmu_format_group = {
};

/* events */
-
-static ssize_t l3cache_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 L3CACHE_EVENT_ATTR(_name, _id) \
- (&((struct perf_pmu_events_attr[]) { \
- { .attr = __ATTR(_name, 0444, l3cache_pmu_event_show, NULL), \
- .id = _id, } \
- })[0].attr.attr)
-
static struct attribute *qcom_l3_cache_pmu_events[] = {
- L3CACHE_EVENT_ATTR(cycles, L3_EVENT_CYCLES),
- L3CACHE_EVENT_ATTR(read-hit, L3_EVENT_READ_HIT),
- L3CACHE_EVENT_ATTR(read-miss, L3_EVENT_READ_MISS),
- L3CACHE_EVENT_ATTR(read-hit-d-side, L3_EVENT_READ_HIT_D),
- L3CACHE_EVENT_ATTR(read-miss-d-side, L3_EVENT_READ_MISS_D),
- L3CACHE_EVENT_ATTR(write-hit, L3_EVENT_WRITE_HIT),
- L3CACHE_EVENT_ATTR(write-miss, L3_EVENT_WRITE_MISS),
+ PMU_EVENT_ATTR_ID(cycles, L3_EVENT_CYCLES),
+ PMU_EVENT_ATTR_ID(read-hit, L3_EVENT_READ_HIT),
+ PMU_EVENT_ATTR_ID(read-miss, L3_EVENT_READ_MISS),
+ PMU_EVENT_ATTR_ID(read-hit-d-side, L3_EVENT_READ_HIT_D),
+ PMU_EVENT_ATTR_ID(read-miss-d-side, L3_EVENT_READ_MISS_D),
+ PMU_EVENT_ATTR_ID(write-hit, L3_EVENT_WRITE_HIT),
+ PMU_EVENT_ATTR_ID(write-miss, L3_EVENT_WRITE_MISS),
NULL
};

--
2.7.4