lkml.org 
[lkml]   [2026]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 01/20] spi: pic32: switch to managed controller allocation
Date
Switch to device managed controller allocation to simplify error
handling and to avoid having to take another reference during
deregistration.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/spi/spi-pic32.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c
index 70427e529945..972128271e4b 100644
--- a/drivers/spi/spi-pic32.c
+++ b/drivers/spi/spi-pic32.c
@@ -752,7 +752,7 @@ static int pic32_spi_probe(struct platform_device *pdev)
struct pic32_spi *pic32s;
int ret;

- host = spi_alloc_host(&pdev->dev, sizeof(*pic32s));
+ host = devm_spi_alloc_host(&pdev->dev, sizeof(*pic32s));
if (!host)
return -ENOMEM;

@@ -761,7 +761,7 @@ static int pic32_spi_probe(struct platform_device *pdev)

ret = pic32_spi_hw_probe(pdev, pic32s);
if (ret)
- goto err_host;
+ return ret;

host->dev.of_node = pdev->dev.of_node;
host->mode_bits = SPI_MODE_3 | SPI_MODE_0 | SPI_CS_HIGH;
@@ -833,8 +833,7 @@ static int pic32_spi_probe(struct platform_device *pdev)

err_bailout:
pic32_spi_dma_unprep(pic32s);
-err_host:
- spi_controller_put(host);
+
return ret;
}

@@ -842,14 +841,10 @@ static void pic32_spi_remove(struct platform_device *pdev)
{
struct pic32_spi *pic32s = platform_get_drvdata(pdev);

- spi_controller_get(pic32s->host);
-
spi_unregister_controller(pic32s->host);

pic32_spi_disable(pic32s);
pic32_spi_dma_unprep(pic32s);
-
- spi_controller_put(pic32s->host);
}

static const struct of_device_id pic32_spi_of_match[] = {
--
2.53.0

\
 
 \ /
  Last update: 2026-05-05 09:30    [W:0.128 / U:11.465 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog