mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-21 22:47:51 -04:00
spi: mux: switch to managed controller allocation
Switch to device managed controller allocation for consistency and to simplify error handling. Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260511150408.796155-12-johan@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
@@ -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[] = {
|
||||
|
||||
Reference in New Issue
Block a user