From nobody Mon Apr 6 21:56:37 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 8CF7928030E; Wed, 18 Mar 2026 02:40:24 +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=1773801627; cv=none; b=OfnubVBCXf96929aDLZYKCRx/ihOClaWUCl0bNf4VFPNRH2r9Qk0KkNyMgvaSU3OxS+bld2BFkbp+hxhni7jApFHAYVqatZu+Wc3Xq/as34HgZ0M94zsmzU5pZ8HotvhqnSEVnKvTIetTwVMwctddf7c1u7ar32Ud/qOaLKk7Qk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773801627; c=relaxed/simple; bh=ny9onmUEXl99P24ZZ2Ce75o7Vng9fH41KywX7ddFhok=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KZyvVfY34j2DsJVPeRG1s4nZNeF8ke8S3Nq1MTN3UJ0QHsBp0X3s77i7Ot8J+pqe8xOU4/13gTC+HcXfdetEOz1oLp5HsPWp/iFsFVBaxweZIW8N5YTXzFx0okskAea0OahLu5qjfHbBH6X6kU9z4waTiRQ0j/S0RURTvNfJdHw= 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: cad0c962227311f1a21c59e7364eecb8-20260318 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.11,REQID:c8e9e33f-3f09-404a-a93b-26252d6fa9a0,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:d1e408596d18c2aa223fed187124feaf,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: cad0c962227311f1a21c59e7364eecb8-20260318 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 867970682; Wed, 18 Mar 2026 10:40:14 +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 Cc: Pei Xiao Subject: [PATCH v4 08/17] spi: rockchip-sfc: Simplify clock handling with devm_clk_get_enabled() Date: Wed, 18 Mar 2026 10:39:58 +0800 Message-Id: <7a246c3e4de6b994d84941e0a6f49bb94f4a7608.1773801401.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