summaryrefslogtreecommitdiff
path: root/drivers/perf/arm-cci.c
diff options
context:
space:
mode:
authorRobin Murphy <robin.murphy@arm.com>2018-05-14 16:34:53 +0300
committerWill Deacon <will.deacon@arm.com>2018-05-21 20:12:54 +0300
commit8b0c93c20ef78f15d8b760964ff79bda7f68c610 (patch)
tree2151d7fded7c7907b9a9c5d2784a6ded6aaac7ea /drivers/perf/arm-cci.c
parent28c01dc9d85e4cd744f254c45d3c894bca168ed6 (diff)
downloadlinux-8b0c93c20ef78f15d8b760964ff79bda7f68c610.tar.xz
perf/arm-cci: Allow building as a module
Fill in the few extra bits and annotations needed to make the driver work properly as a module, and jiggle the Kconfig to expose the driver-level ARM_CCI_PMU option. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'drivers/perf/arm-cci.c')
-rw-r--r--drivers/perf/arm-cci.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/perf/arm-cci.c b/drivers/perf/arm-cci.c
index 33b47c292d79..e6fadc8e1178 100644
--- a/drivers/perf/arm-cci.c
+++ b/drivers/perf/arm-cci.c
@@ -1407,6 +1407,7 @@ static int cci_pmu_init(struct cci_pmu *cci_pmu, struct platform_device *pdev)
pmu_format_attr_group.attrs = model->format_attrs;
cci_pmu->pmu = (struct pmu) {
+ .module = THIS_MODULE,
.name = cci_pmu->model->name,
.task_ctx_nr = perf_invalid_context,
.pmu_enable = cci_pmu_enable,
@@ -1572,6 +1573,7 @@ static const struct of_device_id arm_cci_pmu_matches[] = {
#endif
{},
};
+MODULE_DEVICE_TABLE(of, arm_cci_pmu_matches);
static bool is_duplicate_irq(int irq, int *irqs, int nr_irqs)
{
@@ -1693,14 +1695,27 @@ static int cci_pmu_probe(struct platform_device *pdev)
return 0;
}
+static int cci_pmu_remove(struct platform_device *pdev)
+{
+ if (!g_cci_pmu)
+ return 0;
+
+ cpuhp_remove_state(CPUHP_AP_PERF_ARM_CCI_ONLINE);
+ perf_pmu_unregister(&g_cci_pmu->pmu);
+ g_cci_pmu = NULL;
+
+ return 0;
+}
+
static struct platform_driver cci_pmu_driver = {
.driver = {
.name = DRIVER_NAME,
.of_match_table = arm_cci_pmu_matches,
},
.probe = cci_pmu_probe,
+ .remove = cci_pmu_remove,
};
-builtin_platform_driver(cci_pmu_driver);
+module_platform_driver(cci_pmu_driver);
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("ARM CCI PMU support");