Re: [PATCH 0/4] kfifo: small cleanup + linear and skip helpers

From: Jiri Slaby
Date: Fri Feb 23 2024 - 07:08:26 EST


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