From nobody Tue Apr 7 02:35:29 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 64F71393DD3; Tue, 17 Mar 2026 07:42:18 +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=1773733343; cv=none; b=DyhWDZ52X7Zi0fFXl9Fk+nyqpo2+6gqgnMxEZic6L2dSyecZguXkw4MNenZtWA9jZQtdvEPd0XjiBmsBWgRDoBJ5FSZEkk0RVOyOSai49brmpCHNTnL9wtx3uXpPj080DEC3HNPxmoucg3T1Ef8HjeXXl3vHpdXigIcY2NqKCD0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773733343; c=relaxed/simple; bh=eXTrl5yuCR80BEX/jVe0wZhoJHYDsPA0emLVtAXMXeE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gd3EJcHXK/Adi9WoEjcCpQqeHtp4T5Pz9sikM26KC6fe02WjVagAU+ZiE6sa7NXCXPKJT6VJ7JWmM7XC7eqXpSLkhb9WN+b1fEqBz5hwVeumDhxhJ6KR2RWDPhY6SHAEKoecnZgll4EE9zpYZGrorVlCcc4aZm/NZFeKxhoioiw= 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: cd4e6bc621d411f1a21c59e7364eecb8-20260317 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.11,REQID:8098d75f-8faf-4585-912d-7b255aaef195,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:7a34c2cb63c830de6c9b99d95178e134,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: cd4e6bc621d411f1a21c59e7364eecb8-20260317 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 1235746684; Tue, 17 Mar 2026 15:42:08 +0800 From: Pei Xiao To: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.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 Cc: Pei Xiao Subject: [PATCH v3 11/17] spi: st: Use helper function devm_clk_get_enabled() Date: Tue, 17 Mar 2026 15:41:53 +0800 Message-Id: <96c8fbf6840c71f29ebcf37d7ffc68f297601c8a.1773733017.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" devm_clk_get() and clk_prepare_enable() can now be replaced by devm_clk_get_enabled() when driver enables the clocks. Moreover, it is no longer necessary to unprepare and disable the clocks explicitly. Simplify code. Signed-off-by: Pei Xiao --- drivers/spi/spi-st-ssc4.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/spi/spi-st-ssc4.c b/drivers/spi/spi-st-ssc4.c index b173ef70d77e..0d653986499c 100644 --- a/drivers/spi/spi-st-ssc4.c +++ b/drivers/spi/spi-st-ssc4.c @@ -293,24 +293,20 @@ static int spi_st_probe(struct platform_device *pdev) host->use_gpio_descriptors =3D true; spi_st =3D spi_controller_get_devdata(host); =20 - spi_st->clk =3D devm_clk_get(&pdev->dev, "ssc"); + spi_st->clk =3D devm_clk_get_enabled(&pdev->dev, "ssc"); if (IS_ERR(spi_st->clk)) { dev_err(&pdev->dev, "Unable to request clock\n"); ret =3D PTR_ERR(spi_st->clk); goto put_host; } =20 - ret =3D clk_prepare_enable(spi_st->clk); - if (ret) - goto put_host; - init_completion(&spi_st->done); =20 /* Get resources */ spi_st->base =3D devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(spi_st->base)) { ret =3D PTR_ERR(spi_st->base); - goto clk_disable; + goto put_host; } =20 /* Disable I2C and Reset SSC */ @@ -333,14 +329,14 @@ static int spi_st_probe(struct platform_device *pdev) if (!irq) { dev_err(&pdev->dev, "IRQ missing or invalid\n"); ret =3D -EINVAL; - goto clk_disable; + goto put_host; } =20 ret =3D devm_request_irq(&pdev->dev, irq, spi_st_irq, 0, pdev->name, spi_st); if (ret) { dev_err(&pdev->dev, "Failed to request irq %d\n", irq); - goto clk_disable; + goto put_host; } =20 /* by default the device is on */ @@ -359,8 +355,6 @@ static int spi_st_probe(struct platform_device *pdev) =20 rpm_disable: pm_runtime_disable(&pdev->dev); -clk_disable: - clk_disable_unprepare(spi_st->clk); put_host: spi_controller_put(host); return ret; @@ -373,8 +367,6 @@ static void spi_st_remove(struct platform_device *pdev) =20 pm_runtime_disable(&pdev->dev); =20 - clk_disable_unprepare(spi_st->clk); - pinctrl_pm_select_sleep_state(&pdev->dev); } =20 --=20 2.25.1