From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 67A363C5826 for ; Thu, 14 May 2026 12:02:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778760157; cv=none; b=mJnsFN+rTQ93BJi2NC3DDDApu6zRxw7wOocYxmbBoHcQjNZNQkEZSgwWkZzq+FJJyBPRfRQCusnNmflHdLVLLfIrduiq7oXmhHjTWz7Beg15N1/gB83YT/sRt8GG65ToLHJzYeB7Z5/yXsmPZ6yekYZOpg++PQE//aaduEBo7Ec= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778760157; c=relaxed/simple; bh=zorYm+Hpa7q8gQM882HZ9sq0ZHOQxg5JMHWbC09FcME=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L/9OPKnDl1tigSNp+UL/zoPAfhwJWBDAN2utWgUYIaA2WFDdp+3Z8ToMr/qcKaOmD05ypHbbxYlOe5mG1sVOihWSnbfGbKU7c/fL9ELKb/J5FjmTIDVDlU/bReA3OU5wvXk+VFr4e+Ic3IlOFyk8vX1PT2+3tbrq9dxgaGkBl4E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qgbDG5c6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qgbDG5c6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9594DC2BCB3; Thu, 14 May 2026 12:02:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778760157; bh=zorYm+Hpa7q8gQM882HZ9sq0ZHOQxg5JMHWbC09FcME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qgbDG5c66xYekdxUGtYVsBUjcsqV9QyfJ/Q4CBtKjRSZHIjpc100GM3IxPqcFfs1/ syqiT4HENtelcsyfNy2NgD/3Qc8a5ST9he82Nlx57ALxoePOaIk/AtHi61tvYhRG2f 3XvQIlNQ5co0RIwHZBSXHYoTMpTtGD6hioEZKDpjxY7pDujCU61BfMns6ETOoFDTBM vlnEfBeEbX5SI4PVtsFhkFGhYiQWVSt+FUvf9B5VSbcfNCo7m10dg4vqlp+q7EebG3 vY9QKb9SQhi3JR9tKJ6uPPt48AQOQKvTfFh/eb6y6HIN2yIn1ePTKMOUlJiy6VtHRE i4ghT08eqknHw== From: Sasha Levin To: stable@vger.kernel.org Cc: Pei Xiao , Kunihiko Hayashi , Mark Brown , Sasha Levin Subject: [PATCH 6.1.y 3/4] spi: uniphier: Simplify clock handling with devm_clk_get_enabled() Date: Thu, 14 May 2026 08:02:32 -0400 Message-ID: <20260514120233.192698-3-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260514120233.192698-1-sashal@kernel.org> References: <2026051213-unsaved-bagpipe-b075@gregkh> <20260514120233.192698-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Pei Xiao [ Upstream commit fdca270f8f87cae2eb5b619234b9dd11a863ce6b ] 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 Link: https://patch.msgid.link/b2deeefd4ef1a4bce71116aabfcb7e81400f6d37.1775546948.git.xiaopei01@kylinos.cn Signed-off-by: Mark Brown Stable-dep-of: 0245435f7772 ("spi: uniphier: fix controller deregistration") Signed-off-by: Sasha Levin --- 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 4a18cf8961947..56dab8117cff2 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 = res->start; - priv->clk = devm_clk_get(&pdev->dev, NULL); + priv->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(priv->clk)) { dev_err(&pdev->dev, "failed to get clock\n"); ret = PTR_ERR(priv->clk); goto out_host_put; } - ret = clk_prepare_enable(priv->clk); - if (ret) - goto out_host_put; - irq = platform_get_irq(pdev, 0); if (irq < 0) { ret = irq; - goto out_disable_clk; + goto out_host_put; } ret = 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; } init_completion(&priv->xfer_done); @@ -717,7 +713,7 @@ static int uniphier_spi_probe(struct platform_device *pdev) if (IS_ERR_OR_NULL(host->dma_tx)) { if (PTR_ERR(host->dma_tx) == -EPROBE_DEFER) { ret = -EPROBE_DEFER; - goto out_disable_clk; + goto out_host_put; } host->dma_tx = NULL; dma_tx_burst = INT_MAX; @@ -767,9 +763,6 @@ static int uniphier_spi_probe(struct platform_device *pdev) host->dma_tx = NULL; } -out_disable_clk: - clk_disable_unprepare(priv->clk); - out_host_put: spi_controller_put(host); return ret; @@ -778,14 +771,11 @@ static int uniphier_spi_probe(struct platform_device *pdev) static void uniphier_spi_remove(struct platform_device *pdev) { struct spi_controller *host = platform_get_drvdata(pdev); - struct uniphier_spi_priv *priv = spi_controller_get_devdata(host); 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); } static const struct of_device_id uniphier_spi_match[] = { -- 2.53.0