summaryrefslogtreecommitdiff
path: root/drivers/perf/hisilicon/hisi_uncore_pmu.c
diff options
context:
space:
mode:
authorChen Jun <chenjun102@huawei.com>2022-05-16 16:16:01 +0300
committerWill Deacon <will@kernel.org>2022-06-27 13:14:54 +0300
commite500405dd15d956790859fa532c64d8186445372 (patch)
tree9277a81014b3e03827d8b84effc49a0a6e06dfc5 /drivers/perf/hisilicon/hisi_uncore_pmu.c
parentf5ebeb138fa6eb62d90264f9619019aa8c926a22 (diff)
downloadlinux-e500405dd15d956790859fa532c64d8186445372.tar.xz
perf: hisi: Extract hisi_pmu_init
Extract the initialization code of hisi_pmu->pmu into a function Signed-off-by: Chen Jun <chenjun102@huawei.com> Link: https://lore.kernel.org/r/20220516131601.48383-1-chenjun102@huawei.com Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'drivers/perf/hisilicon/hisi_uncore_pmu.c')
-rw-r--r--drivers/perf/hisilicon/hisi_uncore_pmu.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/perf/hisilicon/hisi_uncore_pmu.c b/drivers/perf/hisilicon/hisi_uncore_pmu.c
index 980b9ee6eb14..fbc8a93d5eac 100644
--- a/drivers/perf/hisilicon/hisi_uncore_pmu.c
+++ b/drivers/perf/hisilicon/hisi_uncore_pmu.c
@@ -531,4 +531,22 @@ int hisi_uncore_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node)
}
EXPORT_SYMBOL_GPL(hisi_uncore_pmu_offline_cpu);
+void hisi_pmu_init(struct pmu *pmu, const char *name,
+ const struct attribute_group **attr_groups, struct module *module)
+{
+ pmu->name = name;
+ pmu->module = module;
+ pmu->task_ctx_nr = perf_invalid_context;
+ pmu->event_init = hisi_uncore_pmu_event_init;
+ pmu->pmu_enable = hisi_uncore_pmu_enable;
+ pmu->pmu_disable = hisi_uncore_pmu_disable;
+ pmu->add = hisi_uncore_pmu_add;
+ pmu->del = hisi_uncore_pmu_del;
+ pmu->start = hisi_uncore_pmu_start;
+ pmu->stop = hisi_uncore_pmu_stop;
+ pmu->read = hisi_uncore_pmu_read;
+ pmu->attr_groups = attr_groups;
+}
+EXPORT_SYMBOL_GPL(hisi_pmu_init);
+
MODULE_LICENSE("GPL v2");