[PATCH] perf/smmuv3: Add platform id table for module auto loading

From: Yicong Yang
Date: Mon Aug 07 2023 - 08:24:53 EST


From: Yicong Yang <yangyicong@xxxxxxxxxxxxx>

On ACPI based system the device is probed by the name directly. If the
driver is configured as module it can only be loaded manually. Add the
platform id table as well as the module alias then the driver will be
loaded automatically by the udev or others once the device added.

Signed-off-by: Yicong Yang <yangyicong@xxxxxxxxxxxxx>
---
drivers/perf/arm_smmuv3_pmu.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c
index 25a269d431e4..f27c5f585524 100644
--- a/drivers/perf/arm_smmuv3_pmu.c
+++ b/drivers/perf/arm_smmuv3_pmu.c
@@ -946,7 +946,14 @@ static const struct of_device_id smmu_pmu_of_match[] = {
MODULE_DEVICE_TABLE(of, smmu_pmu_of_match);
#endif

+static const struct platform_device_id smmu_pmu_platform_match[] = {
+ { "arm-smmu-v3-pmcg", 0 },
+ {}
+};
+MODULE_DEVICE_TABLE(platform, smmu_pmu_platform_match);
+
static struct platform_driver smmu_pmu_driver = {
+ .id_table = smmu_pmu_platform_match,
.driver = {
.name = "arm-smmu-v3-pmcg",
.of_match_table = of_match_ptr(smmu_pmu_of_match),
--
2.24.0