As proposed by Alexandru, memory allocation and de-allocation can be performed in a more neat way in st_sensors_buffer. Denis Ciocca (5): iio:common: introduce st_sensors_buffer_preenable/predisable functions iio:accel: do not allocate/de-allocate buffer here but link setup_ops to st_sensors_buffer iio:gyro: do not allocate/de-allocate buffer here but link setup_ops to st_sensors_buffer iio:magn: do not allocate/de-allocate buffer here but link setup_ops to st_sensors_buffer iio:pressure: do not allocate/de-allocate buffer here but link setup_ops to st_sensors_buffer drivers/iio/accel/st_accel_buffer.c | 14 +++--------- .../iio/common/st_sensors/st_sensors_buffer.c | 22 +++++++++++++++++++ drivers/iio/gyro/st_gyro_buffer.c | 14 +++--------- drivers/iio/magnetometer/st_magn_buffer.c | 14 +++--------- drivers/iio/pressure/st_pressure_buffer.c | 14 +++--------- include/linux/iio/common/st_sensors.h | 2 ++ 6 files changed, 36 insertions(+), 44 deletions(-) -- 2.22.0