linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: zynqmp-gqspi: fix clock imbalance on probe failure
@ 2023-06-22  8:24 Johan Hovold
  2023-06-22 21:42 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Johan Hovold @ 2023-06-22  8:24 UTC (permalink / raw)
  To: Mark Brown
  Cc: Michal Simek, linux-spi, linux-arm-kernel, linux-kernel,
	Johan Hovold, stable, Naga Sureshkumar Relli, Shubhrajyoti Datta

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>
---
 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 fb2ca9b90eab..c309dedfd602 100644
--- a/drivers/spi/spi-zynqmp-gqspi.c
+++ b/drivers/spi/spi-zynqmp-gqspi.c
@@ -1342,9 +1342,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);
@@ -1368,11 +1368,15 @@ static void zynqmp_qspi_remove(struct platform_device *pdev)
 {
 	struct zynqmp_qspi *xqspi = platform_get_drvdata(pdev);
 
+	pm_runtime_get_sync(&pdev->dev);
+
 	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);
 }
 
 MODULE_DEVICE_TABLE(of, zynqmp_qspi_of_match);
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] spi: zynqmp-gqspi: fix clock imbalance on probe failure
  2023-06-22  8:24 [PATCH] spi: zynqmp-gqspi: fix clock imbalance on probe failure Johan Hovold
@ 2023-06-22 21:42 ` Mark Brown
  2023-08-28 12:14   ` Johan Hovold
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2023-06-22 21:42 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Michal Simek, linux-spi, linux-arm-kernel, linux-kernel, stable,
	Naga Sureshkumar Relli, Shubhrajyoti Datta

On Thu, 22 Jun 2023 10:24:35 +0200, Johan Hovold wrote:
> 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.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: zynqmp-gqspi: fix clock imbalance on probe failure
      commit: 1527b076ae2cb6a9c590a02725ed39399fcad1cf

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] spi: zynqmp-gqspi: fix clock imbalance on probe failure
  2023-06-22 21:42 ` Mark Brown
@ 2023-08-28 12:14   ` Johan Hovold
  2023-08-28 14:52     ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Johan Hovold @ 2023-08-28 12:14 UTC (permalink / raw)
  To: Mark Brown
  Cc: Johan Hovold, Michal Simek, linux-spi, linux-arm-kernel,
	linux-kernel, stable, Naga Sureshkumar Relli, Shubhrajyoti Datta

Hi Mark,

On Thu, Jun 22, 2023 at 10:42:40PM +0100, Mark Brown wrote:
> On Thu, 22 Jun 2023 10:24:35 +0200, Johan Hovold wrote:
> > 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.
> > 
> > 
> 
> Applied to
> 
>    https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
> 
> Thanks!
> 
> [1/1] spi: zynqmp-gqspi: fix clock imbalance on probe failure
>       commit: 1527b076ae2cb6a9c590a02725ed39399fcad1cf

I noticed that this one is still sitting in your for-next (and for-6.4)
branch but that it wasn't included in your 6.6 (or 6.5) pull request.

Did you intend to send it as a fix during the 6.6 cycle or as it fallen
between the cracks somehow?

Johan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] spi: zynqmp-gqspi: fix clock imbalance on probe failure
  2023-08-28 12:14   ` Johan Hovold
@ 2023-08-28 14:52     ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2023-08-28 14:52 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Johan Hovold, Michal Simek, linux-spi, linux-arm-kernel,
	linux-kernel, stable, Naga Sureshkumar Relli, Shubhrajyoti Datta

[-- Attachment #1: Type: text/plain, Size: 401 bytes --]

On Mon, Aug 28, 2023 at 02:14:05PM +0200, Johan Hovold wrote:

> I noticed that this one is still sitting in your for-next (and for-6.4)
> branch but that it wasn't included in your 6.6 (or 6.5) pull request.

> Did you intend to send it as a fix during the 6.6 cycle or as it fallen
> between the cracks somehow?

It fell through the cracks - I was originally intending to send it as a
fix for v6.4.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-28 14:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-22  8:24 [PATCH] spi: zynqmp-gqspi: fix clock imbalance on probe failure Johan Hovold
2023-06-22 21:42 ` Mark Brown
2023-08-28 12:14   ` Johan Hovold
2023-08-28 14:52     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).