Skip to content

Commit b323dfe

Browse files
77liuqiwilldeacon
authored andcommitted
drivers/perf: Simplify EVENT ATTR macro in xgene_pmu.c
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> Link: https://lore.kernel.org/r/1623220863-58233-6-git-send-email-liuqi115@huawei.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent 78b1d3c commit b323dfe

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

drivers/perf/xgene_pmu.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -278,17 +278,14 @@ static const struct attribute_group mc_pmu_v3_format_attr_group = {
278278
static ssize_t xgene_pmu_event_show(struct device *dev,
279279
struct device_attribute *attr, char *buf)
280280
{
281-
struct dev_ext_attribute *eattr;
281+
struct perf_pmu_events_attr *pmu_attr =
282+
container_of(attr, struct perf_pmu_events_attr, attr);
282283

283-
eattr = container_of(attr, struct dev_ext_attribute, attr);
284-
return sysfs_emit(buf, "config=0x%lx\n", (unsigned long) eattr->var);
284+
return sysfs_emit(buf, "config=0x%llx\n", pmu_attr->id);
285285
}
286286

287287
#define XGENE_PMU_EVENT_ATTR(_name, _config) \
288-
(&((struct dev_ext_attribute[]) { \
289-
{ .attr = __ATTR(_name, S_IRUGO, xgene_pmu_event_show, NULL), \
290-
.var = (void *) _config, } \
291-
})[0].attr.attr)
288+
PMU_EVENT_ATTR_ID(_name, xgene_pmu_event_show, _config)
292289

293290
static struct attribute *l3c_pmu_events_attrs[] = {
294291
XGENE_PMU_EVENT_ATTR(cycle-count, 0x00),

0 commit comments

Comments
 (0)