• Lars-Peter Clausen's avatar
    iio: Update buffer's bytes per datum after updating the scan mask · 8e050996
    Lars-Peter Clausen authored
    Currently a IIO device driver needs to make sure to update the buffer's bytes
    per datum after the scan mask has changed. This is usually done in the preenable
    callback by invoking iio_sw_buffer_preenable(). This is something that needs to
    be done and is done for virtually all devices which support buffers (we
    currently have only one exception). Also this a bit of a layering violation
    since we have to call the buffer setup ops from the device setup ops. This
    requires the device driver to know about the internal requirements of the buffer
    (e.g. whether we need to call the set_bytes_per_datum) callback. And especially
    with in-kernel buffer consumers, which allows to attach arbitrary buffers to a
    device, this is something that the driver can't know.
    
    Moving this to the core allows us to drop the individual calls to
    iio_sw_buffer_preenable() from drivers.
    Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
    Cc: Denis Ciocca <denis.ciocca@st.com>
    Cc: Marek Vasut <marex@denx.de>
    Cc: Zubair Lutfullah <zubair.lutfullah@gmail.com>
    Cc: Jacek Anaszewski <j.anaszewski@samsung.com>
    Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
    8e050996
industrialio-buffer.c 26.6 KB