All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vivek BalachandharTN <vivek.balachandhar@gmail.com>
To: Priit Laes <plaes@plaes.org>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Minu Jin" <s9430939@naver.com>,
	"Archit Anant" <architanant5@gmail.com>,
	"Andy Shevchenko" <andriy.shevchenko@intel.com>,
	"Philip Thayer" <thayerscirez@gmail.com>,
	"Bryant Boatright" <bryant.boatright@proton.me>,
	"JJ Strnad" <strnad.jj@gmail.com>,
	"Dan Carpenter" <dan.carpenter@linaro.org>,
	"William Hansen-Baird" <william.hansen.baird@gmail.com>,
	"Navaneeth K" <knavaneeth786@gmail.com>,
	"Julia Lawall" <julia.lawall@inria.fr>,
	"Tanjim Kamal" <tanjimkamal1@gmail.com>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"Rodrigo Gobbi" <rodrigo.gobbi.7@gmail.com>,
	"Artur Stupa" <arthur.stupa@gmail.com>,
	"Abraham Samuel Adekunle" <abrahamadekunle50@gmail.com>,
	"Michael Straube" <straube.linux@gmail.com>,
	"Hans de Goede" <hansg@kernel.org>,
	"Ingo Molnar" <mingo@kernel.org>,
	"Ethan Tidmore" <ethantidmore06@gmail.com>,
	"Zhuoheng Li" <lizhuoheng@kylinos.cn>,
	"Michael Huang" <tehsiu.huang@gmail.com>,
	"Nino Zhang" <ninozhang001@gmail.com>,
	"Thomas Gleixner" <tglx@kernel.org>,
	"Rogério Fernandes Pereira" <rfp2005@gmail.com>,
	"Diksha Kumari" <dikshakdevgan@gmail.com>,
	yingche <zxcv2569763104@gmail.com>,
	"Karthikey D Kadati" <karthikey3608@gmail.com>,
	"Khushal Chitturi" <khushalchitturi@gmail.com>,
	"SeungJu Cheon" <suunj1331@gmail.com>,
	"Akiyoshi Kurita" <weibu@redadmin.org>,
	"Erick Karanja" <karanja99erick@gmail.com>,
	"Sun Jian" <sun.jian.kdev@gmail.com>,
	"Yuvraj Singh Chauhan" <ysinghcin@gmail.com>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 10/11] staging: rtl8723bs: Clean up wrapper functions
Date: Sat, 21 Feb 2026 16:20:33 -0400	[thread overview]
Message-ID: <694bcd12-7a1c-4be3-8921-20e5b0b88cc0@gmail.com> (raw)
In-Reply-To: <20260221190628.50273-11-plaes@plaes.org>

This change doesn’t really “remove wrapper functions” so much as it 
moves the wrapper bodies into the public APIs, and inlines 
|_rtw_dequeue_cmd()| into |rtw_dequeue_cmd()|.

Minor: the |if (pcmdpriv)| guard in |rtw_free_cmd_priv()| looks 
unnecessary if callers guarantee non-NULL. If you keep it, please point 
to call sites that can pass NULL (or drop the check).

Best, Vivek

On 2026-02-21 3:01 p.m., Priit Laes wrote:
> Remove wrapper functions in cmd queue handling.
>
> Signed-off-by: Priit Laes <plaes@plaes.org>
> ---
>   drivers/staging/rtl8723bs/core/rtw_cmd.c      | 88 ++++++++-----------
>   drivers/staging/rtl8723bs/include/cmd_osdep.h |  7 +-
>   2 files changed, 39 insertions(+), 56 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> index d0694a659259..60e2de7991d4 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> @@ -210,32 +210,6 @@ int rtw_init_evt_priv(struct evt_priv *pevtpriv)
>   	return 0;
>   }
>   
> -void _rtw_free_evt_priv(struct	evt_priv *pevtpriv)
> -{
> -	cancel_work_sync(&pevtpriv->c2h_wk);
> -	while (pevtpriv->c2h_wk_alive)
> -		msleep(10);
> -
> -	while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) {
> -		void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue);
> -
> -		if (c2h && c2h != (void *)pevtpriv)
> -			kfree(c2h);
> -	}
> -	kfree(pevtpriv->c2h_queue);
> -}
> -
> -void _rtw_free_cmd_priv(struct	cmd_priv *pcmdpriv)
> -{
> -	if (pcmdpriv) {
> -		kfree(pcmdpriv->cmd_allocated_buf);
> -
> -		kfree(pcmdpriv->rsp_allocated_buf);
> -
> -		mutex_destroy(&pcmdpriv->sctx_mutex);
> -	}
> -}
> -
>   /*
>    * Calling Context:
>    *
> @@ -246,7 +220,7 @@ void _rtw_free_cmd_priv(struct	cmd_priv *pcmdpriv)
>    *
>    */
>   
> -int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj)
> +static int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj)
>   {
>   	unsigned long irqL;
>   
> @@ -265,38 +239,35 @@ int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj)
>   	return _SUCCESS;
>   }
>   
> -struct	cmd_obj	*_rtw_dequeue_cmd(struct __queue *queue)
> +void rtw_free_evt_priv(struct	evt_priv *pevtpriv)
>   {
> -	unsigned long irqL;
> -	struct cmd_obj *obj;
> -
> -	/* spin_lock_bh(&(queue->lock)); */
> -	spin_lock_irqsave(&queue->lock, irqL);
> -	if (list_empty(&queue->queue)) {
> -		obj = NULL;
> -	} else {
> -		obj = container_of(get_next(&queue->queue), struct cmd_obj, list);
> -		list_del_init(&obj->list);
> -	}
> +	cancel_work_sync(&pevtpriv->c2h_wk);
> +	while (pevtpriv->c2h_wk_alive)
> +		msleep(10);
>   
> -	/* spin_unlock_bh(&(queue->lock)); */
> -	spin_unlock_irqrestore(&queue->lock, irqL);
> +	while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) {
> +		void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue);
>   
> -	return obj;
> -}
> +		if (c2h && c2h != (void *)pevtpriv)
> +			kfree(c2h);
> +	}
> +	kfree(pevtpriv->c2h_queue);
>   
> -void rtw_free_evt_priv(struct	evt_priv *pevtpriv)
> -{
> -	_rtw_free_evt_priv(pevtpriv);
>   }
>   
>   void rtw_free_cmd_priv(struct	cmd_priv *pcmdpriv)
>   {
> -	_rtw_free_cmd_priv(pcmdpriv);
> +	if (pcmdpriv) {
> +		kfree(pcmdpriv->cmd_allocated_buf);
> +
> +		kfree(pcmdpriv->rsp_allocated_buf);
> +
> +		mutex_destroy(&pcmdpriv->sctx_mutex);
> +	}
> +
>   }
>   
> -int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj);
> -int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
> +static int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
>   {
>   	u8 bAllow = false; /* set to true to allow enqueuing cmd when hw_init_completed is false */
>   
> @@ -337,7 +308,24 @@ int rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
>   
>   struct	cmd_obj	*rtw_dequeue_cmd(struct cmd_priv *pcmdpriv)
>   {
> -	return _rtw_dequeue_cmd(&pcmdpriv->cmd_queue);
> +	unsigned long irqL;
> +	struct cmd_obj *obj;
> +	struct __queue *queue = &pcmdpriv->cmd_queue;
> +
> +	/* spin_lock_bh(&(queue->lock)); */
> +	spin_lock_irqsave(&queue->lock, irqL);
> +	if (list_empty(&queue->queue)) {
> +		obj = NULL;
> +	} else {
> +		obj = container_of(get_next(&queue->queue), struct cmd_obj, list);
> +		list_del_init(&obj->list);
> +	}
> +
> +	/* spin_unlock_bh(&(queue->lock)); */
> +	spin_unlock_irqrestore(&queue->lock, irqL);
> +
> +	return obj;
> +
>   }
>   
>   void rtw_free_cmd_obj(struct cmd_obj *pcmd)
> diff --git a/drivers/staging/rtl8723bs/include/cmd_osdep.h b/drivers/staging/rtl8723bs/include/cmd_osdep.h
> index 5506f513dc01..b0ac41d2be24 100644
> --- a/drivers/staging/rtl8723bs/include/cmd_osdep.h
> +++ b/drivers/staging/rtl8723bs/include/cmd_osdep.h
> @@ -7,12 +7,7 @@
>   #ifndef __CMD_OSDEP_H_
>   #define __CMD_OSDEP_H_
>   
> -
> -int rtw_init_cmd_priv(struct	cmd_priv *pcmdpriv);
> +int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv);
>   int rtw_init_evt_priv(struct evt_priv *pevtpriv);
> -extern void _rtw_free_evt_priv(struct	evt_priv *pevtpriv);
> -extern void _rtw_free_cmd_priv(struct	cmd_priv *pcmdpriv);
> -int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj);
> -extern struct	cmd_obj	*_rtw_dequeue_cmd(struct __queue *queue);
>   
>   #endif

  reply	other threads:[~2026-02-21 20:20 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-21 19:01 [PATCH v2 00/11] staging: stl8723bs: Various cleanups Priit Laes
2026-02-21 19:01 ` [PATCH v2 01/11] staging: stl8723bs: Use common round_up macro Priit Laes
2026-02-21 19:41   ` Vivek BalachandharTN
2026-02-23  7:09     ` Dan Carpenter
2026-02-23 10:43       ` Priit Laes
2026-02-23 11:40         ` Julia Lawall
2026-02-23 11:50           ` Andy Shevchenko
2026-02-23 12:16             ` Julia Lawall
2026-02-23 13:48               ` Andy Shevchenko
2026-02-23 14:43         ` Dan Carpenter
2026-02-21 19:01 ` [PATCH v2 02/11] staging: rtl8723bs: Remove unused BIT32..BIT36 definitions Priit Laes
2026-02-21 19:01 ` [PATCH v2 03/11] staging: rtl8723bs: Drop empty rtw_bug_check function Priit Laes
2026-02-21 19:01 ` [PATCH v2 04/11] staging: rtl8723bs: Remove unused rtw_sprintf macro Priit Laes
2026-02-21 19:01 ` [PATCH v2 05/11] staging: rtl8723bs: Drop unused _kfree(...) declaration Priit Laes
2026-02-21 19:01 ` [PATCH v2 06/11] staging: rtl8723bs: Get rid of unused _rtw_init_queue Priit Laes
2026-02-21 19:01 ` [PATCH v2 07/11] staging: rtl8723bs: Drop unused NDEV-related formatting macros Priit Laes
2026-02-21 19:01 ` [PATCH v2 08/11] staging: rtl8723bs: Drop workqueue wrapper functions Priit Laes
2026-02-21 19:01 ` [PATCH v2 09/11] staging: rtl8273bs: Simplify regulatory initialization functions Priit Laes
2026-02-23  7:17   ` Dan Carpenter
2026-02-21 19:01 ` [PATCH v2 10/11] staging: rtl8723bs: Clean up wrapper functions Priit Laes
2026-02-21 20:20   ` Vivek BalachandharTN [this message]
2026-02-23  7:25   ` Dan Carpenter
     [not found]   ` <CAPsOcukZNc3oR=FmAjCdC6NrUV=1CaggQNGPoC2oxuH_P2R0hQ@mail.gmail.com>
2026-02-23  7:50     ` Andy Shevchenko
2026-02-21 19:01 ` [PATCH v2 11/11] staging: rtl8723bs: rtw_ieee80211: Reduce global symbols Priit Laes
2026-02-23  7:32   ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=694bcd12-7a1c-4be3-8921-20e5b0b88cc0@gmail.com \
    --to=vivek.balachandhar@gmail.com \
    --cc=abrahamadekunle50@gmail.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=architanant5@gmail.com \
    --cc=arthur.stupa@gmail.com \
    --cc=bryant.boatright@proton.me \
    --cc=dan.carpenter@linaro.org \
    --cc=dikshakdevgan@gmail.com \
    --cc=ethantidmore06@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hansg@kernel.org \
    --cc=julia.lawall@inria.fr \
    --cc=karanja99erick@gmail.com \
    --cc=karthikey3608@gmail.com \
    --cc=khushalchitturi@gmail.com \
    --cc=knavaneeth786@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=lizhuoheng@kylinos.cn \
    --cc=mingo@kernel.org \
    --cc=ninozhang001@gmail.com \
    --cc=plaes@plaes.org \
    --cc=rdunlap@infradead.org \
    --cc=rfp2005@gmail.com \
    --cc=rodrigo.gobbi.7@gmail.com \
    --cc=s9430939@naver.com \
    --cc=straube.linux@gmail.com \
    --cc=strnad.jj@gmail.com \
    --cc=sun.jian.kdev@gmail.com \
    --cc=suunj1331@gmail.com \
    --cc=tanjimkamal1@gmail.com \
    --cc=tehsiu.huang@gmail.com \
    --cc=tglx@kernel.org \
    --cc=thayerscirez@gmail.com \
    --cc=weibu@redadmin.org \
    --cc=william.hansen.baird@gmail.com \
    --cc=ysinghcin@gmail.com \
    --cc=zxcv2569763104@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.