summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2026-04-29 11:13:18 +0200
committerMark Brown <broonie@kernel.org>2026-05-04 22:09:20 +0900
commitfe010594a8575715b879956dfb970894431dd69f (patch)
treecbcbf7c86ed1dbc9356ca6dc513a9ed9466cc384
parent414c359e7295d383e6bf2321eb7499f95008f1a8 (diff)
downloadlinux-fe010594a8575715b879956dfb970894431dd69f.tar.gz
linux-fe010594a8575715b879956dfb970894431dd69f.zip
spi: bcm63xx-hsspi: 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> Acked-by: William Zhang <william.zhang@broadcom.com> Link: https://patch.msgid.link/20260429091333.165363-5-johan@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-bcm63xx-hsspi.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/spi/spi-bcm63xx-hsspi.c b/drivers/spi/spi-bcm63xx-hsspi.c
index e935e8ab9cfd..58012e1b5ae7 100644
--- a/drivers/spi/spi-bcm63xx-hsspi.c
+++ b/drivers/spi/spi-bcm63xx-hsspi.c
@@ -783,7 +783,7 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)
"failed get pll clk rate\n");
}
- host = spi_alloc_host(&pdev->dev, sizeof(*bs));
+ host = devm_spi_alloc_host(&pdev->dev, sizeof(*bs));
if (!host)
return dev_err_probe(dev, -ENOMEM, "alloc host no mem\n");
@@ -796,10 +796,8 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)
bs->fifo = (u8 __iomem *)(bs->regs + HSSPI_FIFO_REG(0));
bs->wait_mode = HSSPI_WAIT_MODE_POLLING;
bs->prepend_buf = devm_kzalloc(dev, HSSPI_BUFFER_LEN, GFP_KERNEL);
- if (!bs->prepend_buf) {
- ret = -ENOMEM;
- goto out_put_host;
- }
+ if (!bs->prepend_buf)
+ return -ENOMEM;
mutex_init(&bs->bus_mutex);
mutex_init(&bs->msg_mutex);
@@ -845,7 +843,7 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)
pdev->name, bs);
if (ret)
- goto out_put_host;
+ return ret;
}
pm_runtime_enable(&pdev->dev);
@@ -869,8 +867,7 @@ out_sysgroup_disable:
sysfs_remove_group(&pdev->dev.kobj, &bcm63xx_hsspi_group);
out_pm_disable:
pm_runtime_disable(&pdev->dev);
-out_put_host:
- spi_controller_put(host);
+
return ret;
}
@@ -880,15 +877,11 @@ static void bcm63xx_hsspi_remove(struct platform_device *pdev)
struct spi_controller *host = platform_get_drvdata(pdev);
struct bcm63xx_hsspi *bs = spi_controller_get_devdata(host);
- spi_controller_get(host);
-
spi_unregister_controller(host);
/* reset the hardware and block queue progress */
__raw_writel(0, bs->regs + HSSPI_INT_MASK_REG);
sysfs_remove_group(&pdev->dev.kobj, &bcm63xx_hsspi_group);
-
- spi_controller_put(host);
}
#ifdef CONFIG_PM_SLEEP