diff options
| author | Johan Hovold <johan@kernel.org> | 2026-05-05 09:28:50 +0200 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-05-11 09:55:39 +0900 |
| commit | 4af89d7d8552a1f0437521acf89fa51601bce973 (patch) | |
| tree | 245b4d57c8e4711da1ee298e4a59228f460256a1 | |
| parent | 5d6919055dec134de3c40167a490f33c74c12581 (diff) | |
| download | linux-4af89d7d8552a1f0437521acf89fa51601bce973.tar.gz linux-4af89d7d8552a1f0437521acf89fa51601bce973.zip | |
spi: pic32: switch to managed controller allocation
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>
Link: https://patch.msgid.link/20260505072909.618363-2-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
| -rw-r--r-- | drivers/spi/spi-pic32.c | 11 |
1 files 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[] = { |
