All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Mark Brown <broonie@kernel.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Frank Li <Frank.Li@nxp.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Andrew Jeffery <andrew@codeconstruct.com.au>,
	Avi Fishman <avifishman70@gmail.com>,
	Tomer Maimon <tmaimon77@gmail.com>,
	Tali Perry <tali.perry1@gmail.com>,
	Linus Walleij <linusw@kernel.org>,
	Andi Shyti <andi.shyti@kernel.org>,
	Tudor Ambarus <tudor.ambarus@linaro.org>,
	Paul Walmsley <pjw@kernel.org>,
	Samuel Holland <samuel.holland@sifive.com>,
	Orson Zhai <orsonzhai@gmail.com>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Masahisa Kojima <kojima.masahisa@socionext.com>,
	Jassi Brar <jassisinghbrar@gmail.com>,
	Laxman Dewangan <ldewangan@nvidia.com>,
	Kunihiko Hayashi <hayashi.kunihiko@socionext.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Michal Simek <michal.simek@amd.com>,
	linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Johan Hovold <johan@kernel.org>,
	stable@vger.kernel.org,
	Keiji Hayashibara <hayashibara.keiji@socionext.com>
Subject: [PATCH 24/26] spi: uniphier: fix controller deregistration
Date: Fri, 10 Apr 2026 10:17:54 +0200	[thread overview]
Message-ID: <20260410081757.503099-25-johan@kernel.org> (raw)
In-Reply-To: <20260410081757.503099-1-johan@kernel.org>

Make sure to deregister the controller before releasing underlying
resources like DMA during driver unbind.

Note that clocks were also disabled before the recent commit
fdca270f8f87 ("spi: uniphier: Simplify clock handling with
devm_clk_get_enabled()").

Fixes: 5ba155a4d4cc ("spi: add SPI controller driver for UniPhier SoC")
Cc: stable@vger.kernel.org	# 4.19
Cc: Keiji Hayashibara <hayashibara.keiji@socionext.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/spi/spi-uniphier.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-uniphier.c b/drivers/spi/spi-uniphier.c
index 1b815ee2ed1b..eac6c3e8908b 100644
--- a/drivers/spi/spi-uniphier.c
+++ b/drivers/spi/spi-uniphier.c
@@ -746,7 +746,7 @@ static int uniphier_spi_probe(struct platform_device *pdev)
 
 	host->max_dma_len = min(dma_tx_burst, dma_rx_burst);
 
-	ret = devm_spi_register_controller(&pdev->dev, host);
+	ret = spi_register_controller(host);
 	if (ret)
 		goto out_release_dma;
 
@@ -771,10 +771,16 @@ static void uniphier_spi_remove(struct platform_device *pdev)
 {
 	struct spi_controller *host = platform_get_drvdata(pdev);
 
+	spi_controller_get(host);
+
+	spi_unregister_controller(host);
+
 	if (host->dma_tx)
 		dma_release_channel(host->dma_tx);
 	if (host->dma_rx)
 		dma_release_channel(host->dma_rx);
+
+	spi_controller_put(host);
 }
 
 static const struct of_device_id uniphier_spi_match[] = {
-- 
2.52.0


  parent reply	other threads:[~2026-04-10  8:18 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10  8:17 [PATCH 00/26] spi: fix controller deregistration (part 2/2) Johan Hovold
2026-04-10  8:17 ` [PATCH 01/26] spi: mt65xx: fix controller deregistration Johan Hovold
2026-04-10  8:17 ` [PATCH 02/26] spi: mtk-nor: " Johan Hovold
2026-04-10  8:17 ` [PATCH 03/26] spi: mxs: " Johan Hovold
2026-04-10  8:17 ` [PATCH 04/26] spi: npcm-pspi: " Johan Hovold
2026-04-10  8:17 ` [PATCH 05/26] spi: omap2-mcspi: " Johan Hovold
2026-04-10  8:17 ` [PATCH 06/26] spi: pic32: " Johan Hovold
2026-04-10  8:17 ` [PATCH 07/26] spi: pic32-sqi: " Johan Hovold
2026-04-10  8:17 ` [PATCH 08/26] spi: pl022: " Johan Hovold
2026-04-10  8:17 ` [PATCH 09/26] spi: qup: " Johan Hovold
2026-04-10  8:17 ` [PATCH 10/26] spi: rspi: " Johan Hovold
2026-04-10  8:17 ` [PATCH 11/26] spi: s3c64xx: " Johan Hovold
2026-04-10  8:17 ` [PATCH 12/26] spi: sh-hspi: " Johan Hovold
2026-04-10  8:17 ` [PATCH 13/26] spi: sh-msiof: " Johan Hovold
2026-04-10  8:17 ` [PATCH 14/26] spi: sifive: " Johan Hovold
2026-04-10  8:17 ` [PATCH 15/26] spi: slave-mt27xx: " Johan Hovold
2026-04-10  8:17 ` [PATCH 16/26] spi: sprd: " Johan Hovold
2026-04-10  8:17 ` [PATCH 17/26] spi: st-ssc4: " Johan Hovold
2026-04-10  8:17 ` [PATCH 18/26] spi: sun4i: " Johan Hovold
2026-04-10  8:17 ` [PATCH 19/26] spi: sun6i: " Johan Hovold
2026-04-10  8:17 ` [PATCH 20/26] spi: syncuacer: " Johan Hovold
2026-04-10  8:17 ` [PATCH 21/26] spi: tegra114: " Johan Hovold
2026-04-10  8:17 ` [PATCH 22/26] spi: tegra20-sflash: " Johan Hovold
2026-04-10  8:17 ` [PATCH 23/26] spi: ti-qspi: " Johan Hovold
2026-04-10  8:17 ` Johan Hovold [this message]
2026-04-10  8:17 ` [PATCH 25/26] spi: zynqmp-gqspi: " Johan Hovold
2026-04-10  8:17 ` [PATCH 26/26] spi: zynq-qspi: " Johan Hovold
2026-04-10 12:23 ` [PATCH 00/26] spi: fix controller deregistration (part 2/2) Mark Brown

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=20260410081757.503099-25-johan@kernel.org \
    --to=johan@kernel.org \
    --cc=Frank.Li@nxp.com \
    --cc=andi.shyti@kernel.org \
    --cc=andrew@codeconstruct.com.au \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=avifishman70@gmail.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=broonie@kernel.org \
    --cc=hayashi.kunihiko@socionext.com \
    --cc=hayashibara.keiji@socionext.com \
    --cc=jassisinghbrar@gmail.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=kojima.masahisa@socionext.com \
    --cc=ldewangan@nvidia.com \
    --cc=linusw@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mhiramat@kernel.org \
    --cc=michal.simek@amd.com \
    --cc=orsonzhai@gmail.com \
    --cc=pjw@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=samuel.holland@sifive.com \
    --cc=stable@vger.kernel.org \
    --cc=tali.perry1@gmail.com \
    --cc=tmaimon77@gmail.com \
    --cc=tudor.ambarus@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.