[PATCH v2 3/9] drivers/perf: Remove redundant macro and functions in SMMU PMU driver
Qi Liu
liuqi115 at huawei.com
Wed May 19 02:51:53 PDT 2021
Remove SMMU_EVENT_ATTR and smmu_event_sysfs_show(), as there is
a general function for this.
Cc: Will Deacon <will at kernel.org>
Cc: Mark Rutland <mark.rutland at arm.com>
Signed-off-by: Qi Liu <liuqi115 at huawei.com>
---
drivers/perf/arm_smmuv3_pmu.c | 33 ++++++++-------------------------
1 file changed, 8 insertions(+), 25 deletions(-)
diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c
index ff6fab4..9d745a1 100644
--- a/drivers/perf/arm_smmuv3_pmu.c
+++ b/drivers/perf/arm_smmuv3_pmu.c
@@ -498,32 +498,15 @@ static const struct attribute_group smmu_pmu_cpumask_group = {
};
/* Events */
-
-static ssize_t smmu_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 SMMU_EVENT_ATTR(name, config) \
- (&((struct perf_pmu_events_attr) { \
- .attr = __ATTR(name, 0444, smmu_pmu_event_show, NULL), \
- .id = config, \
- }).attr.attr)
-
static struct attribute *smmu_pmu_events[] = {
- SMMU_EVENT_ATTR(cycles, 0),
- SMMU_EVENT_ATTR(transaction, 1),
- SMMU_EVENT_ATTR(tlb_miss, 2),
- SMMU_EVENT_ATTR(config_cache_miss, 3),
- SMMU_EVENT_ATTR(trans_table_walk_access, 4),
- SMMU_EVENT_ATTR(config_struct_access, 5),
- SMMU_EVENT_ATTR(pcie_ats_trans_rq, 6),
- SMMU_EVENT_ATTR(pcie_ats_trans_passed, 7),
+ PMU_EVENT_ATTR_ID(cycles, 0),
+ PMU_EVENT_ATTR_ID(transaction, 1),
+ PMU_EVENT_ATTR_ID(tlb_miss, 2),
+ PMU_EVENT_ATTR_ID(config_cache_miss, 3),
+ PMU_EVENT_ATTR_ID(trans_table_walk_access, 4),
+ PMU_EVENT_ATTR_ID(config_struct_access, 5),
+ PMU_EVENT_ATTR_ID(pcie_ats_trans_rq, 6),
+ PMU_EVENT_ATTR_ID(pcie_ats_trans_passed, 7),
NULL
};
--
2.7.4
More information about the linux-arm-kernel
mailing list