mirror of
https://github.com/torvalds/linux.git
synced 2026-06-05 13:06:59 +02:00
iio: adc: ti-ads8688: drop ads8688_remove()
By using a few devm_ functions, we can simplify the driver and remove the ads8688_remove() function. spi_set_drvdata() is removed since there are no more callers of spi_get_drvdata(). Also use dev_err_probe() to simplify error return. Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20240621-iio-regulator-refactor-round-2-v1-9-49e50cd0b99a@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
2867ccf4a2
commit
a4a9fc32f8
|
|
@ -432,8 +432,6 @@ static int ads8688_probe(struct spi_device *spi)
|
|||
|
||||
spi->mode = SPI_MODE_1;
|
||||
|
||||
spi_set_drvdata(spi, indio_dev);
|
||||
|
||||
st->spi = spi;
|
||||
|
||||
indio_dev->name = spi_get_device_id(spi)->name;
|
||||
|
|
@ -446,30 +444,13 @@ static int ads8688_probe(struct spi_device *spi)
|
|||
|
||||
mutex_init(&st->lock);
|
||||
|
||||
ret = iio_triggered_buffer_setup(indio_dev, NULL, ads8688_trigger_handler, NULL);
|
||||
if (ret < 0) {
|
||||
dev_err(&spi->dev, "iio triggered buffer setup failed\n");
|
||||
return ret;
|
||||
}
|
||||
ret = devm_iio_triggered_buffer_setup(&spi->dev, indio_dev, NULL,
|
||||
ads8688_trigger_handler, NULL);
|
||||
if (ret < 0)
|
||||
return dev_err_probe(&spi->dev, ret,
|
||||
"iio triggered buffer setup failed\n");
|
||||
|
||||
ret = iio_device_register(indio_dev);
|
||||
if (ret)
|
||||
goto err_buffer_cleanup;
|
||||
|
||||
return 0;
|
||||
|
||||
err_buffer_cleanup:
|
||||
iio_triggered_buffer_cleanup(indio_dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void ads8688_remove(struct spi_device *spi)
|
||||
{
|
||||
struct iio_dev *indio_dev = spi_get_drvdata(spi);
|
||||
|
||||
iio_device_unregister(indio_dev);
|
||||
iio_triggered_buffer_cleanup(indio_dev);
|
||||
return devm_iio_device_register(&spi->dev, indio_dev);
|
||||
}
|
||||
|
||||
static const struct spi_device_id ads8688_id[] = {
|
||||
|
|
@ -492,7 +473,6 @@ static struct spi_driver ads8688_driver = {
|
|||
.of_match_table = ads8688_of_match,
|
||||
},
|
||||
.probe = ads8688_probe,
|
||||
.remove = ads8688_remove,
|
||||
.id_table = ads8688_id,
|
||||
};
|
||||
module_spi_driver(ads8688_driver);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user