linux/drivers/clk/imx
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
..
clk-busy.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-composite-7ulp.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-composite-8m.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-composite-93.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-cpu.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-divider-gate.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-fixup-div.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-fixup-mux.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-frac-pll.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-fracn-gppll.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-gate-93.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-gate-exclusive.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-gate2.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-gpr-mux.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-imx1.c clk: imx: Drop inclusion of unused header <soc/imx/timer.h> 2023-06-23 09:33:43 +02:00
clk-imx5.c clk: Fix typos 2025-07-26 23:49:18 -07:00
clk-imx6q.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
clk-imx6sl.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
clk-imx6sll.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
clk-imx6sx.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
clk-imx6ul.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
clk-imx7d.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-imx7ulp.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
clk-imx8-acm.c clk: Fix typos 2025-07-26 23:49:18 -07:00
clk-imx8dxl-rsrc.c clk: imx8: remove MLB support 2023-10-04 15:44:11 +03:00
clk-imx8mm.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
clk-imx8mn.c clk: imx: imx8mn: add sai7_ipg_clk clock settings 2024-06-21 09:35:25 +03:00
clk-imx8mp-audiomix.c clk: imx: imx8mp-audiomix: use devm_auxiliary_device_create() to simple code 2025-11-11 17:04:00 +02:00
clk-imx8mp.c clk: imx8mp: inform CCF of maximum frequency of clocks 2025-03-03 19:02:15 +02:00
clk-imx8mq.c clk: imx: imx8mq: correct error handling path 2023-10-04 11:35:56 +03:00
clk-imx8qm-rsrc.c clk: imx: imx8qm/qxp: add more resources to whitelist 2023-10-04 15:44:19 +03:00
clk-imx8qxp-lpcg.c clk: imx: Remove redundant pm_runtime_mark_last_busy() calls 2025-07-24 14:43:54 -07:00
clk-imx8qxp-lpcg.h clk: imx8: remove MLB support 2023-10-04 15:44:11 +03:00
clk-imx8qxp-rsrc.c clk: imx: imx8qm/qxp: add more resources to whitelist 2023-10-04 15:44:19 +03:00
clk-imx8qxp.c clk: scu/imx8qxp: do not register driver in probe() 2026-02-24 12:54:17 +01:00
clk-imx8ulp-sim-lpav.c clk: imx: add driver for imx8ulp's sim lpav 2025-11-11 18:01:25 +02:00
clk-imx8ulp.c Merge branches 'clk-imx', 'clk-samsung', 'clk-annotate', 'clk-marvell' and 'clk-lmk' into clk-next 2023-08-30 14:39:19 -07:00
clk-imx25.c clk: imx25: make __mx25_clocks_init return void 2023-08-14 12:41:05 +03:00
clk-imx27.c clk: imx: imx27: Simplify with scoped for each OF child loop 2026-02-03 20:58:13 -06:00
clk-imx31.c clk: imx: imx31: Simplify with scoped for each OF child loop 2026-02-03 20:58:13 -06:00
clk-imx35.c clk: imx: Drop inclusion of unused header <soc/imx/timer.h> 2023-06-23 09:33:43 +02:00
clk-imx93.c clk: imx: Apply some clks only for i.MX93 2024-12-26 16:46:03 +02:00
clk-imx95-blk-ctl.c clk: imx95-blk-ctl: Save/restore registers when RPM routines are called 2025-09-12 17:28:29 +03:00
clk-imxrt1050.c clk: imx: add missing MODULE_DESCRIPTION() macros 2024-06-24 14:21:09 +03:00
clk-lpcg-scu.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-pfd.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-pfdv2.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-pll14xx.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-pllv1.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-pllv2.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-pllv3.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-pllv4.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-scu.c clk: scu/imx8qxp: do not register driver in probe() 2026-02-24 12:54:17 +01:00
clk-scu.h clk: scu/imx8qxp: do not register driver in probe() 2026-02-24 12:54:17 +01:00
clk-sscg-pll.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
clk-vf610.c syscore: Pass context data to callbacks 2025-11-14 10:01:52 +01: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: imx: clk-imx8mp: Allow media_disp pixel clock reconfigure parent rate 2024-06-21 09:35:30 +03:00
Kconfig clk: imx: add driver for imx8ulp's sim lpav 2025-11-11 18:01:25 +02:00
Makefile clk: imx: add driver for imx8ulp's sim lpav 2025-11-11 18:01:25 +02:00