From patchwork Mon Mar 14 14:16:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 12780262 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8CC6EC433F5 for ; Mon, 14 Mar 2022 14:20:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=v5w+v+TCGXs11UnEDe+Vp53vH0KngjjqEdtiix4VIG8=; b=GhWhgy7hQtx8Zp 5XP9nGcp3UFEF9ccFZfFlQA7JWkbOSYNrrz0I7ruNwQGOPLQ3hTCMMudWPsyv1P1x5BEVxIRknHrk xAHjaPKXvNrkrFbPYuzLw2nZt45Szz2j32k1G4HbhI+GbQ9jmDfqn6pXwOxDNN+CVVWZ3DiKKhAoh 9Gm2OhT0+OHUOijKsDTHWidANf9MUJviqqn8q5ubkOoCPL8XJIm5Gde1VfCiviCvvpcUrpOMv65uY cbH44JKaErDLPzbC5usma7lxN0E0ls3IQ2SjbUYS86R/Bhl2wFMCyvRWhijhYJn/MVI4I6exZ5HNW 6QFbxK2W+NStU8wJdGjw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nTlYV-005e4n-EA; Mon, 14 Mar 2022 14:20:15 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nTlW9-005clz-47 for linux-amlogic@lists.infradead.org; Mon, 14 Mar 2022 14:17:50 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nTlVQ-0004zI-Ju; Mon, 14 Mar 2022 15:17:04 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1nTlVH-000f2a-PX; Mon, 14 Mar 2022 15:16:54 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1nTlVF-0097aV-Ov; Mon, 14 Mar 2022 15:16:53 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Michael Turquette , Stephen Boyd , Russell King , =?utf-8?q?Nuno_S=C3=A1?= , Jean Delvare , Guenter Roeck , Lars Povlsen , Steen Hegelund , UNGLinuxDriver@microchip.com, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Matt Mackall , Herbert Xu , Greg Kroah-Hartman , Linus Walleij , Bartosz Golaszewski , Neil Armstrong , David Airlie , Daniel Vetter , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Paul Cercueil , Alessandro Zummo , Alexandre Belloni , Wim Van Sebroeck , Claudiu Beznea , Thierry Reding , Lee Jones , Nicolas Ferre , Oleksij Rempel , Shawn Guo , Fabio Estevam , NXP Linux Team , Mark Brown , Vinod Koul Cc: linux-clk@vger.kernel.org, kernel@pengutronix.de, Vladimir Zapolskiy , Heiko Stuebner , Tomislav Denis , Anand Ashok Dumbre , Michal Simek , =?utf-8?q?Andr=C3=A9_Gustavo_Nakago?= =?utf-8?q?mi_Lopez?= , Cai Huoqing , linux-iio@vger.kernel.org, linux-crypto@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-gpio@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mips@vger.kernel.org, linux-rtc@vger.kernel.org, Keguang Zhang , Andy Gross , Bjorn Andersson , Patrice Chotard , Maxime Coquelin , Alexandre Torgue , Nobuhiro Iwamatsu , linux-watchdog@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-pwm@vger.kernel.org, linux-i2c@vger.kernel.org, linux-spi@vger.kernel.org, Amireddy Mallikarjuna reddy , dmaengine@vger.kernel.org Subject: [PATCH v8 00/16] clk: provide new devm helpers for prepared and enabled clocks Date: Mon, 14 Mar 2022 15:16:27 +0100 Message-Id: <20220314141643.22184-1-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5140; i=uwe@kleine-koenig.org; h=from:subject; bh=UyYZYiS1jsIjibZ2MrufsJ1VrXFVRIfOx2nxS5wK9sc=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBiL03mRL8wE3boX5TsxdQb7A/4ALVpT93/3rzycIlB hFpTWs+JATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYi9N5gAKCRDB/BR4rcrsCc4ZB/ 9EDZG3qguuMeWbZAfXaH9prZGcSynBDBtwqLtmnGRt28ZTaarFw88YmZERvpaHjVQ0WPcNKCMjBphZ C/YPMpezXK2TikRkYqr2gsFaWKLwJ5+rqhGqxNSg4wZqzBgxjEgMa4BRbXRgQZvFOb/8ucyk4f/y3U oXCTg8ZOWQwebvd7JJsMztn6aZl6uW9im2ZqZji8vnmZt0yG28aNRWS33RDwWlQzrat//LG5Pb7S41 7uVOkFnphQjm5eRjOvblGRbYIxlM0SEETKun6FycjvR4gk1OvqrePSrWZY01rN3iXQF/v/C3RrHXL6 fzr+e9MLjqZjR6qpuN+DvujbCtKzRp X-Developer-Key: i=uwe@kleine-koenig.org; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-amlogic@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220314_071749_376998_8A9D6810 X-CRM114-Status: GOOD ( 18.18 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org 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 :-) 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 Reviewed-by: Andy Shevchenko