linux/drivers/clk
Danilo Krummrich 78437ab3b7 clk: scu/imx8qxp: do not register driver in probe()
imx_clk_scu_init() registers the imx_clk_scu_driver while commonly being
called from IMX driver's probe() callbacks.

However, it neither makes sense to register drivers from probe()
callbacks of other drivers, nor does the driver core allow registering
drivers with a device lock already being held.

The latter was revealed by commit dc23806a7c ("driver core: enforce
device_lock for driver_match_device()") leading to a deadlock condition
described in [1].

Besides that, nothing seems to unregister the imx_clk_scu_driver once
the corresponding driver module is unloaded, which leaves the
driver-core with a dangling pointer.

Also, if there are multiple matching devices for the imx8qxp_clk_driver,
imx8qxp_clk_probe() calls imx_clk_scu_init() multiple times.  However,
any subsequent call after the first one will fail, since the driver-core
does not allow to register the same struct platform_driver multiple
times.

Hence, register the imx_clk_scu_driver from module_init() and unregister
it in module_exit().

Note that we first register the imx8qxp_clk_driver and then call
imx_clk_scu_module_init() to avoid having to call
imx_clk_scu_module_exit() in the unwind path of imx8qxp_clk_init().

Fixes: dc23806a7c ("driver core: enforce device_lock for driver_match_device()")
Fixes: 220175cd39 ("clk: imx: scu: fix build break when compiled as modules")
Reported-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Closes: https://lore.kernel.org/lkml/13955113.uLZWGnKmhe@steina-w/
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> # TQMa8x/MBa8x
Link: https://lore.kernel.org/lkml/DFU7CEPUSG9A.1KKGVW4HIPMSH@kernel.org/ [1]
Acked-by: Abel Vesa <abelvesa@kernel.org>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://patch.msgid.link/20260212235842.85934-1-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-02-24 12:54:17 +01:00
..
actions clk: actions: owl-divider: convert from divider_round_rate() to divider_determine_rate() 2026-01-22 10:48:25 -05:00
analogbits
aspeed Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
at91 Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
axis Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
axs10x Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
baikal-t1 Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
bcm Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
berlin Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
davinci Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
hisilicon Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
imgtec Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
imx clk: scu/imx8qxp: do not register driver in probe() 2026-02-24 12:54:17 +01:00
ingenic Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
keystone Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
mediatek Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
meson Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
microchip cleanups and fixes 2026-02-16 09:30:44 -08:00
mmp Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
mstar
mvebu Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
mxs Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
nuvoton clk: nuvoton: ma35d1-divider: convert from divider_round_rate() to divider_determine_rate() 2026-01-22 10:48:25 -05:00
nxp Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
pistachio Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
pxa Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
qcom Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ralink Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
renesas Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
rockchip Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
samsung Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
sifive
socfpga Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
sophgo clk: sophgo: sg2042-clkgen: convert from divider_round_rate() to divider_determine_rate() 2026-01-22 10:48:26 -05:00
spacemit Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
spear Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
sprd Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
st Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
starfive Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
stm32 Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
sunxi Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
sunxi-ng Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
tegra Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
thead clk: thead: th1520-ap: Support CPU frequency scaling 2026-01-14 17:26:47 -08:00
ti Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
uniphier
ux500 Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
versatile Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
visconti Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
x86 clk: x86: cgu: convert from divider_round_rate() to divider_determine_rate() 2026-01-22 10:48:26 -05:00
xilinx Merge branch 'clk-determine-rate' into clk-next 2025-10-06 13:02:50 -05:00
zynq Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
zynqmp Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
.kunitconfig clk: Disable KUNIT_UML_PCI 2026-02-02 16:42:07 -08:00
Kconfig Not much changed in the clk framework this time except the clk.h consumer API 2026-02-15 08:18:57 -08:00
Makefile clk: aspeed: Move the existing ASPEED clk drivers into aspeed subdirectory. 2026-02-03 21:35:58 -08:00
clk-apple-nco.c clk: clk-apple-nco: Add "apple,t8103-nco" compatible 2026-01-15 18:50:26 -08:00
clk-asm9260.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-axi-clkgen.c
clk-axm5516.c
clk-bd718x7.c clk: clk-bd718x7: Support BD72720 clk gate 2026-01-13 12:50:20 +00:00
clk-bm1880.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-bulk.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-cdce706.c
clk-cdce925.c
clk-clps711x.c Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
clk-composite.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-conf.c
clk-cs2000-cp.c
clk-devres.c clk: Add devm_clk_bulk_get_optional_enable() helper 2026-01-21 18:57:07 -08:00
clk-divider.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-en7523.c clk: en7523: Add reset-controller support for EN7523 SoC 2025-11-13 20:05:13 -08:00
clk-ep93xx.c Merge branch 'clk-determine-rate' into clk-next 2025-10-06 13:02:50 -05:00
clk-eyeq.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-fixed-factor.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-fixed-mmio.c
clk-fixed-rate.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-fixed-rate_test.c
clk-fixed-rate_test.h
clk-fractional-divider.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-fractional-divider.h
clk-fractional-divider_test.c
clk-fsl-flexspi.c
clk-fsl-sai.c
clk-gate.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-gate_test.c
clk-gemini.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
clk-gpio.c
clk-hi655x.c
clk-highbank.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-hsdk-pll.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-k210.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-lan966x.c clk: lan966x: remove unused dt-bindings include 2025-11-08 12:01:01 +02:00
clk-lmk04832.c clk: lmk04832: Simplify with scoped for each OF child loop 2026-01-15 18:48:53 -08:00
clk-lochnagar.c
clk-loongson1.c clk: loongson1: convert from divider_round_rate() to divider_determine_rate() 2026-01-22 10:48:25 -05:00
clk-loongson2.c
clk-max9485.c
clk-max77686.c
clk-milbeaut.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
clk-moxart.c
clk-multiplier.c
clk-mux.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-nomadik.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-npcm7xx.c Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
clk-npcm8xx.c
clk-nspire.c
clk-palmas.c
clk-plldig.c
clk-pwm.c
clk-qoriq.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-renesas-pcie.c clk: rs9: Convert to DEFINE_SIMPLE_DEV_PM_OPS() 2026-02-02 16:35:56 -08:00
clk-rk808.c
clk-rp1.c
clk-rpmi.c
clk-s2mps11.c
clk-scmi.c Merge branch 'clk-determine-rate' into clk-next 2025-10-06 13:02:50 -05:00
clk-scpi.c clk: scpi: Simplify with scoped for each OF child loop 2026-01-15 18:48:54 -08:00
clk-si514.c
clk-si521xx.c
clk-si544.c
clk-si570.c
clk-si5341.c
clk-si5351.c
clk-si5351.h
clk-sp7021.c There's a bunch of patches here across drivers/clk/ to migrate drivers to use 2025-10-07 09:28:37 -07:00
clk-sparx5.c
clk-stm32f4.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
clk-stm32h7.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-tps68470.c
clk-twl.c
clk-twl6040.c
clk-versaclock3.c clk: versaclock3: convert from divider_round_rate() to divider_determine_rate() 2026-01-22 10:48:26 -05:00
clk-versaclock5.c
clk-versaclock7.c
clk-vt8500.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-wm831x.c
clk-xgene.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk.h
clk_kunit_helpers.c
clk_parent_data_test.h
clk_test.c
clkdev.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
kunit_clk_assigned_rates.h
kunit_clk_assigned_rates_multiple.dtso
kunit_clk_assigned_rates_multiple_consumer.dtso
kunit_clk_assigned_rates_null.dtso
kunit_clk_assigned_rates_null_consumer.dtso
kunit_clk_assigned_rates_one.dtso
kunit_clk_assigned_rates_one_consumer.dtso
kunit_clk_assigned_rates_u64_multiple.dtso
kunit_clk_assigned_rates_u64_multiple_consumer.dtso
kunit_clk_assigned_rates_u64_one.dtso
kunit_clk_assigned_rates_u64_one_consumer.dtso
kunit_clk_assigned_rates_without.dtso
kunit_clk_assigned_rates_without_consumer.dtso
kunit_clk_assigned_rates_zero.dtso
kunit_clk_assigned_rates_zero_consumer.dtso
kunit_clk_fixed_rate_test.dtso
kunit_clk_hw_get_dev_of_node.dtso
kunit_clk_parent_data_test.dtso