clk: mediatek: clk-gate: Propagate struct device with mtk_clk_register_gates()
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Fri, 20 Jan 2023 09:20:33 +0000 (10:20 +0100)
committerStephen Boyd <sboyd@kernel.org>
Tue, 31 Jan 2023 00:44:56 +0000 (16:44 -0800)
commit20498d52c9c1a68b1d92c42bce1dc893d3e74f30
treefee8bfa7f0a0e227a73afab14ea1cc1a97c7f276
parentfdc325c8f79cb4155009db8394db19793c4d07cd
clk: mediatek: clk-gate: Propagate struct device with mtk_clk_register_gates()

Commit e4c23e19aa2a ("clk: mediatek: Register clock gate with device")
introduces a helper function for the sole purpose of propagating a
struct device pointer to the clk API when registering the mtk-gate
clocks to take advantage of Runtime PM when/where needed and where
a power domain is defined in devicetree.

Function mtk_clk_register_gates() then becomes a wrapper around the
new mtk_clk_register_gates_with_dev() function that will simply pass
NULL as struct device: this is essential when registering drivers
with CLK_OF_DECLARE instead of as a platform device, as there will
be no struct device to pass... but we can as well simply have only
one function that always takes such pointer as a param and pass NULL
when unavoidable.

This commit removes the mtk_clk_register_gates() wrapper and renames
mtk_clk_register_gates_with_dev() to the former and all of the calls
to either of the two functions were fixed in all drivers in order to
reflect this change; also, to improve consistency with other kernel
functions, the pointer to struct device was moved as the first param.

Since a lot of MediaTek clock drivers are actually registering as a
platform device, but were still registering the mtk-gate clocks
without passing any struct device to the clock framework, they've
been changed to pass a valid one now, as to make all those platforms
able to use runtime power management where available.

While at it, some much needed indentation changes were also done.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: Markus Schneider-Pargmann <msp@baylibre.com>
Tested-by: Miles Chen <miles.chen@mediatek.com>
Link: https://lore.kernel.org/r/20230120092053.182923-4-angelogioacchino.delregno@collabora.com
Tested-by: Mingming Su <mingming.su@mediatek.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
52 files changed:
drivers/clk/mediatek/clk-gate.c
drivers/clk/mediatek/clk-gate.h
drivers/clk/mediatek/clk-mt2701-aud.c
drivers/clk/mediatek/clk-mt2701-eth.c
drivers/clk/mediatek/clk-mt2701-g3d.c
drivers/clk/mediatek/clk-mt2701-hif.c
drivers/clk/mediatek/clk-mt2701-mm.c
drivers/clk/mediatek/clk-mt2701.c
drivers/clk/mediatek/clk-mt2712-mm.c
drivers/clk/mediatek/clk-mt2712.c
drivers/clk/mediatek/clk-mt6765.c
drivers/clk/mediatek/clk-mt6779-mm.c
drivers/clk/mediatek/clk-mt6779.c
drivers/clk/mediatek/clk-mt6795-infracfg.c
drivers/clk/mediatek/clk-mt6795-mm.c
drivers/clk/mediatek/clk-mt6795-pericfg.c
drivers/clk/mediatek/clk-mt6797-mm.c
drivers/clk/mediatek/clk-mt6797.c
drivers/clk/mediatek/clk-mt7622-aud.c
drivers/clk/mediatek/clk-mt7622-eth.c
drivers/clk/mediatek/clk-mt7622-hif.c
drivers/clk/mediatek/clk-mt7622.c
drivers/clk/mediatek/clk-mt7629-eth.c
drivers/clk/mediatek/clk-mt7629-hif.c
drivers/clk/mediatek/clk-mt7629.c
drivers/clk/mediatek/clk-mt7986-eth.c
drivers/clk/mediatek/clk-mt7986-infracfg.c
drivers/clk/mediatek/clk-mt8135.c
drivers/clk/mediatek/clk-mt8167-aud.c
drivers/clk/mediatek/clk-mt8167-img.c
drivers/clk/mediatek/clk-mt8167-mfgcfg.c
drivers/clk/mediatek/clk-mt8167-mm.c
drivers/clk/mediatek/clk-mt8167-vdec.c
drivers/clk/mediatek/clk-mt8167.c
drivers/clk/mediatek/clk-mt8173-mm.c
drivers/clk/mediatek/clk-mt8173.c
drivers/clk/mediatek/clk-mt8183-audio.c
drivers/clk/mediatek/clk-mt8183-mm.c
drivers/clk/mediatek/clk-mt8183.c
drivers/clk/mediatek/clk-mt8186-mm.c
drivers/clk/mediatek/clk-mt8192-aud.c
drivers/clk/mediatek/clk-mt8192-mm.c
drivers/clk/mediatek/clk-mt8192.c
drivers/clk/mediatek/clk-mt8195-apmixedsys.c
drivers/clk/mediatek/clk-mt8195-topckgen.c
drivers/clk/mediatek/clk-mt8195-vdo0.c
drivers/clk/mediatek/clk-mt8195-vdo1.c
drivers/clk/mediatek/clk-mt8365-mm.c
drivers/clk/mediatek/clk-mt8365.c
drivers/clk/mediatek/clk-mt8516-aud.c
drivers/clk/mediatek/clk-mt8516.c
drivers/clk/mediatek/clk-mtk.c