diff options
author | Alexandru Ardelean <aardelean@deviqon.com> | 2021-07-20 10:46:42 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2021-07-24 16:35:05 +0100 |
commit | a574e68ff5135d4782260ad38d4b29b8e94e44d6 (patch) | |
tree | bae47b4a0b6f5eee878af7bb2da9a16be06810c3 /drivers/iio/gyro/st_gyro_buffer.c | |
parent | 899f6791469f658d395199c33997391cdd53fa5e (diff) | |
download | linux-a574e68ff5135d4782260ad38d4b29b8e94e44d6.tar.gz linux-a574e68ff5135d4782260ad38d4b29b8e94e44d6.tar.bz2 linux-a574e68ff5135d4782260ad38d4b29b8e94e44d6.zip |
iio: gyro: st_gyro: use devm_iio_triggered_buffer_setup() for buffer
The st_gyro_allocate_ring() function calls iio_triggered_buffer_setup() to
allocate a triggered buffer.
But the same can be done with devm_iio_triggered_buffer_setup() and then
the st_gyro_common_remove() no longer needs to manually deallocate it.
We know that the parent of the IIO device is used to manage other instances
of the devm unwind, so it can be used in the st_gyro_allocate_ring() as
well.
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210720074642.223293-4-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/gyro/st_gyro_buffer.c')
-rw-r--r-- | drivers/iio/gyro/st_gyro_buffer.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/iio/gyro/st_gyro_buffer.c b/drivers/iio/gyro/st_gyro_buffer.c index 02b5562b6585..4ae33ef25b9c 100644 --- a/drivers/iio/gyro/st_gyro_buffer.c +++ b/drivers/iio/gyro/st_gyro_buffer.c @@ -61,13 +61,8 @@ static const struct iio_buffer_setup_ops st_gyro_buffer_setup_ops = { int st_gyro_allocate_ring(struct iio_dev *indio_dev) { - return iio_triggered_buffer_setup(indio_dev, NULL, - &st_sensors_trigger_handler, &st_gyro_buffer_setup_ops); -} - -void st_gyro_deallocate_ring(struct iio_dev *indio_dev) -{ - iio_triggered_buffer_cleanup(indio_dev); + return devm_iio_triggered_buffer_setup(indio_dev->dev.parent, indio_dev, + NULL, &st_sensors_trigger_handler, &st_gyro_buffer_setup_ops); } MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>"); |