local: Track requested and allocated number of blocks independently
local: Track requested and allocated number of blocks independently

The set_kernel_buffers_count() API allows to request the number of blocks
that are going to be allocated for the buffer.

There are two cases when this number is overwritten:
	* In the cyclic buffer case where only 1 is allocated
	* When not enough system memory is available the number of blocks is
	  reduced to the number of blocks that the system was able to allocate

Both cases overwrite the through set_kernel_buffers_count() set value (or the
default) for the number of blocks to allocate. This means that for example
allocating a non-cyclic buffer on a device for which previously a cyclic
buffer had been allocated the number of blocks is 1 without an additional
explicit call to set_kernel_buffers_count(). Similar behavior will occur
for the case where not all blocks could be allocated. This is unexpected
and non-intentional behavior.

To avoid this track the maximum number of blocks configured through
set_kernel_buffers_count() independently of the number of blocks allocated.
This makes sure that when a new buffer is allocated it still uses the
correct number of blocks regardless of what happened for the previous
buffer.

Signed-off-by: Lars-Peter Clausen <3318dc5ce3e4fb7c28a0b841b6801c884e1d0896@metafoo.de>

analogdevicesinc/libiio,analogdevicesinc/libiio,analogdevicesinc/libiio,analogdevicesinc/libiio