* [PATCH 00/12] spi: switch to managed controller allocation (part 3/3)
@ 2026-05-11 15:03 Johan Hovold
2026-05-11 15:03 ` [PATCH 01/12] spi: altera-platform: switch to managed controller allocation Johan Hovold
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: Johan Hovold @ 2026-05-11 15:03 UTC (permalink / raw)
To: Mark Brown
Cc: Eddie James, Yang Shen, Neil Armstrong, Kevin Hilman, linux-spi,
linux-kernel, Johan Hovold
In preparation for fixing the SPI controller API so that it no longer
drops a reference when deregistering (non-managed) controllers (cf.
[1]), this series converts drivers using managed registration to also
use managed allocation.
Included is also a related cleanup of a lp8841-rtc.
This leaves us with 18 drivers using non-managed allocation, which is
few enough to be able to fix the API in tree-wide change.
Johan
[1] https://lore.kernel.org/lkml/20260325145319.1132072-1-johan@kernel.org/
Johan Hovold (12):
spi: altera-platform: switch to managed controller allocation
spi: armada-3700: switch to managed controller allocation
spi: clps711x: switch to managed controller allocation
spi: falcon: switch to managed controller allocation
spi: fsi: switch to managed controller allocation
spi: hisi-sfc-v3xx: switch to managed controller allocation
spi: jcore: switch to managed controller allocation
spi: lp8841-rtc: switch to managed controller allocation
spi: lp8841-rtc: drop unused ifdef
spi: meson-spifc: switch to managed controller allocation
spi: mux: switch to managed controller allocation
spi: xlp: switch to managed controller allocation
drivers/spi/spi-altera-platform.c | 27 +++++++------------
drivers/spi/spi-armada-3700.c | 44 ++++++++++---------------------
drivers/spi/spi-clps711x.c | 31 +++++++---------------
drivers/spi/spi-falcon.c | 8 ++----
drivers/spi/spi-fsi.c | 8 +++---
drivers/spi/spi-hisi-sfc-v3xx.c | 20 +++++---------
drivers/spi/spi-jcore.c | 23 +++++-----------
drivers/spi/spi-lp8841-rtc.c | 16 +++--------
drivers/spi/spi-meson-spifc.c | 22 ++++++----------
drivers/spi/spi-mux.c | 19 +++----------
drivers/spi/spi-xlp.c | 3 +--
11 files changed, 68 insertions(+), 153 deletions(-)
--
2.53.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 01/12] spi: altera-platform: switch to managed controller allocation
2026-05-11 15:03 [PATCH 00/12] spi: switch to managed controller allocation (part 3/3) Johan Hovold
@ 2026-05-11 15:03 ` Johan Hovold
2026-05-11 15:03 ` [PATCH 02/12] spi: armada-3700: " Johan Hovold
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2026-05-11 15:03 UTC (permalink / raw)
To: Mark Brown
Cc: Eddie James, Yang Shen, Neil Armstrong, Kevin Hilman, linux-spi,
linux-kernel, Johan Hovold
Switch to device managed controller allocation for consistency and to
simplify error handling.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/spi/spi-altera-platform.c | 27 ++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/drivers/spi/spi-altera-platform.c b/drivers/spi/spi-altera-platform.c
index fc81de2610ef..3ee5d3480bb4 100644
--- a/drivers/spi/spi-altera-platform.c
+++ b/drivers/spi/spi-altera-platform.c
@@ -39,12 +39,12 @@ static int altera_spi_probe(struct platform_device *pdev)
enum altera_spi_type type = ALTERA_SPI_TYPE_UNKNOWN;
struct altera_spi *hw;
struct spi_controller *host;
- int err = -ENODEV;
+ int err;
u16 i;
- host = spi_alloc_host(&pdev->dev, sizeof(struct altera_spi));
+ host = devm_spi_alloc_host(&pdev->dev, sizeof(struct altera_spi));
if (!host)
- return err;
+ return -ENOMEM;
/* setup the host state. */
host->bus_num = -1;
@@ -54,8 +54,7 @@ static int altera_spi_probe(struct platform_device *pdev)
dev_err(&pdev->dev,
"Invalid number of chipselect: %u\n",
pdata->num_chipselect);
- err = -EINVAL;
- goto exit;
+ return -EINVAL;
}
host->num_chipselect = pdata->num_chipselect;
@@ -80,7 +79,7 @@ static int altera_spi_probe(struct platform_device *pdev)
hw->regmap = dev_get_regmap(pdev->dev.parent, NULL);
if (!hw->regmap) {
dev_err(&pdev->dev, "get regmap failed\n");
- goto exit;
+ return -ENODEV;
}
regoff = platform_get_resource(pdev, IORESOURCE_REG, 0);
@@ -90,17 +89,14 @@ static int altera_spi_probe(struct platform_device *pdev)
void __iomem *res;
res = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(res)) {
- err = PTR_ERR(res);
- goto exit;
- }
+ if (IS_ERR(res))
+ return PTR_ERR(res);
hw->regmap = devm_regmap_init_mmio(&pdev->dev, res,
&spi_altera_config);
if (IS_ERR(hw->regmap)) {
dev_err(&pdev->dev, "regmap mmio init failed\n");
- err = PTR_ERR(hw->regmap);
- goto exit;
+ return PTR_ERR(hw->regmap);
}
}
@@ -112,12 +108,12 @@ static int altera_spi_probe(struct platform_device *pdev)
err = devm_request_irq(&pdev->dev, hw->irq, altera_spi_irq, 0,
pdev->name, host);
if (err)
- goto exit;
+ return err;
}
err = devm_spi_register_controller(&pdev->dev, host);
if (err)
- goto exit;
+ return err;
if (pdata) {
for (i = 0; i < pdata->num_devices; i++) {
@@ -131,9 +127,6 @@ static int altera_spi_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "regoff %u, irq %d\n", hw->regoff, hw->irq);
return 0;
-exit:
- spi_controller_put(host);
- return err;
}
#ifdef CONFIG_OF
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 02/12] spi: armada-3700: switch to managed controller allocation
2026-05-11 15:03 [PATCH 00/12] spi: switch to managed controller allocation (part 3/3) Johan Hovold
2026-05-11 15:03 ` [PATCH 01/12] spi: altera-platform: switch to managed controller allocation Johan Hovold
@ 2026-05-11 15:03 ` Johan Hovold
2026-05-11 15:03 ` [PATCH 03/12] spi: clps711x: " Johan Hovold
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2026-05-11 15:03 UTC (permalink / raw)
To: Mark Brown
Cc: Eddie James, Yang Shen, Neil Armstrong, Kevin Hilman, linux-spi,
linux-kernel, Johan Hovold
Switch to device managed controller allocation for consistency and to
simplify error handling.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/spi/spi-armada-3700.c | 44 +++++++++++------------------------
1 file changed, 14 insertions(+), 30 deletions(-)
diff --git a/drivers/spi/spi-armada-3700.c b/drivers/spi/spi-armada-3700.c
index 78248729d3e9..ca2faa265ca0 100644
--- a/drivers/spi/spi-armada-3700.c
+++ b/drivers/spi/spi-armada-3700.c
@@ -818,17 +818,13 @@ static int a3700_spi_probe(struct platform_device *pdev)
u32 num_cs = 0;
int irq, ret = 0;
- host = spi_alloc_host(dev, sizeof(*spi));
- if (!host) {
- dev_err(dev, "host allocation failed\n");
- ret = -ENOMEM;
- goto out;
- }
+ host = devm_spi_alloc_host(dev, sizeof(*spi));
+ if (!host)
+ return -ENOMEM;
if (of_property_read_u32(dev->of_node, "num-cs", &num_cs)) {
dev_err(dev, "could not find num-cs\n");
- ret = -ENXIO;
- goto error;
+ return -ENXIO;
}
host->bus_num = pdev->id;
@@ -849,25 +845,20 @@ static int a3700_spi_probe(struct platform_device *pdev)
spi->host = host;
spi->base = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(spi->base)) {
- ret = PTR_ERR(spi->base);
- goto error;
- }
+ if (IS_ERR(spi->base))
+ return PTR_ERR(spi->base);
irq = platform_get_irq(pdev, 0);
- if (irq < 0) {
- ret = -ENXIO;
- goto error;
- }
+ if (irq < 0)
+ return -ENXIO;
+
spi->irq = irq;
init_completion(&spi->done);
spi->clk = devm_clk_get_prepared(dev, NULL);
- if (IS_ERR(spi->clk)) {
- dev_err(dev, "could not find clk: %ld\n", PTR_ERR(spi->clk));
- goto error;
- }
+ if (IS_ERR(spi->clk))
+ return dev_err_probe(dev, PTR_ERR(spi->clk), "could not find clk\n");
host->max_speed_hz = min_t(unsigned long, A3700_SPI_MAX_SPEED_HZ,
clk_get_rate(spi->clk));
@@ -878,23 +869,16 @@ static int a3700_spi_probe(struct platform_device *pdev)
ret = devm_request_irq(dev, spi->irq, a3700_spi_interrupt, 0,
dev_name(dev), host);
- if (ret) {
- dev_err(dev, "could not request IRQ: %d\n", ret);
- goto error;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "could not request IRQ\n");
ret = devm_spi_register_controller(dev, host);
if (ret) {
dev_err(dev, "Failed to register host\n");
- goto error;
+ return ret;
}
return 0;
-
-error:
- spi_controller_put(host);
-out:
- return ret;
}
static struct platform_driver a3700_spi_driver = {
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 03/12] spi: clps711x: switch to managed controller allocation
2026-05-11 15:03 [PATCH 00/12] spi: switch to managed controller allocation (part 3/3) Johan Hovold
2026-05-11 15:03 ` [PATCH 01/12] spi: altera-platform: switch to managed controller allocation Johan Hovold
2026-05-11 15:03 ` [PATCH 02/12] spi: armada-3700: " Johan Hovold
@ 2026-05-11 15:03 ` Johan Hovold
2026-05-11 15:04 ` [PATCH 04/12] spi: falcon: " Johan Hovold
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2026-05-11 15:03 UTC (permalink / raw)
To: Mark Brown
Cc: Eddie James, Yang Shen, Neil Armstrong, Kevin Hilman, linux-spi,
linux-kernel, Johan Hovold
Switch to device managed controller allocation for consistency and to
simplify error handling.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/spi/spi-clps711x.c | 31 +++++++++----------------------
1 file changed, 9 insertions(+), 22 deletions(-)
diff --git a/drivers/spi/spi-clps711x.c b/drivers/spi/spi-clps711x.c
index d6458e59d41b..382c3c81c4b9 100644
--- a/drivers/spi/spi-clps711x.c
+++ b/drivers/spi/spi-clps711x.c
@@ -99,7 +99,7 @@ static int spi_clps711x_probe(struct platform_device *pdev)
if (irq < 0)
return irq;
- host = spi_alloc_host(&pdev->dev, sizeof(*hw));
+ host = devm_spi_alloc_host(&pdev->dev, sizeof(*hw));
if (!host)
return -ENOMEM;
@@ -113,22 +113,16 @@ static int spi_clps711x_probe(struct platform_device *pdev)
hw = spi_controller_get_devdata(host);
hw->spi_clk = devm_clk_get(&pdev->dev, NULL);
- if (IS_ERR(hw->spi_clk)) {
- ret = PTR_ERR(hw->spi_clk);
- goto err_out;
- }
+ if (IS_ERR(hw->spi_clk))
+ return PTR_ERR(hw->spi_clk);
hw->syscon = syscon_regmap_lookup_by_phandle(np, "syscon");
- if (IS_ERR(hw->syscon)) {
- ret = PTR_ERR(hw->syscon);
- goto err_out;
- }
+ if (IS_ERR(hw->syscon))
+ return PTR_ERR(hw->syscon);
hw->syncio = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(hw->syncio)) {
- ret = PTR_ERR(hw->syncio);
- goto err_out;
- }
+ if (IS_ERR(hw->syncio))
+ return PTR_ERR(hw->syncio);
/* Disable extended mode due hardware problems */
regmap_update_bits(hw->syscon, SYSCON_OFFSET, SYSCON3_ADCCON, 0);
@@ -139,16 +133,9 @@ static int spi_clps711x_probe(struct platform_device *pdev)
ret = devm_request_irq(&pdev->dev, irq, spi_clps711x_isr, 0,
dev_name(&pdev->dev), host);
if (ret)
- goto err_out;
+ return ret;
- ret = devm_spi_register_controller(&pdev->dev, host);
- if (!ret)
- return 0;
-
-err_out:
- spi_controller_put(host);
-
- return ret;
+ return devm_spi_register_controller(&pdev->dev, host);
}
static const struct of_device_id clps711x_spi_dt_ids[] = {
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 04/12] spi: falcon: switch to managed controller allocation
2026-05-11 15:03 [PATCH 00/12] spi: switch to managed controller allocation (part 3/3) Johan Hovold
` (2 preceding siblings ...)
2026-05-11 15:03 ` [PATCH 03/12] spi: clps711x: " Johan Hovold
@ 2026-05-11 15:04 ` Johan Hovold
2026-05-11 15:04 ` [PATCH 05/12] spi: fsi: " Johan Hovold
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2026-05-11 15:04 UTC (permalink / raw)
To: Mark Brown
Cc: Eddie James, Yang Shen, Neil Armstrong, Kevin Hilman, linux-spi,
linux-kernel, Johan Hovold
Switch to device managed controller allocation for consistency and to
simplify error handling.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/spi/spi-falcon.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/spi/spi-falcon.c b/drivers/spi/spi-falcon.c
index cb15faabd88f..e00e808eafee 100644
--- a/drivers/spi/spi-falcon.c
+++ b/drivers/spi/spi-falcon.c
@@ -392,9 +392,8 @@ static int falcon_sflash_probe(struct platform_device *pdev)
{
struct falcon_sflash *priv;
struct spi_controller *host;
- int ret;
- host = spi_alloc_host(&pdev->dev, sizeof(*priv));
+ host = devm_spi_alloc_host(&pdev->dev, sizeof(*priv));
if (!host)
return -ENOMEM;
@@ -406,10 +405,7 @@ static int falcon_sflash_probe(struct platform_device *pdev)
host->setup = falcon_sflash_setup;
host->transfer_one_message = falcon_sflash_xfer_one;
- ret = devm_spi_register_controller(&pdev->dev, host);
- if (ret)
- spi_controller_put(host);
- return ret;
+ return devm_spi_register_controller(&pdev->dev, host);
}
static const struct of_device_id falcon_sflash_match[] = {
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 05/12] spi: fsi: switch to managed controller allocation
2026-05-11 15:03 [PATCH 00/12] spi: switch to managed controller allocation (part 3/3) Johan Hovold
` (3 preceding siblings ...)
2026-05-11 15:04 ` [PATCH 04/12] spi: falcon: " Johan Hovold
@ 2026-05-11 15:04 ` Johan Hovold
2026-05-11 15:04 ` [PATCH 06/12] spi: hisi-sfc-v3xx: " Johan Hovold
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2026-05-11 15:04 UTC (permalink / raw)
To: Mark Brown
Cc: Eddie James, Yang Shen, Neil Armstrong, Kevin Hilman, linux-spi,
linux-kernel, Johan Hovold
Switch to device managed controller allocation for consistency and to
simplify error handling.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/spi/spi-fsi.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/spi/spi-fsi.c b/drivers/spi/spi-fsi.c
index f6a75f0184c4..451cb4cfdb9c 100644
--- a/drivers/spi/spi-fsi.c
+++ b/drivers/spi/spi-fsi.c
@@ -554,7 +554,7 @@ static int fsi_spi_probe(struct fsi_device *fsi)
if (of_property_read_u32(np, "reg", &base))
continue;
- ctlr = spi_alloc_host(dev, sizeof(*ctx));
+ ctlr = devm_spi_alloc_host(dev, sizeof(*ctx));
if (!ctlr)
break;
@@ -571,9 +571,9 @@ static int fsi_spi_probe(struct fsi_device *fsi)
rc = devm_spi_register_controller(dev, ctlr);
if (rc)
- spi_controller_put(ctlr);
- else
- num_controllers_registered++;
+ continue;
+
+ num_controllers_registered++;
}
if (!num_controllers_registered)
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 06/12] spi: hisi-sfc-v3xx: switch to managed controller allocation
2026-05-11 15:03 [PATCH 00/12] spi: switch to managed controller allocation (part 3/3) Johan Hovold
` (4 preceding siblings ...)
2026-05-11 15:04 ` [PATCH 05/12] spi: fsi: " Johan Hovold
@ 2026-05-11 15:04 ` Johan Hovold
2026-05-11 15:04 ` [PATCH 07/12] spi: jcore: " Johan Hovold
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2026-05-11 15:04 UTC (permalink / raw)
To: Mark Brown
Cc: Eddie James, Yang Shen, Neil Armstrong, Kevin Hilman, linux-spi,
linux-kernel, Johan Hovold
Switch to device managed controller allocation for consistency and to
simplify error handling.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/spi/spi-hisi-sfc-v3xx.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/drivers/spi/spi-hisi-sfc-v3xx.c b/drivers/spi/spi-hisi-sfc-v3xx.c
index b2af2eed197f..eeeb86381862 100644
--- a/drivers/spi/spi-hisi-sfc-v3xx.c
+++ b/drivers/spi/spi-hisi-sfc-v3xx.c
@@ -436,7 +436,7 @@ static int hisi_sfc_v3xx_probe(struct platform_device *pdev)
u32 version, glb_config;
int ret;
- ctlr = spi_alloc_host(&pdev->dev, sizeof(*host));
+ ctlr = devm_spi_alloc_host(&pdev->dev, sizeof(*host));
if (!ctlr)
return -ENOMEM;
@@ -451,16 +451,12 @@ static int hisi_sfc_v3xx_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, host);
host->regbase = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(host->regbase)) {
- ret = PTR_ERR(host->regbase);
- goto err_put_host;
- }
+ if (IS_ERR(host->regbase))
+ return PTR_ERR(host->regbase);
host->irq = platform_get_irq_optional(pdev, 0);
- if (host->irq == -EPROBE_DEFER) {
- ret = -EPROBE_DEFER;
- goto err_put_host;
- }
+ if (host->irq == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
hisi_sfc_v3xx_disable_int(host);
@@ -501,16 +497,12 @@ static int hisi_sfc_v3xx_probe(struct platform_device *pdev)
ret = devm_spi_register_controller(dev, ctlr);
if (ret)
- goto err_put_host;
+ return ret;
dev_info(&pdev->dev, "hw version 0x%x, %s mode.\n",
version, host->irq ? "irq" : "polling");
return 0;
-
-err_put_host:
- spi_controller_put(ctlr);
- return ret;
}
static const struct acpi_device_id hisi_sfc_v3xx_acpi_ids[] = {
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 07/12] spi: jcore: switch to managed controller allocation
2026-05-11 15:03 [PATCH 00/12] spi: switch to managed controller allocation (part 3/3) Johan Hovold
` (5 preceding siblings ...)
2026-05-11 15:04 ` [PATCH 06/12] spi: hisi-sfc-v3xx: " Johan Hovold
@ 2026-05-11 15:04 ` Johan Hovold
2026-05-11 15:04 ` [PATCH 08/12] spi: lp8841-rtc: " Johan Hovold
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2026-05-11 15:04 UTC (permalink / raw)
To: Mark Brown
Cc: Eddie James, Yang Shen, Neil Armstrong, Kevin Hilman, linux-spi,
linux-kernel, Johan Hovold
Switch to device managed controller allocation for consistency and to
simplify error handling.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/spi/spi-jcore.c | 23 ++++++-----------------
1 file changed, 6 insertions(+), 17 deletions(-)
diff --git a/drivers/spi/spi-jcore.c b/drivers/spi/spi-jcore.c
index e37ca22e04ba..a75cd61ec7a3 100644
--- a/drivers/spi/spi-jcore.c
+++ b/drivers/spi/spi-jcore.c
@@ -146,11 +146,10 @@ static int jcore_spi_probe(struct platform_device *pdev)
struct resource *res;
u32 clock_freq;
struct clk *clk;
- int err = -ENODEV;
- host = spi_alloc_host(&pdev->dev, sizeof(struct jcore_spi));
+ host = devm_spi_alloc_host(&pdev->dev, sizeof(struct jcore_spi));
if (!host)
- return err;
+ return -ENOMEM;
/* Setup the host state. */
host->num_chipselect = 3;
@@ -167,14 +166,14 @@ static int jcore_spi_probe(struct platform_device *pdev)
/* Find and map our resources */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
- goto exit_busy;
+ return -EBUSY;
if (!devm_request_mem_region(&pdev->dev, res->start,
resource_size(res), pdev->name))
- goto exit_busy;
+ return -EBUSY;
hw->base = devm_ioremap(&pdev->dev, res->start,
resource_size(res));
if (!hw->base)
- goto exit_busy;
+ return -EBUSY;
/*
* The SPI clock rate controlled via a configurable clock divider
@@ -200,17 +199,7 @@ static int jcore_spi_probe(struct platform_device *pdev)
jcore_spi_baudrate(hw, 400000);
/* Register our spi controller */
- err = devm_spi_register_controller(&pdev->dev, host);
- if (err)
- goto exit;
-
- return 0;
-
-exit_busy:
- err = -EBUSY;
-exit:
- spi_controller_put(host);
- return err;
+ return devm_spi_register_controller(&pdev->dev, host);
}
static const struct of_device_id jcore_spi_of_match[] = {
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 08/12] spi: lp8841-rtc: switch to managed controller allocation
2026-05-11 15:03 [PATCH 00/12] spi: switch to managed controller allocation (part 3/3) Johan Hovold
` (6 preceding siblings ...)
2026-05-11 15:04 ` [PATCH 07/12] spi: jcore: " Johan Hovold
@ 2026-05-11 15:04 ` Johan Hovold
2026-05-11 15:04 ` [PATCH 09/12] spi: lp8841-rtc: drop unused ifdef Johan Hovold
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2026-05-11 15:04 UTC (permalink / raw)
To: Mark Brown
Cc: Eddie James, Yang Shen, Neil Armstrong, Kevin Hilman, linux-spi,
linux-kernel, Johan Hovold
Switch to device managed controller allocation for consistency and to
simplify error handling.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/spi/spi-lp8841-rtc.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/spi/spi-lp8841-rtc.c b/drivers/spi/spi-lp8841-rtc.c
index e466866d5e80..355d9df4d1be 100644
--- a/drivers/spi/spi-lp8841-rtc.c
+++ b/drivers/spi/spi-lp8841-rtc.c
@@ -185,7 +185,7 @@ spi_lp8841_rtc_probe(struct platform_device *pdev)
struct spi_controller *host;
struct spi_lp8841_rtc *data;
- host = spi_alloc_host(&pdev->dev, sizeof(*data));
+ host = devm_spi_alloc_host(&pdev->dev, sizeof(*data));
if (!host)
return -ENOMEM;
platform_set_drvdata(pdev, host);
@@ -208,23 +208,17 @@ spi_lp8841_rtc_probe(struct platform_device *pdev)
ret = PTR_ERR_OR_ZERO(data->iomem);
if (ret) {
dev_err(&pdev->dev, "failed to get IO address\n");
- goto err_put_host;
+ return ret;
}
/* register with the SPI framework */
ret = devm_spi_register_controller(&pdev->dev, host);
if (ret) {
dev_err(&pdev->dev, "cannot register spi host\n");
- goto err_put_host;
+ return ret;
}
- return ret;
-
-
-err_put_host:
- spi_controller_put(host);
-
- return ret;
+ return 0;
}
MODULE_ALIAS("platform:" DRIVER_NAME);
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 09/12] spi: lp8841-rtc: drop unused ifdef
2026-05-11 15:03 [PATCH 00/12] spi: switch to managed controller allocation (part 3/3) Johan Hovold
` (7 preceding siblings ...)
2026-05-11 15:04 ` [PATCH 08/12] spi: lp8841-rtc: " Johan Hovold
@ 2026-05-11 15:04 ` Johan Hovold
2026-05-11 15:04 ` [PATCH 10/12] spi: meson-spifc: switch to managed controller allocation Johan Hovold
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2026-05-11 15:04 UTC (permalink / raw)
To: Mark Brown
Cc: Eddie James, Yang Shen, Neil Armstrong, Kevin Hilman, linux-spi,
linux-kernel, Johan Hovold
Drop the probe CONFIG_OF ifdef which is unused since commit 3974a585be78
("spi: Drop duplicate of_node assignment").
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/spi/spi-lp8841-rtc.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/spi/spi-lp8841-rtc.c b/drivers/spi/spi-lp8841-rtc.c
index 355d9df4d1be..b2546a3a9eaa 100644
--- a/drivers/spi/spi-lp8841-rtc.c
+++ b/drivers/spi/spi-lp8841-rtc.c
@@ -199,8 +199,6 @@ spi_lp8841_rtc_probe(struct platform_device *pdev)
host->set_cs = spi_lp8841_rtc_set_cs;
host->transfer_one = spi_lp8841_rtc_transfer_one;
host->bits_per_word_mask = SPI_BPW_MASK(8);
-#ifdef CONFIG_OF
-#endif
data = spi_controller_get_devdata(host);
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 10/12] spi: meson-spifc: switch to managed controller allocation
2026-05-11 15:03 [PATCH 00/12] spi: switch to managed controller allocation (part 3/3) Johan Hovold
` (8 preceding siblings ...)
2026-05-11 15:04 ` [PATCH 09/12] spi: lp8841-rtc: drop unused ifdef Johan Hovold
@ 2026-05-11 15:04 ` Johan Hovold
2026-05-11 15:04 ` [PATCH 11/12] spi: mux: " Johan Hovold
2026-05-11 15:04 ` [PATCH 12/12] spi: xlp: " Johan Hovold
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2026-05-11 15:04 UTC (permalink / raw)
To: Mark Brown
Cc: Eddie James, Yang Shen, Neil Armstrong, Kevin Hilman, linux-spi,
linux-kernel, Johan Hovold
Switch to device managed controller allocation for consistency and to
simplify error handling.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/spi/spi-meson-spifc.c | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/drivers/spi/spi-meson-spifc.c b/drivers/spi/spi-meson-spifc.c
index b818950a8cb7..d700fa315223 100644
--- a/drivers/spi/spi-meson-spifc.c
+++ b/drivers/spi/spi-meson-spifc.c
@@ -288,9 +288,9 @@ static int meson_spifc_probe(struct platform_device *pdev)
struct meson_spifc *spifc;
void __iomem *base;
unsigned int rate;
- int ret = 0;
+ int ret;
- host = spi_alloc_host(&pdev->dev, sizeof(struct meson_spifc));
+ host = devm_spi_alloc_host(&pdev->dev, sizeof(struct meson_spifc));
if (!host)
return -ENOMEM;
@@ -300,23 +300,18 @@ static int meson_spifc_probe(struct platform_device *pdev)
spifc->dev = &pdev->dev;
base = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(base)) {
- ret = PTR_ERR(base);
- goto out_err;
- }
+ if (IS_ERR(base))
+ return PTR_ERR(base);
spifc->regmap = devm_regmap_init_mmio(spifc->dev, base,
&spifc_regmap_config);
- if (IS_ERR(spifc->regmap)) {
- ret = PTR_ERR(spifc->regmap);
- goto out_err;
- }
+ if (IS_ERR(spifc->regmap))
+ return PTR_ERR(spifc->regmap);
spifc->clk = devm_clk_get_enabled(spifc->dev, NULL);
if (IS_ERR(spifc->clk)) {
dev_err(spifc->dev, "missing clock\n");
- ret = PTR_ERR(spifc->clk);
- goto out_err;
+ return PTR_ERR(spifc->clk);
}
rate = clk_get_rate(spifc->clk);
@@ -342,8 +337,7 @@ static int meson_spifc_probe(struct platform_device *pdev)
return 0;
out_pm:
pm_runtime_disable(spifc->dev);
-out_err:
- spi_controller_put(host);
+
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 11/12] spi: mux: switch to managed controller allocation
2026-05-11 15:03 [PATCH 00/12] spi: switch to managed controller allocation (part 3/3) Johan Hovold
` (9 preceding siblings ...)
2026-05-11 15:04 ` [PATCH 10/12] spi: meson-spifc: switch to managed controller allocation Johan Hovold
@ 2026-05-11 15:04 ` Johan Hovold
2026-05-11 15:04 ` [PATCH 12/12] spi: xlp: " Johan Hovold
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2026-05-11 15:04 UTC (permalink / raw)
To: Mark Brown
Cc: Eddie James, Yang Shen, Neil Armstrong, Kevin Hilman, linux-spi,
linux-kernel, Johan Hovold
Switch to device managed controller allocation for consistency and to
simplify error handling.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/spi/spi-mux.c | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/drivers/spi/spi-mux.c b/drivers/spi/spi-mux.c
index bd122de152c0..08fe1fa32dea 100644
--- a/drivers/spi/spi-mux.c
+++ b/drivers/spi/spi-mux.c
@@ -127,9 +127,8 @@ static int spi_mux_probe(struct spi_device *spi)
{
struct spi_controller *ctlr;
struct spi_mux_priv *priv;
- int ret;
- ctlr = spi_alloc_host(&spi->dev, sizeof(*priv));
+ ctlr = devm_spi_alloc_host(&spi->dev, sizeof(*priv));
if (!ctlr)
return -ENOMEM;
@@ -146,9 +145,8 @@ static int spi_mux_probe(struct spi_device *spi)
priv->mux = devm_mux_control_get(&spi->dev, NULL);
if (IS_ERR(priv->mux)) {
- ret = dev_err_probe(&spi->dev, PTR_ERR(priv->mux),
- "failed to get control-mux\n");
- goto err_put_ctlr;
+ return dev_err_probe(&spi->dev, PTR_ERR(priv->mux),
+ "failed to get control-mux\n");
}
priv->current_cs = SPI_MUX_NO_CS;
@@ -164,16 +162,7 @@ static int spi_mux_probe(struct spi_device *spi)
ctlr->must_async = true;
ctlr->defer_optimize_message = true;
- ret = devm_spi_register_controller(&spi->dev, ctlr);
- if (ret)
- goto err_put_ctlr;
-
- return 0;
-
-err_put_ctlr:
- spi_controller_put(ctlr);
-
- return ret;
+ return devm_spi_register_controller(&spi->dev, ctlr);
}
static const struct spi_device_id spi_mux_id[] = {
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 12/12] spi: xlp: switch to managed controller allocation
2026-05-11 15:03 [PATCH 00/12] spi: switch to managed controller allocation (part 3/3) Johan Hovold
` (10 preceding siblings ...)
2026-05-11 15:04 ` [PATCH 11/12] spi: mux: " Johan Hovold
@ 2026-05-11 15:04 ` Johan Hovold
11 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2026-05-11 15:04 UTC (permalink / raw)
To: Mark Brown
Cc: Eddie James, Yang Shen, Neil Armstrong, Kevin Hilman, linux-spi,
linux-kernel, Johan Hovold
Switch to device managed controller allocation for consistency and to
simplify error handling.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/spi/spi-xlp.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/spi/spi-xlp.c b/drivers/spi/spi-xlp.c
index be8bbe1cbba3..d014955e6d4b 100644
--- a/drivers/spi/spi-xlp.c
+++ b/drivers/spi/spi-xlp.c
@@ -398,7 +398,7 @@ static int xlp_spi_probe(struct platform_device *pdev)
xspi->spi_clk = clk_get_rate(clk);
- host = spi_alloc_host(&pdev->dev, 0);
+ host = devm_spi_alloc_host(&pdev->dev, 0);
if (!host) {
dev_err(&pdev->dev, "could not alloc host\n");
return -ENOMEM;
@@ -418,7 +418,6 @@ static int xlp_spi_probe(struct platform_device *pdev)
err = devm_spi_register_controller(&pdev->dev, host);
if (err) {
dev_err(&pdev->dev, "spi register host failed!\n");
- spi_controller_put(host);
return err;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
end of thread, other threads:[~2026-05-11 15:04 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11 15:03 [PATCH 00/12] spi: switch to managed controller allocation (part 3/3) Johan Hovold
2026-05-11 15:03 ` [PATCH 01/12] spi: altera-platform: switch to managed controller allocation Johan Hovold
2026-05-11 15:03 ` [PATCH 02/12] spi: armada-3700: " Johan Hovold
2026-05-11 15:03 ` [PATCH 03/12] spi: clps711x: " Johan Hovold
2026-05-11 15:04 ` [PATCH 04/12] spi: falcon: " Johan Hovold
2026-05-11 15:04 ` [PATCH 05/12] spi: fsi: " Johan Hovold
2026-05-11 15:04 ` [PATCH 06/12] spi: hisi-sfc-v3xx: " Johan Hovold
2026-05-11 15:04 ` [PATCH 07/12] spi: jcore: " Johan Hovold
2026-05-11 15:04 ` [PATCH 08/12] spi: lp8841-rtc: " Johan Hovold
2026-05-11 15:04 ` [PATCH 09/12] spi: lp8841-rtc: drop unused ifdef Johan Hovold
2026-05-11 15:04 ` [PATCH 10/12] spi: meson-spifc: switch to managed controller allocation Johan Hovold
2026-05-11 15:04 ` [PATCH 11/12] spi: mux: " Johan Hovold
2026-05-11 15:04 ` [PATCH 12/12] spi: xlp: " Johan Hovold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox