Commit b323dfe0 authored by Qi Liu's avatar Qi Liu Committed by Will Deacon
Browse files

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: default avatarQi Liu <liuqi115@huawei.com>
Link: https://lore.kernel.org/r/1623220863-58233-6-git-send-email-liuqi115@huawei.com


Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent 78b1d3c7
Loading
Loading
Loading
Loading
+4 −7
Original line number Original line Diff line number Diff line
@@ -278,17 +278,14 @@ static const struct attribute_group mc_pmu_v3_format_attr_group = {
static ssize_t xgene_pmu_event_show(struct device *dev,
static ssize_t xgene_pmu_event_show(struct device *dev,
				    struct device_attribute *attr, char *buf)
				    struct device_attribute *attr, char *buf)
{
{
	struct dev_ext_attribute *eattr;
	struct perf_pmu_events_attr *pmu_attr =
		container_of(attr, struct perf_pmu_events_attr, attr);


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


#define XGENE_PMU_EVENT_ATTR(_name, _config)		\
#define XGENE_PMU_EVENT_ATTR(_name, _config)		\
	(&((struct dev_ext_attribute[]) {		\
	PMU_EVENT_ATTR_ID(_name, xgene_pmu_event_show, _config)
		{ .attr = __ATTR(_name, S_IRUGO, xgene_pmu_event_show, NULL), \
		  .var = (void *) _config, }		\
	 })[0].attr.attr)


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