From nobody Mon Jun 15 00:20: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 35FF523EAB7; Tue, 7 Apr 2026 07:30:36 +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=1775547039; cv=none; b=freQCK1zO4QtKc/yIIUQbk2wUl9QwmDuj75sBjeooITi07/lCesJc0omi2QHAMbIAFj1CM8NEIU9JtkGMTvuapexa+r5XX525RaFutsAFZzT/l74mYOZXxE28B0uO/8cCYQCIvMi01+DTRBl7k+kng4cDwq4sp3gOCf5w44yWFU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775547039; c=relaxed/simple; bh=yjEIeBu3zw1GrAxJETtc3T4Q9Baq4l9orHWwIj84e5w=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=q0rZ5YgXd8Z+yQN9cvtZXB0v2qntgPfWWznptGGp4teoxPMqLORrN9jl3ZHGNVRoVag0A1sOL5aiIXX/K3BeV/47YNj3/1x3dP5M4zjJfWqCxjke3GGQxN0KEBGtquym65eFBO1tV+5vwJmNajDELuK/cfwPWmAiI3YSfQOip2E= 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: a8ed727e325311f1aa26b74ffac11d73-20260407 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.12,REQID:c96a075b-4a0c-43b4-b692-e8c37c25f802,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:e7bac3a,CLOUDID:2df466a2af49398e4708298c405b112c,BulkI D:nil,BulkQuantity:0,Recheck:0,SF: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,OSA: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: a8ed727e325311f1aa26b74ffac11d73-20260407 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 1426789851; Tue, 07 Apr 2026 15:30:32 +0800 From: Pei Xiao To: hayashi.kunihiko@socionext.com, mhiramat@kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: broonie@kernel.org, Pei Xiao Subject: [PATCH] spi: uniphier: Simplify clock handling with devm_clk_get_enabled() Date: Tue, 7 Apr 2026 15:30:28 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 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 the clock. This removes the need for explicit clock enable and disable calls, as the managed API automatically handles clock disabling on device removal or probe failure. Remove the now-unnecessary clk_disable_unprepare() calls from the probe error path and the remove callback. Adjust error labels accordingly. Signed-off-by: Pei Xiao Reviewed-by: Kunihiko Hayashi --- drivers/spi/spi-uniphier.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/spi/spi-uniphier.c b/drivers/spi/spi-uniphier.c index 9e1d364a6198..1b815ee2ed1b 100644 --- a/drivers/spi/spi-uniphier.c +++ b/drivers/spi/spi-uniphier.c @@ -666,28 +666,24 @@ static int uniphier_spi_probe(struct platform_device = *pdev) } priv->base_dma_addr =3D res->start; =20 - priv->clk =3D devm_clk_get(&pdev->dev, NULL); + priv->clk =3D devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(priv->clk)) { dev_err(&pdev->dev, "failed to get clock\n"); ret =3D PTR_ERR(priv->clk); goto out_host_put; } =20 - ret =3D clk_prepare_enable(priv->clk); - if (ret) - goto out_host_put; - irq =3D platform_get_irq(pdev, 0); if (irq < 0) { ret =3D irq; - goto out_disable_clk; + goto out_host_put; } =20 ret =3D devm_request_irq(&pdev->dev, irq, uniphier_spi_handler, 0, "uniphier-spi", priv); if (ret) { dev_err(&pdev->dev, "failed to request IRQ\n"); - goto out_disable_clk; + goto out_host_put; } =20 init_completion(&priv->xfer_done); @@ -716,7 +712,7 @@ static int uniphier_spi_probe(struct platform_device *p= dev) if (IS_ERR_OR_NULL(host->dma_tx)) { if (PTR_ERR(host->dma_tx) =3D=3D -EPROBE_DEFER) { ret =3D -EPROBE_DEFER; - goto out_disable_clk; + goto out_host_put; } host->dma_tx =3D NULL; dma_tx_burst =3D INT_MAX; @@ -766,9 +762,6 @@ static int uniphier_spi_probe(struct platform_device *p= dev) host->dma_tx =3D NULL; } =20 -out_disable_clk: - clk_disable_unprepare(priv->clk); - out_host_put: spi_controller_put(host); return ret; @@ -777,14 +770,11 @@ static int uniphier_spi_probe(struct platform_device = *pdev) static void uniphier_spi_remove(struct platform_device *pdev) { struct spi_controller *host =3D platform_get_drvdata(pdev); - struct uniphier_spi_priv *priv =3D spi_controller_get_devdata(host); =20 if (host->dma_tx) dma_release_channel(host->dma_tx); if (host->dma_rx) dma_release_channel(host->dma_rx); - - clk_disable_unprepare(priv->clk); } =20 static const struct of_device_id uniphier_spi_match[] =3D { --=20 2.25.1