[PATCH v2 00/35] clk: mediatek: Migrate to common probe/remove helpers and fix memory leaks
AngeloGioacchino Del Regno
angelogioacchino.delregno at collabora.com
Tue Nov 17 02:37:00 PST 2026
On 10/13/26 17:16, Akari Tsuyukusa wrote:
> This series migrates most MediaTek clock drivers to the common
> probe/remove helpers provided by the MTK clock framework.
>
Thanks for this big series finishing the migration, that's really appreciated.
I have applied everything I could, but had to leave out anything that is touching
FHCTL/PLLFH because that code changed a bit in one of the previous series that got
sent for MT8189 clocks.
Anyway - I also had comments about that, so it's not a big deal... specifically,
can we avoid those ifdefs please?
I seriously don't like having ifdefs around.
Cheers,
Angelo
> Key changes:
> - Fix memory leaks on module removal caused by missing
> platform_set_drvdata() calls (patches 1-6).
> - Add missing MODULE_DEVICE_TABLE() (patches 7, 8).
> - Add missing support for cpumux, PLL, FHCTL, and child-device
> population to the common helpers (patches 12-15).
> - Convert all compatible clock drivers to use struct mtk_clk_desc
> and mtk_clk_simple_probe/remove (patches 16-35).
>
> The memory leak and MODULE_DEVICE_TABLE() fixes are split from the
> migration patches to allow backporting to stable.
>
> Drivers not converted:
> - MT6765 apmixedsys: requires direct register init.
> - MT6795 apmixedsys: uses mtk_clk_register_ref2usb_tx().
> - MT7629 eth/sgmiisys: uses a hacked probe sequence (multi-instance
> sgmii gates).
> - MT8173 apmixedsys: uses mtk_clk_register_ref2usb_tx() and custom
> divider registration.
> - MT8188/MT8195 topckgen: call devm_clk_hw_register_mux() and register
> a notifier.
> - MT8196 vlpckgen: requires direct register init.
> - MT8365 apmixedsys: uses devm_clk_hw_register_gate().
>
> Patches 1-6 are based on
> "[PATCH v2 0/6] clk: mediatek: fix memory leak on module removal"
> (In addition fixed a compilation error in mt8173-infracfg)
> https://lore.kernel.org/linux-mediatek/20260707074839.240676-1-akkun11.open@gmail.com/
>
> Patch 5 fixes the same issue mentioned below
> "[PATCH] clk: mediatek: clk-mt8173-apmixedsys: Invoke platform_set_drvdata on probe"
> https://lore.kernel.org/linux-mediatek/20261010160134.112136-1-l.scorcia@gmail.com/
>
> Patch 12 is based on
> "[PATCH 1/3] clk: mediatek: clk-mtk: Add cpumux support to common probe/remove helpers"
> https://lore.kernel.org/lkml/20260304181024.738391-1-akkun11.open@gmail.com/
>
> Changes in v2:
> - Add two new fixes "Fix index in composite clock unwind path" and
> "Fix memory leak in mtk_clk_register_gate()".
> - Add new refactor "return 0 instead of r in __mtk_clk_simple_probe()"
> - Fix missing `.data = &apmixed_desc` in the MT8167 and MT8195
> apmixedsys drivers.
> - Fix PLL registration and unregistration when
> CONFIG_COMMON_CLK_MEDIATEK_FHCTL is disabled.
> - Fix child-device population logic.
> - Clarify the rationale in the SoC conversion commit messages.
> - Minor fixes to several commit messages.
> - Rebased onto `24a19b953e2a ("Linux 7.3-rc7")`
> from `075b74841bd0 ("Linux 7.2-rc6")`
>
> Link to v1:
> https://lore.kernel.org/linux-mediatek/20260803141659.559129-1-akkun11.open@gmail.com/T/
>
> Akari Tsuyukusa (35):
> clk: mediatek: mt2712: Fix memory leak on module removal
> clk: mediatek: mt6795: Fix memory leak on module removal
> clk: mediatek: mt7622: Fix memory leak on module removal
> clk: mediatek: mt8135: Fix memory leak on module removal
> clk: mediatek: mt8173: Fix memory leak on module removal
> clk: mediatek: mt8192: Fix memory leak on module removal
> clk: mediatek: mt6735: Add missing MODULE_DEVICE_TABLE()
> clk: mediatek: mt7988-apmixed: Add missing MODULE_DEVICE_TABLE()
> clk: mediatek: Fix index in composite clock unwind path
> clk: mediatek: Fix memory leak in mtk_clk_register_gate()
> clk: mediatek: return 0 instead of r in __mtk_clk_simple_probe()
> clk: mediatek: Add cpumux support to common probe/remove helpers
> clk: mediatek: Add PLL support to common probe/remove helpers
> clk: mediatek: Add child-device population to probe/remove helpers
> clk: mediatek: Add FHCTL support to common probe/remove helpers
> clk: mediatek: mt2701: Switch to common probe/remove helpers
> clk: mediatek: mt2712-apmixedsys: Switch to common probe/remove
> helpers
> clk: mediatek: mt6735-apmixedsys: Switch to common probe/remove
> helpers
> clk: mediatek: mt6779: Switch to common probe/remove helpers
> clk: mediatek: mt6795: Switch to common probe/remove helpers
> clk: mediatek: mt6797: Switch to common probe/remove helpers
> clk: mediatek: mt7622: Switch to common probe/remove helpers
> clk: mediatek: mt7981-apmixed: Switch to common probe/remove helpers
> clk: mediatek: mt7986-apmixed: Switch to common probe/remove helpers
> clk: mediatek: mt7988-apmixed: Switch to common probe/remove helpers
> clk: mediatek: mt8135-apmixedsys: Switch to common probe/remove
> helpers
> clk: mediatek: mt8167-apmixedsys: Switch to common probe/remove
> helpers
> clk: mediatek: mt8173-infracfg: Switch to common probe/remove helpers
> clk: mediatek: mt8183: Switch to common probe/remove helpers
> clk: mediatek: mt8186-apmixedsys: Switch to common probe/remove
> helpers
> clk: mediatek: mt8188-apmixedsys: Switch to common probe/remove
> helpers
> clk: mediatek: mt8192: Switch to common probe/remove helpers
> clk: mediatek: mt8195: Switch to common probe/remove helpers
> clk: mediatek: mt8196: Switch to common probe/remove helpers
> clk: mediatek: mt8516-apmixedsys: Switch to common probe/remove
> helpers
>
> drivers/clk/mediatek/Kconfig | 34 +--
> drivers/clk/mediatek/clk-gate.c | 4 +-
> drivers/clk/mediatek/clk-mt2701-aud.c | 35 +--
> drivers/clk/mediatek/clk-mt2701.c | 233 +++++--------------
> drivers/clk/mediatek/clk-mt2712-apmixedsys.c | 48 +---
> drivers/clk/mediatek/clk-mt6735-apmixedsys.c | 51 +---
> drivers/clk/mediatek/clk-mt6735-imgsys.c | 1 +
> drivers/clk/mediatek/clk-mt6735-mfgcfg.c | 1 +
> drivers/clk/mediatek/clk-mt6779.c | 124 ++--------
> drivers/clk/mediatek/clk-mt6795-apmixedsys.c | 2 +
> drivers/clk/mediatek/clk-mt6795-infracfg.c | 70 +-----
> drivers/clk/mediatek/clk-mt6795-pericfg.c | 71 +-----
> drivers/clk/mediatek/clk-mt6797.c | 140 ++---------
> drivers/clk/mediatek/clk-mt7622-apmixedsys.c | 60 +----
> drivers/clk/mediatek/clk-mt7622-aud.c | 35 +--
> drivers/clk/mediatek/clk-mt7622-infracfg.c | 70 +-----
> drivers/clk/mediatek/clk-mt7981-apmixed.c | 37 +--
> drivers/clk/mediatek/clk-mt7986-apmixed.c | 37 +--
> drivers/clk/mediatek/clk-mt7988-apmixed.c | 40 +---
> drivers/clk/mediatek/clk-mt8135-apmixedsys.c | 48 +---
> drivers/clk/mediatek/clk-mt8167-apmixedsys.c | 58 ++---
> drivers/clk/mediatek/clk-mt8173-apmixedsys.c | 2 +
> drivers/clk/mediatek/clk-mt8173-infracfg.c | 98 ++------
> drivers/clk/mediatek/clk-mt8183-apmixedsys.c | 51 +---
> drivers/clk/mediatek/clk-mt8183-audio.c | 26 +--
> drivers/clk/mediatek/clk-mt8186-apmixedsys.c | 59 +----
> drivers/clk/mediatek/clk-mt8188-apmixedsys.c | 60 +----
> drivers/clk/mediatek/clk-mt8192-apmixedsys.c | 67 ++----
> drivers/clk/mediatek/clk-mt8192-aud.c | 26 +--
> drivers/clk/mediatek/clk-mt8195-apmixedsys.c | 75 ++----
> drivers/clk/mediatek/clk-mt8195-apusys_pll.c | 49 +---
> drivers/clk/mediatek/clk-mt8196-apmixedsys.c | 67 +-----
> drivers/clk/mediatek/clk-mt8196-mcu.c | 96 +++-----
> drivers/clk/mediatek/clk-mt8196-mfg.c | 84 ++-----
> drivers/clk/mediatek/clk-mt8516-apmixedsys.c | 42 +---
> drivers/clk/mediatek/clk-mtk.c | 90 ++++++-
> drivers/clk/mediatek/clk-mtk.h | 12 +
> 37 files changed, 496 insertions(+), 1607 deletions(-)
>
More information about the Linux-mediatek
mailing list