diff mbox series

[13/32] perf/riscv: Assign parents for event_source devices

Message ID 20230404134225.13408-14-Jonathan.Cameron@huawei.com (mailing list archive)
State New
Headers show
Series Add parents to struct pmu -> dev | expand

Commit Message

Jonathan Cameron April 4, 2023, 1:42 p.m. UTC
Currently all these devices appear directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parents to be the appropriate platform devices.

Link: https://lore.kernel.org/linux-cxl/ZCLI9A40PJsyqAmq@kroah.com/
Cc: Atish Patra <atishp@atishpatra.org>
CC: Anup Patel <anup@brainfault.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

---

Untested.

This is minimal change, but could be made more elegant either by
making one of the existing initialization functions take a struct device *
or by embedding one in struct riscv_pmu
---
 drivers/perf/riscv_pmu_legacy.c | 1 +
 drivers/perf/riscv_pmu_sbi.c    | 1 +
 2 files changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/perf/riscv_pmu_legacy.c b/drivers/perf/riscv_pmu_legacy.c
index ca9e20bfc7ac..8c4a0d915dc7 100644
--- a/drivers/perf/riscv_pmu_legacy.c
+++ b/drivers/perf/riscv_pmu_legacy.c
@@ -102,6 +102,7 @@  static int pmu_legacy_device_probe(struct platform_device *pdev)
 	pmu = riscv_pmu_alloc();
 	if (!pmu)
 		return -ENOMEM;
+	pmu->pmu.parent = &pdev->dev;
 	pmu_legacy_init(pmu);
 
 	return 0;
diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c
index 70cb50fd41c2..f138fbc00a66 100644
--- a/drivers/perf/riscv_pmu_sbi.c
+++ b/drivers/perf/riscv_pmu_sbi.c
@@ -880,6 +880,7 @@  static int pmu_sbi_device_probe(struct platform_device *pdev)
 	}
 
 	pmu->pmu.attr_groups = riscv_pmu_attr_groups;
+	pmu->pmu.parent = &pdev->dev;
 	pmu->cmask = cmask;
 	pmu->ctr_start = pmu_sbi_ctr_start;
 	pmu->ctr_stop = pmu_sbi_ctr_stop;