[PATCH RFC/RFT 12/12] clk: samsung: gs101: Use platform_driver_probe() to avoid __refdata

From: Krzysztof Kozlowski
Date: Wed Mar 05 2025 - 16:46:54 EST


Switch registering platform driver to platform_driver_probe(), so the
'struct platform_driver' can be properly discarded after init and there
won't be need of __refdata to silence DEBUG_SECTION_MISMATCH.

The change requires using subsys_initcall instead of core_initcall,
because no device drivers would bound in the latter, as required by
platform_driver_probe().

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
---
drivers/clk/samsung/clk-gs101.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/samsung/clk-gs101.c b/drivers/clk/samsung/clk-gs101.c
index 86b39edba12276745a124df6a2ea9c22d74b915a..69c121d478f3fec98dcd84e0639e204fe604e91c 100644
--- a/drivers/clk/samsung/clk-gs101.c
+++ b/drivers/clk/samsung/clk-gs101.c
@@ -4412,17 +4412,16 @@ static const struct of_device_id gs101_cmu_of_match[] = {
},
};

-static struct platform_driver gs101_cmu_driver __refdata = {
+static struct platform_driver gs101_cmu_driver __initdata = {
.driver = {
.name = "gs101-cmu",
.of_match_table = gs101_cmu_of_match,
.suppress_bind_attrs = true,
},
- .probe = gs101_cmu_probe,
};

static int __init gs101_cmu_init(void)
{
- return platform_driver_register(&gs101_cmu_driver);
+ return platform_driver_probe(&gs101_cmu_driver, gs101_cmu_probe);
}
-core_initcall(gs101_cmu_init);
+subsys_initcall(gs101_cmu_init);

--
2.43.0