FAILED: patch "[PATCH] spi: syncuacer: fix controller deregistration" failed to apply to 6.1-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.1-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.1.y
git checkout FETCH_HEAD
git cherry-pick -x 75d849c3452e9611de031db45b3149ba9a99035f
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026051241-embezzle-retrial-5eb7@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 75d849c3452e9611de031db45b3149ba9a99035f Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Fri, 10 Apr 2026 10:17:50 +0200
Subject: [PATCH] spi: syncuacer: fix controller deregistration
Make sure to deregister the controller before disabling underlying resources like clocks during driver unbind.
drivers/spi/spi-synquacer.c +7 -1
@@ -716,7 +716,7 @@ static int synquacer_spi_probe(struct platform_device *pdev)pm_runtime_set_active (sspi->dev);pm_runtime_enable (sspi->dev); - ret =devm_spi_register_controller (sspi->dev, host); + ret =spi_register_controller (host);if (ret) goto disable_pm;
@@ -737,9 +737,15 @@ static void synquacer_spi_remove(struct platform_device *pdev)struct spi_controller *host =platform_get_drvdata (pdev);struct synquacer_spi *sspi =spi_controller_get_devdata (host); +spi_controller_get (host); + +spi_unregister_controller (host); +pm_runtime_disable (sspi->dev);clk_disable_unprepare (sspi->clk); + +spi_controller_put (host); }static int __maybe_unused synquacer_spi_suspend (struct device *dev)
Sasha Levin
maintainerPATCH 1/3 spi: synquacer: Convert to platform remove callback returning void
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 1972cdc47df737f5b90ac2132080004f5e413e91 ]
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void.
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Stable-dep-of: 75d849c3452e ("spi: syncuacer: fix controller deregistration")
--- drivers/spi/spi-synquacer.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/spi/spi-synquacer.c +2 -4
@@ -735,7 +735,7 @@ static int synquacer_spi_probe(struct platform_device *pdev)return ret; } -static int synquacer_spi_remove (struct platform_device *pdev) +static void synquacer_spi_remove (struct platform_device *pdev) {struct spi_master *master =platform_get_drvdata (pdev);struct synquacer_spi *sspi =spi_master_get_devdata (master);
@@ -743,8 +743,6 @@ static int synquacer_spi_remove(struct platform_device *pdev)pm_runtime_disable (sspi->dev);clk_disable_unprepare (sspi->clk); - -return 0 ; }static int __maybe_unused synquacer_spi_suspend (struct device *dev)
@@ -820,7 +818,7 @@ static struct platform_driver synquacer_spi_driver = { .acpi_match_table = ACPI_PTR(synquacer_hsspi_acpi_ids), }, .probe = synquacer_spi_probe, - .remove = synquacer_spi_remove, + .remove_new = synquacer_spi_remove, };module_platform_driver (synquacer_spi_driver);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/3 spi: synquacer: switch to use modern name
From: Yang Yingliang <[email protected]>
[ Upstream commit 3524d1b727a66712f02f92807219a3650e5cf910 ]
Change legacy name master to modern name host or controller.
No functional changed.
Stable-dep-of: 75d849c3452e ("spi: syncuacer: fix controller deregistration")
--- drivers/spi/spi-synquacer.c | 82 ++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 41 deletions(-)
drivers/spi/spi-synquacer.c +41 -41
@@ -225,11 +225,11 @@ static int write_fifo(struct synquacer_spi *sspi)return 0 ; } -static int synquacer_spi_config (struct spi_master *master, +static int synquacer_spi_config (struct spi_controller *host,struct spi_device *spi,struct spi_transfer *xfer) { -struct synquacer_spi *sspi =spi_master_get_devdata (master); +struct synquacer_spi *sspi =spi_controller_get_devdata (host);unsigned int speed, mode, bpw, cs, bus_width, transfer_mode;u32 rate, val, div;
@@ -263,7 +263,7 @@ static int synquacer_spi_config(struct spi_master *master, } sspi->transfer_mode = transfer_mode; - rate = master->max_speed_hz; + rate = host->max_speed_hz; div =DIV_ROUND_UP (rate, speed);if (div >254 ) {
@@ -350,11 +350,11 @@ static int synquacer_spi_config(struct spi_master *master,return 0 ; } -static int synquacer_spi_transfer_one (struct spi_master *master, +static int synquacer_spi_transfer_one (struct spi_controller *host,struct spi_device *spi,struct spi_transfer *xfer) { -struct synquacer_spi *sspi =spi_master_get_devdata (master); +struct synquacer_spi *sspi =spi_controller_get_devdata (host);int ret;int status =0 ;u32 words;
@@ -378,7 +378,7 @@ static int synquacer_spi_transfer_one(struct spi_master *master,if (bpw ==8 && !(xfer->len %4 ) && !(spi->mode &SPI_LSB_FIRST )) xfer->bits_per_word =32 ; - ret =synquacer_spi_config (master, spi, xfer); + ret =synquacer_spi_config (host, spi, xfer);/* restore */ xfer->bits_per_word = bpw;
@@ -482,7 +482,7 @@ static int synquacer_spi_transfer_one(struct spi_master *master,static void synquacer_spi_set_cs (struct spi_device *spi,bool enable) { -struct synquacer_spi *sspi =spi_master_get_devdata (spi->master); +struct synquacer_spi *sspi =spi_controller_get_devdata (spi->controller);u32 val; val =readl (sspi->regs +SYNQUACER_HSSPI_REG_DMSTART );
@@ -517,11 +517,11 @@ static int synquacer_spi_wait_status_update(struct synquacer_spi *sspi,return -EBUSY ; } -static int synquacer_spi_enable (struct spi_master *master) +static int synquacer_spi_enable (struct spi_controller *host) {u32 val;int status; -struct synquacer_spi *sspi =spi_master_get_devdata (master); +struct synquacer_spi *sspi =spi_controller_get_devdata (host);/* Disable module */ writel (0 , sspi->regs +SYNQUACER_HSSPI_REG_MCTRL );
@@ -601,18 +601,18 @@ static irqreturn_t sq_spi_tx_handler(int irq, void *priv)static int synquacer_spi_probe (struct platform_device *pdev) {struct device_node *np = pdev->dev.of_node; -struct spi_master *master; +struct spi_controller *host;struct synquacer_spi *sspi;int ret;int rx_irq, tx_irq; - master =spi_alloc_master (&pdev->dev,sizeof (*sspi)); -if (!master) + host =spi_alloc_host (&pdev->dev,sizeof (*sspi)); +if (!host)return -ENOMEM ; -platform_set_drvdata (pdev, master); +platform_set_drvdata (pdev, host); - sspi =spi_master_get_devdata (master); + sspi =spi_controller_get_devdata (host); sspi->dev = &pdev->dev;init_completion (&sspi->transfer_done);
@@ -625,7 +625,7 @@ static int synquacer_spi_probe(struct platform_device *pdev) sspi->clk_src_type =SYNQUACER_HSSPI_CLOCK_SRC_IHCLK ;/* Default */ device_property_read_u32 (&pdev->dev,"socionext,ihclk-rate" , - &master->max_speed_hz);/* for ACPI */ + &host->max_speed_hz);/* for ACPI */ if (dev_of_node (&pdev->dev)) { if (device_property_match_string(&pdev->dev,
@@ -655,21 +655,21 @@ static int synquacer_spi_probe(struct platform_device *pdev) goto put_spi; } - master->max_speed_hz =clk_get_rate (sspi->clk); + host->max_speed_hz =clk_get_rate (sspi->clk); } -if (!master->max_speed_hz) { +if (!host->max_speed_hz) {dev_err (&pdev->dev,"missing clock source\n" ); ret = -EINVAL ; goto disable_clk; } - master->min_speed_hz = master->max_speed_hz /254 ; + host->min_speed_hz = host->max_speed_hz /254 ; sspi->aces =device_property_read_bool (&pdev->dev,"socionext,set-aces" ); sspi->rtm =device_property_read_bool (&pdev->dev,"socionext,use-rtm" ); - master->num_chipselect =SYNQUACER_HSSPI_NUM_CHIP_SELECT ; + host->num_chipselect =SYNQUACER_HSSPI_NUM_CHIP_SELECT ; rx_irq =platform_get_irq (pdev,0 );if (rx_irq <=0 ) {
@@ -699,27 +699,27 @@ static int synquacer_spi_probe(struct platform_device *pdev) goto disable_clk; } - master->dev.of_node = np; - master->dev.fwnode = pdev->dev.fwnode; - master->auto_runtime_pm = true; - master->bus_num = pdev->id; + host->dev.of_node = np; + host->dev.fwnode = pdev->dev.fwnode; + host->auto_runtime_pm = true; + host->bus_num = pdev->id; - master->mode_bits =SPI_CPOL |SPI_CPHA |SPI_TX_DUAL |SPI_RX_DUAL | -SPI_TX_QUAD |SPI_RX_QUAD ; - master->bits_per_word_mask =SPI_BPW_MASK (32 ) |SPI_BPW_MASK (24 ) | -SPI_BPW_MASK (16 ) |SPI_BPW_MASK (8 ); + host->mode_bits =SPI_CPOL |SPI_CPHA |SPI_TX_DUAL |SPI_RX_DUAL | +SPI_TX_QUAD |SPI_RX_QUAD ; + host->bits_per_word_mask =SPI_BPW_MASK (32 ) |SPI_BPW_MASK (24 ) | +SPI_BPW_MASK (16 ) |SPI_BPW_MASK (8 ); - master->set_cs = synquacer_spi_set_cs; - master->transfer_one = synquacer_spi_transfer_one; + host->set_cs = synquacer_spi_set_cs; + host->transfer_one = synquacer_spi_transfer_one; - ret =synquacer_spi_enable (master); + ret =synquacer_spi_enable (host);if (ret) goto disable_clk;pm_runtime_set_active (sspi->dev);pm_runtime_enable (sspi->dev); - ret =devm_spi_register_master (sspi->dev, master); + ret =devm_spi_register_controller (sspi->dev, host);if (ret) goto disable_pm;
@@ -730,15 +730,15 @@ static int synquacer_spi_probe(struct platform_device *pdev) disable_clk:clk_disable_unprepare (sspi->clk); put_spi: -spi_master_put (master); +spi_controller_put (host);return ret; }static void synquacer_spi_remove (struct platform_device *pdev) { -struct spi_master *master =platform_get_drvdata (pdev); -struct synquacer_spi *sspi =spi_master_get_devdata (master); +struct spi_controller *host =platform_get_drvdata (pdev); +struct synquacer_spi *sspi =spi_controller_get_devdata (host);pm_runtime_disable (sspi->dev);
@@ -747,11 +747,11 @@ static void synquacer_spi_remove(struct platform_device *pdev)static int __maybe_unused synquacer_spi_suspend (struct device *dev) { -struct spi_master *master =dev_get_drvdata (dev); -struct synquacer_spi *sspi =spi_master_get_devdata (master); +struct spi_controller *host =dev_get_drvdata (dev); +struct synquacer_spi *sspi =spi_controller_get_devdata (host);int ret; - ret =spi_master_suspend (master); + ret =spi_controller_suspend (host);if (ret)return ret;
@@ -763,8 +763,8 @@ static int __maybe_unused synquacer_spi_suspend(struct device *dev)static int __maybe_unused synquacer_spi_resume (struct device *dev) { -struct spi_master *master =dev_get_drvdata (dev); -struct synquacer_spi *sspi =spi_master_get_devdata (master); +struct spi_controller *host =dev_get_drvdata (dev); +struct synquacer_spi *sspi =spi_controller_get_devdata (host);int ret;if (!pm_runtime_suspended (dev)) {
@@ -778,7 +778,7 @@ static int __maybe_unused synquacer_spi_resume(struct device *dev)return ret; } - ret =synquacer_spi_enable (master); + ret =synquacer_spi_enable (host);if (ret) {clk_disable_unprepare (sspi->clk);dev_err (dev,"failed to enable spi (%d)\n" , ret);
@@ -786,7 +786,7 @@ static int __maybe_unused synquacer_spi_resume(struct device *dev) } } - ret =spi_master_resume (master); + ret =spi_controller_resume (host);if (ret <0 )clk_disable_unprepare (sspi->clk);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/3 spi: syncuacer: fix controller deregistration
In reply to Sasha LevinFrom: Johan Hovold <[email protected]>
[ Upstream commit 75d849c3452e9611de031db45b3149ba9a99035f ]
Make sure to deregister the controller before disabling underlying resources like clocks during driver unbind.
--- drivers/spi/spi-synquacer.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/spi/spi-synquacer.c +7 -1
@@ -719,7 +719,7 @@ static int synquacer_spi_probe(struct platform_device *pdev)pm_runtime_set_active (sspi->dev);pm_runtime_enable (sspi->dev); - ret =devm_spi_register_controller (sspi->dev, host); + ret =spi_register_controller (host);if (ret) goto disable_pm;
@@ -740,9 +740,15 @@ static void synquacer_spi_remove(struct platform_device *pdev)struct spi_controller *host =platform_get_drvdata (pdev);struct synquacer_spi *sspi =spi_controller_get_devdata (host); +spi_controller_get (host); + +spi_unregister_controller (host); +pm_runtime_disable (sspi->dev);clk_disable_unprepare (sspi->clk); + +spi_controller_put (host); }static int __maybe_unused synquacer_spi_suspend (struct device *dev)
Signature · 1 line
2.53.0