FAILED: patch "[PATCH] spi: zynq-qspi: fix controller deregistration" failed to apply to 6.12-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x c9c012706c9fa8ca6d129a9161caf92ab625a3fd
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026051203-stonework-judgingly-0a7d@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From c9c012706c9fa8ca6d129a9161caf92ab625a3fd Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Fri, 10 Apr 2026 10:17:56 +0200
Subject: [PATCH] spi: zynq-qspi: fix controller deregistration
Make sure to deregister the controller before disabling it during driver unbind.
Note that clocks were also disabled before the recent commit 1f8fd9490e31 ("spi: zynq-qspi: Simplify clock handling with devm_clk_get_enabled()").
drivers/spi/spi-zynq-qspi.c +11 -4
@@ -643,7 +643,7 @@ static int zynq_qspi_probe(struct platform_device *pdev) xqspi =spi_controller_get_devdata (ctlr); xqspi->dev = dev; -platform_set_drvdata (pdev, xqspi); +platform_set_drvdata (pdev, ctlr); xqspi->regs =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (xqspi->regs)) { ret =PTR_ERR (xqspi->regs);
@@ -702,9 +702,9 @@ static int zynq_qspi_probe(struct platform_device *pdev)/* QSPI controller initializations */ zynq_qspi_init_hw (xqspi, ctlr->num_chipselect); - ret =devm_spi_register_controller (&pdev->dev, ctlr); + ret =spi_register_controller (ctlr);if (ret) { -dev_err (&pdev->dev,"devm_spi_register_controller failed\n" ); +dev_err (&pdev->dev,"failed to register controller\n" ); goto remove_ctlr; }
@@ -728,9 +728,16 @@ static int zynq_qspi_probe(struct platform_device *pdev)*/ static void zynq_qspi_remove (struct platform_device *pdev) { -struct zynq_qspi *xqspi =platform_get_drvdata (pdev); +struct spi_controller *ctlr =platform_get_drvdata (pdev); +struct zynq_qspi *xqspi =spi_controller_get_devdata (ctlr); + +spi_controller_get (ctlr); + +spi_unregister_controller (ctlr);zynq_qspi_write (xqspi,ZYNQ_QSPI_ENABLE_OFFSET ,0 ); + +spi_controller_put (ctlr); }static const struct of_device_id zynq_qspi_of_match[] = {
Sasha Levin
maintainerPATCH 1/2 spi: zynq-qspi: Simplify clock handling with devm_clk_get_enabled()
From: Pei Xiao <[email protected]>
[ Upstream commit 1f8fd9490e3184e9a2394df2e682901a1d57ce71 ]
Replace devm_clk_get() followed by clk_prepare_enable() with devm_clk_get_enabled() for both "pclk" and "ref_clk". This removes the need for explicit clock enable and disable calls, as the managed API automatically disables the clocks on device removal or probe failure.
Remove the now-unnecessary clk_disable_unprepare() calls from the probe error paths and the remove callback. Simplify error handling by jumping directly to the remove_ctlr label.
Stable-dep-of: c9c012706c9f ("spi: zynq-qspi: fix controller deregistration")
--- drivers/spi/spi-zynq-qspi.c | 42 ++++++------------------------------- 1 file changed, 6 insertions(+), 36 deletions(-)
drivers/spi/spi-zynq-qspi.c +6 -36
@@ -379,21 +379,10 @@ static int zynq_qspi_setup_op(struct spi_device *spi) {struct spi_controller *ctlr = spi->controller;struct zynq_qspi *qspi =spi_controller_get_devdata (ctlr); -int ret;if (ctlr->busy)return -EBUSY ; - ret =clk_enable (qspi->refclk); -if (ret) -return ret; - - ret =clk_enable (qspi->pclk); -if (ret) { -clk_disable (qspi->refclk); -return ret; - } -zynq_qspi_write (qspi,ZYNQ_QSPI_ENABLE_OFFSET ,ZYNQ_QSPI_ENABLE_ENABLE_MASK );
@@ -659,7 +648,7 @@ static int zynq_qspi_probe(struct platform_device *pdev) goto remove_ctlr; } - xqspi->pclk =devm_clk_get (&pdev->dev,"pclk" ); + xqspi->pclk =devm_clk_get_enabled (&pdev->dev,"pclk" );if (IS_ERR (xqspi->pclk)) {dev_err (&pdev->dev,"pclk clock not found.\n" ); ret =PTR_ERR (xqspi->pclk);
@@ -668,36 +657,24 @@ static int zynq_qspi_probe(struct platform_device *pdev)init_completion (&xqspi->data_completion); - xqspi->refclk =devm_clk_get (&pdev->dev,"ref_clk" ); + xqspi->refclk =devm_clk_get_enabled (&pdev->dev,"ref_clk" );if (IS_ERR (xqspi->refclk)) {dev_err (&pdev->dev,"ref_clk clock not found.\n" ); ret =PTR_ERR (xqspi->refclk); goto remove_ctlr; } - ret =clk_prepare_enable (xqspi->pclk); -if (ret) { -dev_err (&pdev->dev,"Unable to enable APB clock.\n" ); - goto remove_ctlr; - } - - ret =clk_prepare_enable (xqspi->refclk); -if (ret) { -dev_err (&pdev->dev,"Unable to enable device clock.\n" ); - goto clk_dis_pclk; - } - xqspi->irq =platform_get_irq (pdev,0 );if (xqspi->irq <0 ) { ret = xqspi->irq; - goto clk_dis_all; + goto remove_ctlr; } ret =devm_request_irq (&pdev->dev, xqspi->irq, zynq_qspi_irq,0 , pdev->name, xqspi);if (ret !=0 ) { ret = -ENXIO ;dev_err (&pdev->dev,"request_irq failed\n" ); - goto clk_dis_all; + goto remove_ctlr; } ret = of_property_read_u32(np, "num-cs",
@@ -707,7 +684,7 @@ static int zynq_qspi_probe(struct platform_device *pdev) }else if (num_cs >ZYNQ_QSPI_MAX_NUM_CS ) { ret = -EINVAL ;dev_err (&pdev->dev,"only 2 chip selects are available\n" ); - goto clk_dis_all; + goto remove_ctlr; }else { ctlr->num_chipselect = num_cs; }
@@ -725,15 +702,11 @@ static int zynq_qspi_probe(struct platform_device *pdev) ret =devm_spi_register_controller (&pdev->dev, ctlr);if (ret) {dev_err (&pdev->dev,"devm_spi_register_controller failed\n" ); - goto clk_dis_all; + goto remove_ctlr; }return ret; -clk_dis_all: -clk_disable_unprepare (xqspi->refclk); -clk_dis_pclk: -clk_disable_unprepare (xqspi->pclk); remove_ctlr:spi_controller_put (ctlr);
@@ -755,9 +728,6 @@ static void zynq_qspi_remove(struct platform_device *pdev)struct zynq_qspi *xqspi =platform_get_drvdata (pdev);zynq_qspi_write (xqspi,ZYNQ_QSPI_ENABLE_OFFSET ,0 ); - -clk_disable_unprepare (xqspi->refclk); -clk_disable_unprepare (xqspi->pclk); }static const struct of_device_id zynq_qspi_of_match[] = {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 spi: zynq-qspi: fix controller deregistration
From: Johan Hovold <[email protected]>
[ Upstream commit c9c012706c9fa8ca6d129a9161caf92ab625a3fd ]
Make sure to deregister the controller before disabling it during driver unbind.
Note that clocks were also disabled before the recent commit 1f8fd9490e31 ("spi: zynq-qspi: Simplify clock handling with devm_clk_get_enabled()").
--- drivers/spi/spi-zynq-qspi.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/spi/spi-zynq-qspi.c +11 -4
@@ -641,7 +641,7 @@ static int zynq_qspi_probe(struct platform_device *pdev) xqspi =spi_controller_get_devdata (ctlr); xqspi->dev = dev; -platform_set_drvdata (pdev, xqspi); +platform_set_drvdata (pdev, ctlr); xqspi->regs =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (xqspi->regs)) { ret =PTR_ERR (xqspi->regs);
@@ -699,9 +699,9 @@ static int zynq_qspi_probe(struct platform_device *pdev)/* QSPI controller initializations */ zynq_qspi_init_hw (xqspi, ctlr->num_chipselect); - ret =devm_spi_register_controller (&pdev->dev, ctlr); + ret =spi_register_controller (ctlr);if (ret) { -dev_err (&pdev->dev,"devm_spi_register_controller failed\n" ); +dev_err (&pdev->dev,"failed to register controller\n" ); goto remove_ctlr; }
@@ -725,9 +725,16 @@ static int zynq_qspi_probe(struct platform_device *pdev)*/ static void zynq_qspi_remove (struct platform_device *pdev) { -struct zynq_qspi *xqspi =platform_get_drvdata (pdev); +struct spi_controller *ctlr =platform_get_drvdata (pdev); +struct zynq_qspi *xqspi =spi_controller_get_devdata (ctlr); + +spi_controller_get (ctlr); + +spi_unregister_controller (ctlr);zynq_qspi_write (xqspi,ZYNQ_QSPI_ENABLE_OFFSET ,0 ); + +spi_controller_put (ctlr); }static const struct of_device_id zynq_qspi_of_match[] = {
Signature · 1 line
2.53.0