From: Itai Handler <itai.handler@gmail.com>
To: stable@vger.kernel.org
Cc: Johan Hovold <johan+linaro@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sasha Levin <sashal@kernel.org>, Mark Brown <broonie@kernel.org>,
Marek Vasut <marex@nabladev.com>, Marek Vasut <marex@denx.de>,
Michal Simek <michal.simek@amd.com>,
linux-spi@vger.kernel.org,
Naga Sureshkumar Relli <naga.sureshkumar.relli@xilinx.com>,
Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>,
Itai Handler <itai.handler@gmail.com>
Subject: [PATCH 5.10.y v2 2/4] spi: zynqmp-gqspi: fix clock imbalance on probe failure
Date: Sun, 1 Nov 2026 18:31:52 +0200 [thread overview]
Message-ID: <20261101163154.2274099-3-itai.handler@gmail.com> (raw)
In-Reply-To: <20261101163154.2274099-1-itai.handler@gmail.com>
From: Johan Hovold <johan+linaro@kernel.org>
commit 1527b076ae2cb6a9c590a02725ed39399fcad1cf upstream.
Make sure that the device is not runtime suspended before explicitly
disabling the clocks on probe failure and on driver unbind to avoid a
clock enable-count imbalance.
Fixes: 9e3a000362ae ("spi: zynqmp: Add pm runtime support")
Cc: stable@vger.kernel.org # 4.19
Cc: Naga Sureshkumar Relli <naga.sureshkumar.relli@xilinx.com>
Cc: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/Message-Id: <20230622082435.7873-1-johan+linaro@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
[ itai: 5.10.198 carried this as commit 19f3d5d13b75, and 5.10.199
reverted it in commit 649237ccf440 along with 2cdec9c13f81, the
mislabelled backport of the previous patch, which this one depends on.
Context - zynqmp_qspi_remove() in this tree already starts with
spi_unregister_controller(), added by commit aeb00d7e89ca ("spi:
zynqmp-gqspi: fix controller deregistration"); take the runtime PM
reference before it, which is the order upstream ends up with ]
Assisted-by: LLM
Signed-off-by: Itai Handler <itai.handler@gmail.com>
---
drivers/spi/spi-zynqmp-gqspi.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c
index 7223eee6db88..58b8c5c37f9a 100644
--- a/drivers/spi/spi-zynqmp-gqspi.c
+++ b/drivers/spi/spi-zynqmp-gqspi.c
@@ -1189,9 +1189,9 @@ static int zynqmp_qspi_probe(struct platform_device *pdev)
return 0;
clk_dis_all:
- pm_runtime_put_sync(&pdev->dev);
- pm_runtime_set_suspended(&pdev->dev);
pm_runtime_disable(&pdev->dev);
+ pm_runtime_put_noidle(&pdev->dev);
+ pm_runtime_set_suspended(&pdev->dev);
clk_disable_unprepare(xqspi->refclk);
clk_dis_pclk:
clk_disable_unprepare(xqspi->pclk);
@@ -1213,13 +1213,17 @@ static int zynqmp_qspi_remove(struct platform_device *pdev)
{
struct zynqmp_qspi *xqspi = platform_get_drvdata(pdev);
+ pm_runtime_get_sync(&pdev->dev);
+
spi_unregister_controller(xqspi->ctlr);
zynqmp_gqspi_write(xqspi, GQSPI_EN_OFST, 0x0);
+
+ pm_runtime_disable(&pdev->dev);
+ pm_runtime_put_noidle(&pdev->dev);
+ pm_runtime_set_suspended(&pdev->dev);
clk_disable_unprepare(xqspi->refclk);
clk_disable_unprepare(xqspi->pclk);
- pm_runtime_set_suspended(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
return 0;
}
--
2.34.1
next prev parent reply other threads:[~2026-11-01 16:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-01 16:31 [PATCH 5.10.y v2 0/4] spi: spi-zynqmp-gqspi: fix runtime PM, then stop on shutdown Itai Handler
2026-11-01 16:31 ` [PATCH 5.10.y v2 1/4] spi: spi-zynqmp-gqspi: Fix runtime PM imbalance in zynqmp_qspi_probe Itai Handler
2026-11-01 16:31 ` Itai Handler [this message]
2026-11-01 16:31 ` [PATCH 5.10.y v2 3/4] spi: zynqmp-gqspi: Undo runtime PM changes at driver exit time Itai Handler
2026-11-01 16:31 ` [PATCH 5.10.y v2 4/4] spi: spi-zynqmp-gqspi: stop the controller on shutdown Itai Handler
2026-11-02 15:33 ` [PATCH 5.10.y v2 0/4] spi: spi-zynqmp-gqspi: fix runtime PM, then stop " Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261101163154.2274099-3-itai.handler@gmail.com \
--to=itai.handler@gmail.com \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=johan+linaro@kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=marex@denx.de \
--cc=marex@nabladev.com \
--cc=michal.simek@amd.com \
--cc=naga.sureshkumar.relli@xilinx.com \
--cc=sashal@kernel.org \
--cc=shubhrajyoti.datta@xilinx.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox