[PATCH v8 00/16] clk: provide new devm helpers for prepared and enabled clocks

Andy Shevchenko andy.shevchenko at gmail.com
Tue Mar 15 11:03:44 PDT 2022


On Mon, Mar 14, 2022 at 5:14 PM Uwe Kleine-König
<u.kleine-koenig at pengutronix.de> wrote:
>
> Hello,
>
> this is another try to convince the relevant people that
> devm_clk_get_enabled() is a nice idea. Compared to v7 (back in May 2021) this
> series is rebased to v5.17-rc8 and converts quite some drivers that open code
> devm_clk_get_enabled() up to now (patches #3 - #11).
>
> A concern about devm_clk_get_enabled() in v7 was that it helps people to be
> lazy and I agree that in some situations when devm_clk_get_enabled() is used it
> would be more efficient and sensible to care to only enable the clk when really
> needed.
>
> On the other hand, the function is right for some users, e.g. the watchdog
> drivers. For the others it's not so simple to judge. Given that there are a
> lot of drivers that are lazy even if doing so is some effort (i.e. calling
> clk_prepare_enable() and devm_add_action()) convinces me, that introducing the
> function family is sensible. (And if you want to work on these drivers,
> grepping for devm_clk_get_enabled gives you a few candidates once the
> series is in :-)

FWIW,
Reviewed-by: Andy Shevchenko <andy.shevchenko at gmail.com>
for drivers/iio

Thanks for doing this!

> Otherwise looking at the diffstat of this series:
>
>  48 files changed, 257 insertions(+), 851 deletions(-)
>
> is quite convincing. Just the first two patches (which introduce the new
> functions) account for
>
>  2 files changed, 169 insertions(+), 17 deletions(-)
>
> . A rough third of the added lines is documentation. The rest is driver
> updates which then has:
>
>  46 files changed, 88 insertions(+), 834 deletions(-)
>
> which makes a really nice cleanup.
>
> The series is build-tested on arm64, m68k, powerpc, riscv, s390, sparc64
> and x86_64 using an allmodconfig.
>
> Best regards
> Uwe
>
> Uwe Kleine-König (16):
>   clk: generalize devm_clk_get() a bit
>   clk: Provide new devm_clk helpers for prepared and enabled clocks
>   hwmon: Make use of devm_clk_get_enabled()
>   iio: Make use of devm_clk_get_enabled()
>   hwrng: meson - Don't open-code devm_clk_get_optional_enabled()
>   bus: bt1: Don't open code devm_clk_get_enabled()
>   gpio: vf610: Simplify error handling in probe
>   drm/meson: dw-hdmi: Don't open code devm_clk_get_enabled()
>   rtc: ingenic: Simplify using devm_clk_get_enabled()
>   clk: meson: axg-audio: Don't duplicate devm_clk_get_enabled()
>   watchdog: Make use of devm_clk_get_enabled()
>   pwm: atmel: Simplify using devm_clk_get_prepared()
>   rtc: at91sam9: Simplify using devm_clk_get_enabled()
>   i2c: imx: Simplify using devm_clk_get_enabled()
>   spi: davinci: Simplify using devm_clk_get_enabled()
>   dmaengine: lgm: Fix error handling
>
>  drivers/bus/bt1-apb.c                 | 23 +------
>  drivers/bus/bt1-axi.c                 | 23 +------
>  drivers/char/hw_random/meson-rng.c    | 20 +-----
>  drivers/clk/clk-devres.c              | 96 ++++++++++++++++++++++-----
>  drivers/clk/meson/axg-audio.c         | 36 ++--------
>  drivers/dma/lgm/lgm-dma.c             |  8 +--
>  drivers/gpio/gpio-vf610.c             | 45 +++----------
>  drivers/gpu/drm/meson/meson_dw_hdmi.c | 48 +++++---------
>  drivers/hwmon/axi-fan-control.c       | 15 +----
>  drivers/hwmon/ltc2947-core.c          | 17 +----
>  drivers/hwmon/mr75203.c               | 26 +-------
>  drivers/hwmon/sparx5-temp.c           | 19 +-----
>  drivers/i2c/busses/i2c-imx.c          | 12 +---
>  drivers/iio/adc/ad7124.c              | 15 +----
>  drivers/iio/adc/ad7768-1.c            | 17 +----
>  drivers/iio/adc/ad9467.c              | 17 +----
>  drivers/iio/adc/ingenic-adc.c         | 15 +----
>  drivers/iio/adc/lpc18xx_adc.c         | 18 +----
>  drivers/iio/adc/rockchip_saradc.c     | 44 +-----------
>  drivers/iio/adc/ti-ads131e08.c        | 19 +-----
>  drivers/iio/adc/xilinx-ams.c          | 15 +----
>  drivers/iio/adc/xilinx-xadc-core.c    | 18 +----
>  drivers/iio/frequency/adf4371.c       | 17 +----
>  drivers/iio/frequency/admv1013.c      | 15 +----
>  drivers/iio/frequency/adrf6780.c      | 16 +----
>  drivers/iio/imu/adis16475.c           | 15 +----
>  drivers/pwm/pwm-atmel.c               | 16 +----
>  drivers/rtc/rtc-at91sam9.c            | 22 ++----
>  drivers/rtc/rtc-jz4740.c              | 21 +-----
>  drivers/spi/spi-davinci.c             | 11 +--
>  drivers/watchdog/cadence_wdt.c        | 17 +----
>  drivers/watchdog/davinci_wdt.c        | 18 +----
>  drivers/watchdog/imgpdc_wdt.c         | 31 +--------
>  drivers/watchdog/imx2_wdt.c           | 15 +----
>  drivers/watchdog/imx7ulp_wdt.c        | 15 +----
>  drivers/watchdog/loongson1_wdt.c      | 17 +----
>  drivers/watchdog/lpc18xx_wdt.c        | 30 +--------
>  drivers/watchdog/meson_gxbb_wdt.c     | 16 +----
>  drivers/watchdog/of_xilinx_wdt.c      | 16 +----
>  drivers/watchdog/pic32-dmt.c          | 15 +----
>  drivers/watchdog/pic32-wdt.c          | 17 +----
>  drivers/watchdog/pnx4008_wdt.c        | 15 +----
>  drivers/watchdog/qcom-wdt.c           | 16 +----
>  drivers/watchdog/rtd119x_wdt.c        | 16 +----
>  drivers/watchdog/st_lpc_wdt.c         | 16 +----
>  drivers/watchdog/stm32_iwdg.c         | 31 +--------
>  drivers/watchdog/visconti_wdt.c       | 18 +----
>  include/linux/clk.h                   | 90 ++++++++++++++++++++++++-
>  48 files changed, 257 insertions(+), 851 deletions(-)
>
>
> base-commit: 09688c0166e76ce2fb85e86b9d99be8b0084cdf9
> --
> 2.35.1
>


-- 
With Best Regards,
Andy Shevchenko



More information about the linux-amlogic mailing list