From nobody Mon Apr 6 17:29:05 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14391387562; Thu, 19 Mar 2026 02:04:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773885873; cv=none; b=VisCMw5J9wHBeLgjTU2177kh1ls/oeuJHangLf3yaUpXTv2PJ9vdwxcLl4uNoYnuDjr7/vxva1A3yZvDZQDKMXRqxjA45D9uALBiKYRExRa5rTyhn76jgXwJ5V4uBQkL+dp4uosiiBHuzbYOsjvjNsiVsFYJD6LZhm6y1GrgrEA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773885873; c=relaxed/simple; bh=ny9onmUEXl99P24ZZ2Ce75o7Vng9fH41KywX7ddFhok=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MdyDlFvLjFuvbEctLYxY8ZBcQah5Z9KoDDPgHKxpfTc/3FcAYlSGX4xjRRMhdXzPASY8vEX/Zj4VeOBEVmyGDSfIvSvudlTpG2bSw7Qzs5/y+JQ9XjCAfGR2FEw48hP3o+eZdQmEYxdjW+5V/as0ck1ZSJ9kvL08ObR3GLUELGQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: f2eb22a2233711f1a21c59e7364eecb8-20260319 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.11,REQID:f112277f-fc1f-4f34-9138-d4d22d580cc8,IP:0,U RL:0,TC:0,Content:-25,EDM:25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:0 X-CID-META: VersionHash:89c9d04,CLOUDID:d0c6f5da407226d4688d1d01a9ebe28e,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850|898,TC:nil,Content:0|15|50 ,EDM:5,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OS A:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: f2eb22a2233711f1a21c59e7364eecb8-20260319 X-User: xiaopei01@kylinos.cn Received: from localhost.localdomain [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 693530950; Thu, 19 Mar 2026 10:04:23 +0800 From: Pei Xiao To: linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, openbmc@lists.ozlabs.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, broonie@kernel.org, Frank.Li@nxp.com, amelie.delaunay@foss.st.com Cc: Pei Xiao Subject: [PATCH v5 08/17] spi: rockchip-sfc: Simplify clock handling with devm_clk_get_enabled() Date: Thu, 19 Mar 2026 10:04:04 +0800 Message-Id: <863ab1ddc4f3b9a25c0bf79e1581b65359cef6c3.1773885292.git.xiaopei01@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace devm_clk_get() followed by clk_prepare_enable() with devm_clk_get_enabled() for both the interface clock "clk_sfc" and the AHB clock "hclk_sfc". This reduces boilerplate code and error handling, as the managed API automatically disables the clocks when the device is removed or if probe fails. Remove the now-unnecessary clk_disable_unprepare() calls from the probe error paths and the remove callback. Adjust error handling labels accordingly. Signed-off-by: Pei Xiao --- drivers/spi/spi-rockchip-sfc.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/drivers/spi/spi-rockchip-sfc.c b/drivers/spi/spi-rockchip-sfc.c index 174995042f53..b32b7c015edb 100644 --- a/drivers/spi/spi-rockchip-sfc.c +++ b/drivers/spi/spi-rockchip-sfc.c @@ -635,13 +635,13 @@ static int rockchip_sfc_probe(struct platform_device = *pdev) return PTR_ERR(sfc->regbase); =20 if (!has_acpi_companion(&pdev->dev)) - sfc->clk =3D devm_clk_get(&pdev->dev, "clk_sfc"); + sfc->clk =3D devm_clk_get_enabled(&pdev->dev, "clk_sfc"); if (IS_ERR(sfc->clk)) return dev_err_probe(&pdev->dev, PTR_ERR(sfc->clk), "Failed to get sfc interface clk\n"); =20 if (!has_acpi_companion(&pdev->dev)) - sfc->hclk =3D devm_clk_get(&pdev->dev, "hclk_sfc"); + sfc->hclk =3D devm_clk_get_enabled(&pdev->dev, "hclk_sfc"); if (IS_ERR(sfc->hclk)) return dev_err_probe(&pdev->dev, PTR_ERR(sfc->hclk), "Failed to get sfc ahb clk\n"); @@ -657,18 +657,6 @@ static int rockchip_sfc_probe(struct platform_device *= pdev) =20 sfc->use_dma =3D !of_property_read_bool(sfc->dev->of_node, "rockchip,sfc-= no-dma"); =20 - ret =3D clk_prepare_enable(sfc->hclk); - if (ret) { - dev_err(&pdev->dev, "Failed to enable ahb clk\n"); - goto err_hclk; - } - - ret =3D clk_prepare_enable(sfc->clk); - if (ret) { - dev_err(&pdev->dev, "Failed to enable interface clk\n"); - goto err_clk; - } - /* Find the irq */ ret =3D platform_get_irq(pdev, 0); if (ret < 0) @@ -730,10 +718,6 @@ static int rockchip_sfc_probe(struct platform_device *= pdev) pm_runtime_set_suspended(dev); pm_runtime_dont_use_autosuspend(dev); err_irq: - clk_disable_unprepare(sfc->clk); -err_clk: - clk_disable_unprepare(sfc->hclk); -err_hclk: return ret; } =20 @@ -747,8 +731,6 @@ static void rockchip_sfc_remove(struct platform_device = *pdev) DMA_BIDIRECTIONAL); free_pages((unsigned long)sfc->buffer, get_order(sfc->max_iosize)); =20 - clk_disable_unprepare(sfc->clk); - clk_disable_unprepare(sfc->hclk); } =20 #ifdef CONFIG_PM --=20 2.25.1