Revert "Local backend: Try to enable high-speed mode after re-enabling buffer"

I don't remember why I did this commit in the first place; apparently
the high-speed mmap interface should be created when the buffer is
disabled. Maybe it was needed for an older kernel, who knows.

This reverts commit 7798e283f6b367313437804cea55840ed8324842.

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Local backend: Fix uninitialized variable

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Local backend: mmap the buffers with PROT_READ | PROT_WRITE

This permits to use the high-speed mmap interface to output samples as
well.

Also add a warning when the high-speed mode couldn't be enabled.

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Change prototype of backend function get_buffer

It was previously taking a channel mask as argument, which ended up
unused. As the local backend is the only backend which will ever
implement the get_buffer function, we can assume that the channel mask
will not change.

Instead, the prototype now takes a size_t parameter which corresponds to
the number of bytes present in the buffer that should be pushed to the
hardware. When using the high-speed mmap interface on an input device,
it is safe to set that value to zero; it is only useful with output
devices.

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Dequeue the first kernel buffer when creating the iio_buffer

Otherwise, when using the high-speed mmap interface the internal buffer
is not initialized and functions like iio_buffer_start() segfault.

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Use the high-speed mmap interface to push buffers

This also slightly changes the prototype of the API function
iio_buffer_push, which were accepting a pointer to a const iio_buffer
structure previously, and now takes a pointer to a non-const iio_buffer.

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>