iio: gyro: st_gyro: use devm_iio_triggered_buffer_setup() for buffer
authorAlexandru Ardelean <aardelean@deviqon.com>
Tue, 20 Jul 2021 07:46:42 +0000 (10:46 +0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 24 Jul 2021 15:35:05 +0000 (16:35 +0100)
commita574e68ff5135d4782260ad38d4b29b8e94e44d6
treebae47b4a0b6f5eee878af7bb2da9a16be06810c3
parent899f6791469f658d395199c33997391cdd53fa5e
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>
drivers/iio/gyro/st_gyro.h
drivers/iio/gyro/st_gyro_buffer.c
drivers/iio/gyro/st_gyro_core.c