Message ID | 20230817024509.3951629-1-lizetao1@huawei.com (mailing list archive) |
---|---|
Headers | show |
Series | mtd: Use devm_clk_get_enabled() to simplify the drivers. | expand |
Commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared and enabled clocks") provides a new helper function for prepared and enabled clocks when a driver keeps a clock prepared (or enabled) during the whole lifetime of the driver. So where drivers get clocks and enable them immediately, it can be combined into a single function devm_clk_get_*(). Moreover, the unprepare and disable function has been registered to devm_clk_state, and before devm_clk_state is released, the clocks will be unprepareed and disable, so it is unnecessary to unprepare and disable clock explicitly when remove drivers or in the error handling path. Change log: v2: - Modify the format of the reference commit, use "since" instead of "after". - Drop the helper functions mtk_nfc_enable_clk() and mtk_nfc_disable_clk(), because both of them now have a single user. - Add a new patch, replace devm_clk_get_optional() + clk_prepare_enable() with devm_clk_get_optional_enabled(). v1: https://lore.kernel.org/all/20230817024509.3951629-1-lizetao1@huawei.com/ Li Zetao (12): mtd: spear_smi: Use helper function devm_clk_get_enabled() mtd: rawnand: arasan: Use helper function devm_clk_get_enabled() mtd: rawnand: fsmc: Use helper function devm_clk_get_enabled() mtd: rawnand: intel: Use helper function devm_clk_get_enabled() mtd: rawnand: lpc32xx_slc: Use helper function devm_clk_get_enabled() mtd: rawnand: mpc5121: Use helper function devm_clk_get_enabled() mtd: rawnand: mtk: Use helper function devm_clk_get_enabled() mtd: rawnand: stm32_fmc2: Use helper function devm_clk_get_enabled() mtd: rawnand: sunxi: Use helper function devm_clk_get_enabled() mtd: rawnand: vf610_nfc: Use helper function devm_clk_get_enabled() mtd: spi-nor: nxp-spifi: Use helper function devm_clk_get_enabled() mtd: rawnand: orion: Use helper function devm_clk_get_optional_enabled() drivers/mtd/devices/spear_smi.c | 15 +---- drivers/mtd/nand/raw/arasan-nand-controller.c | 29 ++------- drivers/mtd/nand/raw/fsmc_nand.c | 12 +--- drivers/mtd/nand/raw/intel-nand-controller.c | 15 +---- drivers/mtd/nand/raw/lpc32xx_slc.c | 12 +--- drivers/mtd/nand/raw/mpc5121_nfc.c | 11 +--- drivers/mtd/nand/raw/mtk_nand.c | 62 ++++++------------- drivers/mtd/nand/raw/orion_nand.c | 22 ++----- drivers/mtd/nand/raw/stm32_fmc2_nand.c | 17 ++--- drivers/mtd/nand/raw/sunxi_nand.c | 29 ++------- drivers/mtd/nand/raw/vf610_nfc.c | 29 +++------ drivers/mtd/spi-nor/controllers/nxp-spifi.c | 33 ++-------- 12 files changed, 67 insertions(+), 219 deletions(-)
On Fri, 18 Aug 2023 15:46:30 +0800, Li Zetao wrote: > Commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared > and enabled clocks") provides a new helper function for prepared and > enabled clocks when a driver keeps a clock prepared (or enabled) during > the whole lifetime of the driver. So where drivers get clocks and enable > them immediately, it can be combined into a single function > devm_clk_get_*(). Moreover, the unprepare and disable function > has been registered to devm_clk_state, and before devm_clk_state is > released, the clocks will be unprepareed and disable, so it is unnecessary > to unprepare and disable clock explicitly when remove drivers or in the > error handling path. > > [...] Applied to git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git, spi-nor/next branch. Thanks! [11/12] mtd: spi-nor: nxp-spifi: Use helper function devm_clk_get_enabled() https://git.kernel.org/mtd/c/69d50d0461a1 Cheers,