Re: [PATCH v4] staging: rtl8723bs: Replace custom rtw_cbuf with kfifo
From: Greg KH
Date: Thu Aug 06 2026 - 00:53:35 EST
On Wed, Aug 05, 2026 at 06:33:16PM +0000, Ashmit Kumar wrote:
> The rtl8723bs driver implemented its own custom circular buffer
> (rtw_cbuf) for c2h event handling. The kernel already provides a standard,
> lockless circular buffer implementation in <linux/kfifo.h>.
>
> This patch replaces the custom rtw_cbuf struct and its associated
> functions with the standard kfifo API (kfifo_alloc, kfifo_put,
> kfifo_get, kfifo_is_empty, kfifo_free), simplifying the driver code
> and relying on the robust kernel infrastructure. Furthermore, the allocation
> size is simplified to C2H_QUEUE_MAX_LEN, dropping the vestigial + 1 that
> the original naive ring buffer required to disambiguate full from empty.
>
> Suggested-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Ashmit Kumar <work.ashmitkumar@xxxxxxxxx>
> ---
> Changes in v4:
> - Abandoned ternary operator style fixes in favor of completely
> replacing the custom rtw_cbuf ring buffer with the standard Linux
> kfifo API, as suggested by Greg Kroah-Hartman.
Great, how was this tested?
> @@ -58,7 +59,7 @@
> struct evt_priv {
> struct work_struct c2h_wk;
> bool c2h_wk_alive;
> - struct rtw_cbuf *c2h_queue;
> + DECLARE_KFIFO_PTR(c2h_queue, void *);
Why did you loose the type of the pointer? Was a LLM used to create
this change?
thanks,
greg k-h