Commit 86cdd72a authored by Mark Rutland's avatar Mark Rutland Committed by Will Deacon

drivers/perf: arm_pmu: add common attr group fields

In preparation for adding common attribute groups, add an array of
attribute group pointers to arm_pmu, which will be used if the
backend hasn't already set pmu::attr_groups.

Subsequent patches will move backends over to using these, before adding
common fields.
Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent d3ea42aa
...@@ -1037,6 +1037,9 @@ int arm_pmu_device_probe(struct platform_device *pdev, ...@@ -1037,6 +1037,9 @@ int arm_pmu_device_probe(struct platform_device *pdev,
goto out_free; goto out_free;
} }
if (!pmu->pmu.attr_groups)
pmu->pmu.attr_groups = pmu->attr_groups;
ret = cpu_pmu_init(pmu); ret = cpu_pmu_init(pmu);
if (ret) if (ret)
goto out_free; goto out_free;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/perf_event.h> #include <linux/perf_event.h>
#include <linux/sysfs.h>
#include <asm/cputype.h> #include <asm/cputype.h>
/* /*
...@@ -77,6 +77,12 @@ struct pmu_hw_events { ...@@ -77,6 +77,12 @@ struct pmu_hw_events {
struct arm_pmu *percpu_pmu; struct arm_pmu *percpu_pmu;
}; };
enum armpmu_attr_groups {
ARMPMU_ATTR_GROUP_EVENTS,
ARMPMU_ATTR_GROUP_FORMATS,
ARMPMU_NR_ATTR_GROUPS
};
struct arm_pmu { struct arm_pmu {
struct pmu pmu; struct pmu pmu;
cpumask_t active_irqs; cpumask_t active_irqs;
...@@ -111,6 +117,8 @@ struct arm_pmu { ...@@ -111,6 +117,8 @@ struct arm_pmu {
struct pmu_hw_events __percpu *hw_events; struct pmu_hw_events __percpu *hw_events;
struct list_head entry; struct list_head entry;
struct notifier_block cpu_pm_nb; struct notifier_block cpu_pm_nb;
/* the attr_groups array must be NULL-terminated */
const struct attribute_group *attr_groups[ARMPMU_NR_ATTR_GROUPS + 1];
}; };
#define to_arm_pmu(p) (container_of(p, struct arm_pmu, pmu)) #define to_arm_pmu(p) (container_of(p, struct arm_pmu, pmu))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment