Hi,
this is a small cleanup of kfifo.
More importantly, it introduces three helpers: kfifo_skip_count(),
kfifo_out_linear() and kfifo_out_linear_ptr(). They allow using kfifo in
the serial layer.
They are needed as up to now, there is no way to "peek" the data without
actually copying to a temporary buffer. kfifo_out_linear*() allow that
and kfifo_skip_count() then allows for tail moving after the copy is
done. Note the copy is usually performed directly to hardware e.g. via
outb(), hence the need for peek without copying anywhere.
Jiri Slaby (SUSE) (4):
kfifo: drop __kfifo_dma_out_finish_r()
kfifo: introduce and use kfifo_skip_count()
kfifo: add kfifo_out_linear{,_ptr}()
kfifo: fix typos in kernel-doc
include/linux/kfifo.h | 105 +++++++++++++++++++++++++++++++++---------
lib/kfifo.c | 36 +++++++++++----
2 files changed, 111 insertions(+), 30 deletions(-)
--
2.43.2
On 23. 02. 24, 12:51, Jiri Slaby (SUSE) wrote:
> Hi,
>
> this is a small cleanup of kfifo.
>
> More importantly, it introduces three helpers: kfifo_skip_count(),
> kfifo_out_linear() and kfifo_out_linear_ptr(). They allow using kfifo in
> the serial layer.
>
> They are needed as up to now, there is no way to "peek" the data without
> actually copying to a temporary buffer. kfifo_out_linear*() allow that
> and kfifo_skip_count() then allows for tail moving after the copy is
> done. Note the copy is usually performed directly to hardware e.g. via
> outb(), hence the need for peek without copying anywhere.
Sorry, this reasoning is bogus. outb() would be using kfifo_out(), of
course.
The requirement comes from (for example):
* memcpy_toio() in neo_copy_data_from_queue_to_uart(),
* regmap_noinc_write() in max310x_handle_tx()),
* and similar.
The kfifo data are there directly copied to HW in a batch, without the
need of temp buffers.
thanks,
--
js
suse labs