Re: [PATCH v4] staging: rtl8723bs: Replace custom rtw_cbuf with kfifo

Greg KH <[email protected]>
Newsgroups org.kernel.vger.linux-kernel,dev.linux.lists.linux-staging,org.kernel.vger.linux-media
Message-ID <2026080628-album-pandemic-ddff@gregkh>
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 <[email protected]>
> Signed-off-by: Ashmit Kumar <[email protected]>
> ---
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.