forked from Minki/linux
iio: adis16460: Use Managed device functions
Use the adis managed device functions to setup the buffer and the trigger. The ultimate goal will be to completely drop the non devm version from the lib. Since we are here, drop the `.remove` callback by further using devm functions. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20200915120258.161587-7-nuno.sa@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
f13aa06442
commit
fa623cddc0
@ -403,7 +403,7 @@ static int adis16460_probe(struct spi_device *spi)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = adis_setup_buffer_and_trigger(&st->adis, indio_dev, NULL);
|
||||
ret = devm_adis_setup_buffer_and_trigger(&st->adis, indio_dev, NULL);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@ -411,30 +411,14 @@ static int adis16460_probe(struct spi_device *spi)
|
||||
|
||||
ret = __adis_initial_startup(&st->adis);
|
||||
if (ret)
|
||||
goto error_cleanup_buffer;
|
||||
return ret;
|
||||
|
||||
ret = iio_device_register(indio_dev);
|
||||
ret = devm_iio_device_register(&spi->dev, indio_dev);
|
||||
if (ret)
|
||||
goto error_cleanup_buffer;
|
||||
return ret;
|
||||
|
||||
adis16460_debugfs_init(indio_dev);
|
||||
|
||||
return 0;
|
||||
|
||||
error_cleanup_buffer:
|
||||
adis_cleanup_buffer_and_trigger(&st->adis, indio_dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int adis16460_remove(struct spi_device *spi)
|
||||
{
|
||||
struct iio_dev *indio_dev = spi_get_drvdata(spi);
|
||||
struct adis16460 *st = iio_priv(indio_dev);
|
||||
|
||||
iio_device_unregister(indio_dev);
|
||||
|
||||
adis_cleanup_buffer_and_trigger(&st->adis, indio_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -457,7 +441,6 @@ static struct spi_driver adis16460_driver = {
|
||||
},
|
||||
.id_table = adis16460_ids,
|
||||
.probe = adis16460_probe,
|
||||
.remove = adis16460_remove,
|
||||
};
|
||||
module_spi_driver(adis16460_driver);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user