• Alexandru Ardelean's avatar
    iio: hid-sensors: move triggered buffer setup into hid_sensor_setup_trigger · 067fda1c
    Alexandru Ardelean authored
    The main intent here is to get rid of the iio_buffer_set_attrs() helper, or
    at least rework it's usage a bit.
    The problem with that helper is that it needs a pointer to the buffer,
    which makes supporting multiple buffers per IIO device a bit more
    cumbersome.
    
    The hid_sensor_setup_trigger() is pretty much used in the same way:
    - iio_triggered_buffer_setup() gets called before
    - then hid_sensor_setup_trigger() and hid_sensor_setup_batch_mode() gets
      called which may attach some fifo attributes
    
    This change merges the 2 together under the hid_sensor_setup_trigger()
    function. Only the &iio_pollfunc_store_time is passed to all devices, so
    it's not even required to pass it explicitly outside of the common
    hid_sensor_setup_trigger() function.
    
    Moving the devm_iio_triggered_buffer_setup/cleanup() calls into the common
    place code can help the rework of the buffer code, since it is in one
    place.
    
    One detail of the change is that there are 2 drivers that use
    devm_iio_triggered_buffer_setup(). That function gets implicitly
    replaced with iio_triggered_buffer_setup()/cleanup(), but since all drivers
    call both hid_sensor_setup_trigger9) & hid_sensor_remove_trigger() trigger,
    the iio_triggered_buffer_cleanup() piggy backs on the
    hid_sensor_remove_trigger() call, which should cover the cleanup.
    Signed-off-by: default avatarAlexandru Ardelean <alexandru.ardelean@analog.com>
    Acked-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
    067fda1c
hid-sensor-trigger.h 572 Bytes