iio: buffer-dmaengine: adjust `bytes_used` with residue info
authorAlexandru Ardelean <alexandru.ardelean@analog.com>
Wed, 26 Aug 2020 05:20:11 +0000 (07:20 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Thu, 3 Sep 2020 18:40:58 +0000 (19:40 +0100)
commit65e02d0b5039f393c1918e992322ebbb5f077490
tree2bee6b3fdcf55dd82ff2e4a6b848fb62930b4b32
parente7b61fc4ca5e7c6869f224d56c5c585fea884c94
iio: buffer-dmaengine: adjust `bytes_used` with residue info

A transfer may fall shorter than the bytes in the block.
This information is available in the residue from the DMA engine, so we can
compute actual `bytes_used` with that by subtracting the residue.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20200826052011.13348-1-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/buffer/industrialio-buffer-dmaengine.c