]> www.infradead.org Git - users/dwmw2/linux.git/commit
clk: mediatek: mt8173-infracfg: Handle unallocated infracfg when module
authorAlper Nebi Yasak <alpernebiyasak@gmail.com>
Wed, 12 Jun 2024 20:11:00 +0000 (23:11 +0300)
committerStephen Boyd <sboyd@kernel.org>
Mon, 8 Jul 2024 19:06:43 +0000 (12:06 -0700)
commit7f294d10eb13bd5b09fa1dc9abe60d22974a2a20
tree56e88b757d60cee02eec95c05dafcb5f20801d3f
parent9f7809c6a8824b7147595b3c36e633ffc81fe2ab
clk: mediatek: mt8173-infracfg: Handle unallocated infracfg when module

The MT8173 infracfg clock driver does initialization in two steps, via a
CLK_OF_DECLARE_DRIVER declaration. However its early init function
doesn't get to run when it's built as a module, presumably since it's
not loaded by the time it would have been called by of_clk_init(). This
causes its second-step probe() to return -ENOMEM when trying to register
clocks, as the necessary clock_data struct isn't initialized by the
first step.

MT2701 and MT6797 clock drivers also use this mechanism, but they try to
allocate the necessary clock_data structure if missing in the second
step. Mimic that for the MT8173 infracfg clock as well to make it work
as a module.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20240612201211.91683-1-alpernebiyasak@gmail.com
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/mediatek/clk-mt8173-infracfg.c