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

From: Krzysztof Kozlowski
Date: Wed Mar 05 2025 - 16:47:32 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-exynosautov9.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynosautov9.c b/drivers/clk/samsung/clk-exynosautov9.c
index 5971e680e566336ecdf55bdccacc3cea09a33201..627f3d2666740fc4cba205e6e2da65f53b8df186 100644
--- a/drivers/clk/samsung/clk-exynosautov9.c
+++ b/drivers/clk/samsung/clk-exynosautov9.c
@@ -2190,17 +2190,16 @@ static const struct of_device_id exynosautov9_cmu_of_match[] = {
},
};

-static struct platform_driver exynosautov9_cmu_driver __refdata = {
+static struct platform_driver exynosautov9_cmu_driver __initdata = {
.driver = {
.name = "exynosautov9-cmu",
.of_match_table = exynosautov9_cmu_of_match,
.suppress_bind_attrs = true,
},
- .probe = exynosautov9_cmu_probe,
};

static int __init exynosautov9_cmu_init(void)
{
- return platform_driver_register(&exynosautov9_cmu_driver);
+ return platform_driver_probe(&exynosautov9_cmu_driver, exynosautov9_cmu_probe);
}
core_initcall(exynosautov9_cmu_init);

--
2.43.0