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 clk: analogbits: Fix incorrect calculation of vco rate delta 2025-01-16 13:43:49 -08:00
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 clk: mstar: msc313-cpupll: convert from round_rate() to determine_rate() 2025-09-08 09:41:30 -04:00
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 clk: sifive: sifive-prci: convert from round_rate() to determine_rate() 2025-09-08 09:41:28 -04:00
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
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: clk-axi-clkgen: remove unneeded semicolon 2025-08-14 13:27:00 -07:00
clk-axm5516.c clk: remove unneeded 'fast_io' parameter in regmap_config 2025-08-14 12:50:35 -07:00
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: cdce706: convert from round_rate() to determine_rate() 2025-09-08 09:41:30 -04:00
clk-cdce925.c clk: cdce925: convert from round_rate() to determine_rate() 2025-09-08 09:41:26 -04:00
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: clk-conf: support assigned-clock-rates-u64 2024-08-16 15:21:19 -07:00
clk-cs2000-cp.c clk: cs2000-cp: convert from round_rate() to determine_rate() 2025-09-08 09:41:26 -04:00
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: Switch back to struct platform_driver::remove() 2024-09-21 14:12:05 -07:00
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: Add KUnit tests for clk fixed rate basic type 2024-07-29 15:33:13 -07:00
clk-fixed-rate_test.h clk: Add KUnit tests for clk fixed rate basic type 2024-07-29 15:33:13 -07:00
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: test: add missing MODULE_DESCRIPTION() macros 2024-06-03 15:46:46 -07:00
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: test: add missing MODULE_DESCRIPTION() macros 2024-06-03 15:46:46 -07:00
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: clk-gpio: add driver for gated-fixed-clocks 2024-10-16 11:20:42 -07:00
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: loongson2: Add clock definitions for Loongson-2K0300 SoC 2025-09-21 12:48:51 -07:00
clk-max9485.c clk: max9485: convert from round_rate() to determine_rate() 2025-09-08 09:41:27 -04:00
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: multiplier: convert from round_rate() to determine_rate() 2025-09-08 09:41:27 -04:00
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: npcm8xx: add clock controller 2024-10-17 15:17:51 -07:00
clk-nspire.c
clk-palmas.c clk: Switch back to struct platform_driver::remove() 2024-09-21 14:12:05 -07:00
clk-plldig.c
clk-pwm.c clk: pwm: Make use of non-sleeping PWMs 2025-06-19 18:09:58 -07:00
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: rp1: convert from round_rate() to determine_rate() 2025-09-03 14:58:19 -07:00
clk-rpmi.c clk: Add clock driver for the RISC-V RPMI clock service group 2025-09-25 13:16:48 -06:00
clk-s2mps11.c clk: s2mps11: add support for S2MPG10 PMIC clock 2025-09-21 10:43:18 -07:00
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: si514: convert from round_rate() to determine_rate() 2025-09-08 09:41:28 -04:00
clk-si521xx.c clk: si521xx: convert from round_rate() to determine_rate() 2025-09-08 09:41:28 -04:00
clk-si544.c clk: si544: convert from round_rate() to determine_rate() 2025-09-08 09:41:28 -04:00
clk-si570.c clk: si570: convert from round_rate() to determine_rate() 2025-09-08 09:41:28 -04:00
clk-si5341.c clk: si5341: convert from round_rate() to determine_rate() 2025-09-08 09:41:28 -04:00
clk-si5351.c clk: Fix typos 2025-07-26 23:49:18 -07:00
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: sparx5: convert from round_rate() to determine_rate() 2025-09-08 09:41:28 -04:00
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: tps68470: convert from round_rate() to determine_rate() 2025-09-08 09:41:29 -04:00
clk-twl.c clk: twl: add TWL6030 support 2024-10-17 12:02:42 -07:00
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: versaclock5: convert from round_rate() to determine_rate() 2025-09-08 09:41:31 -04:00
clk-versaclock7.c clk: versaclock7: convert from round_rate() to determine_rate() 2025-09-08 09:41:31 -04:00
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: wm831x: convert from round_rate() to determine_rate() 2025-09-08 09:41:29 -04:00
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: test: Add test managed of_clk_add_hw_provider() 2024-10-09 16:25:32 -07:00
clk_parent_data_test.h clk: Add KUnit tests for clks registered with struct clk_parent_data 2024-07-29 15:33:13 -07:00
clk_test.c Merge branches 'clk-bindings', 'clk-cleanup', 'clk-pwm', 'clk-hw-device', 'clk-xilinx' and 'clk-adi' into clk-next 2025-07-29 15:18:13 -07:00
clkdev.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -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
kunit_clk_assigned_rates.h clk: test: Add KUnit tests for clock-assigned-rates{-u64} DT properties 2024-10-09 16:25:32 -07:00
kunit_clk_assigned_rates_multiple.dtso clk: test: Add KUnit tests for clock-assigned-rates{-u64} DT properties 2024-10-09 16:25:32 -07:00
kunit_clk_assigned_rates_multiple_consumer.dtso clk: test: Add KUnit tests for clock-assigned-rates{-u64} DT properties 2024-10-09 16:25:32 -07:00
kunit_clk_assigned_rates_null.dtso clk: test: Add KUnit tests for clock-assigned-rates{-u64} DT properties 2024-10-09 16:25:32 -07:00
kunit_clk_assigned_rates_null_consumer.dtso clk: test: Add KUnit tests for clock-assigned-rates{-u64} DT properties 2024-10-09 16:25:32 -07:00
kunit_clk_assigned_rates_one.dtso clk: test: Add KUnit tests for clock-assigned-rates{-u64} DT properties 2024-10-09 16:25:32 -07:00
kunit_clk_assigned_rates_one_consumer.dtso clk: test: Add KUnit tests for clock-assigned-rates{-u64} DT properties 2024-10-09 16:25:32 -07:00
kunit_clk_assigned_rates_u64_multiple.dtso clk: test: Add KUnit tests for clock-assigned-rates{-u64} DT properties 2024-10-09 16:25:32 -07:00
kunit_clk_assigned_rates_u64_multiple_consumer.dtso clk: test: Add KUnit tests for clock-assigned-rates{-u64} DT properties 2024-10-09 16:25:32 -07:00
kunit_clk_assigned_rates_u64_one.dtso clk: test: Add KUnit tests for clock-assigned-rates{-u64} DT properties 2024-10-09 16:25:32 -07:00
kunit_clk_assigned_rates_u64_one_consumer.dtso clk: test: Add KUnit tests for clock-assigned-rates{-u64} DT properties 2024-10-09 16:25:32 -07:00
kunit_clk_assigned_rates_without.dtso clk: test: Add KUnit tests for clock-assigned-rates{-u64} DT properties 2024-10-09 16:25:32 -07:00
kunit_clk_assigned_rates_without_consumer.dtso clk: test: Add KUnit tests for clock-assigned-rates{-u64} DT properties 2024-10-09 16:25:32 -07:00
kunit_clk_assigned_rates_zero.dtso clk: test: Add KUnit tests for clock-assigned-rates{-u64} DT properties 2024-10-09 16:25:32 -07:00
kunit_clk_assigned_rates_zero_consumer.dtso clk: test: Add KUnit tests for clock-assigned-rates{-u64} DT properties 2024-10-09 16:25:32 -07:00
kunit_clk_fixed_rate_test.dtso clk: Add KUnit tests for clk fixed rate basic type 2024-07-29 15:33:13 -07:00
kunit_clk_hw_get_dev_of_node.dtso clk: tests: add clk_hw_get_dev() and clk_hw_get_of_node() tests 2025-06-20 00:15:39 -07:00
kunit_clk_parent_data_test.dtso clk: Add KUnit tests for clks registered with struct clk_parent_data 2024-07-29 15:33:13 -07:00
Makefile clk: aspeed: Move the existing ASPEED clk drivers into aspeed subdirectory. 2026-02-03 21:35:58 -08:00