summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2026-05-05 10:28:52 +0300
committerMark Brown <broonie@kernel.org>2026-05-11 03:55:40 +0300
commit02efc5557c8e4202b1c5d260ec532986e9769897 (patch)
tree8209d8436ad5e611e94b943511c6704adcc1bd92
parentdda3a77e1a32b329d3c543a1ac236106acf64ec5 (diff)
downloadlinux-02efc5557c8e4202b1c5d260ec532986e9769897.tar.xz
spi: pl022: 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> Reviewed-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/20260505072909.618363-4-johan@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-pl022.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c
index 9c0211f94fd0..95652df5fd09 100644
--- a/drivers/spi/spi-pl022.c
+++ b/drivers/spi/spi-pl022.c
@@ -1868,7 +1868,7 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id)
}
/* Allocate host with space for data */
- host = spi_alloc_host(dev, sizeof(struct pl022));
+ host = devm_spi_alloc_host(dev, sizeof(struct pl022));
if (host == NULL) {
dev_err(&adev->dev, "probe - cannot alloc SPI host\n");
return -ENOMEM;
@@ -1907,7 +1907,7 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id)
status = amba_request_regions(adev, NULL);
if (status)
- goto err_no_ioregion;
+ return status;
pl022->phybase = adev->res.start;
pl022->virtbase = devm_ioremap(dev, adev->res.start,
@@ -1984,8 +1984,7 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id)
err_no_clk:
err_no_ioremap:
amba_release_regions(adev);
- err_no_ioregion:
- spi_controller_put(host);
+
return status;
}
@@ -1997,8 +1996,6 @@ pl022_remove(struct amba_device *adev)
if (!pl022)
return;
- spi_controller_get(pl022->host);
-
spi_unregister_controller(pl022->host);
/*
@@ -2012,8 +2009,6 @@ pl022_remove(struct amba_device *adev)
pl022_dma_remove(pl022);
amba_release_regions(adev);
-
- spi_controller_put(pl022->host);
}
#ifdef CONFIG_PM_SLEEP