Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Qi Liu and committed by
Will Deacon
b323dfe0 78b1d3c7

+4 -7
+4 -7
drivers/perf/xgene_pmu.c
··· 278 278 static ssize_t xgene_pmu_event_show(struct device *dev, 279 279 struct device_attribute *attr, char *buf) 280 280 { 281 - struct dev_ext_attribute *eattr; 281 + struct perf_pmu_events_attr *pmu_attr = 282 + container_of(attr, struct perf_pmu_events_attr, attr); 282 283 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); 285 285 } 286 286 287 287 #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) 292 289 293 290 static struct attribute *l3c_pmu_events_attrs[] = { 294 291 XGENE_PMU_EVENT_ATTR(cycle-count, 0x00),