mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Hungyu Lin <dennylin0707@gmail.com>
Cc: Dan Carpenter <error27@gmail.com>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] staging: rtl8723bs: use errno in rtw_register_tx_alive()
Date: Thu, 1 Oct 2026 13:17:13 +0200	[thread overview]
Message-ID: <2026100153-barber-financial-29f4@gregkh> (raw)
In-Reply-To: <20261001100319.6228-1-dennylin0707@gmail.com>

On Thu, Oct 01, 2026 at 10:03:19AM +0000, Hungyu Lin wrote:
> rtw_register_tx_alive() uses the driver-specific _SUCCESS and _FAIL
> values to report whether the transmit path can continue.
> 
> Use the usual kernel convention of returning 0 on success and -EAGAIN
> when the transmit path cannot proceed yet. Update the caller
> accordingly.
> 
> No functional change.
> 
> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
> ---
> Changes in v2:
> - Use the standard 0/-errno return convention instead of bool, as
>   suggested by Greg.
> - Return -EAGAIN when the transmit path cannot proceed yet.
> 
>  drivers/staging/rtl8723bs/core/rtw_pwrctrl.c    | 13 ++++++-------
>  drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c  |  3 +--
>  drivers/staging/rtl8723bs/include/rtw_pwrctrl.h |  2 +-
>  3 files changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
> index 448611ad8237..00d64b2ff89e 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
> @@ -771,13 +771,12 @@ void rtw_unregister_task_alive(struct adapter *padapter, u32 task)
>   * _SUCCESS	rtw_xmit_thread can write fifo/txcmd afterwards.
>   * _FAIL		rtw_xmit_thread can not do anything.
>   */
> -s32 rtw_register_tx_alive(struct adapter *padapter)
> +int rtw_register_tx_alive(struct adapter *padapter)
>  {
> -	s32 res;
> +	int ret = 0;
>  	struct pwrctrl_priv *pwrctrl;
>  	u8 pslv;
>  
> -	res = _SUCCESS;
>  	pwrctrl = adapter_to_pwrctl(padapter);
>  	pslv = PS_STATE_S2;
>  
> @@ -788,7 +787,7 @@ s32 rtw_register_tx_alive(struct adapter *padapter)
>  	if (pwrctrl->fw_current_in_ps_mode) {
>  		if (pwrctrl->cpwm < pslv) {
>  			if (pwrctrl->cpwm < PS_STATE_S2)
> -				res = _FAIL;
> +				ret = -EAGAIN;
>  			if (pwrctrl->rpwm < pslv)
>  				rtw_set_rpwm(padapter, pslv);
>  		}
> @@ -796,11 +795,11 @@ s32 rtw_register_tx_alive(struct adapter *padapter)
>  
>  	mutex_unlock(&pwrctrl->lock);
>  
> -	if (res == _FAIL)
> +	if (ret)
>  		if (pwrctrl->cpwm >= PS_STATE_S2)
> -			res = _SUCCESS;
> +			ret = 0;
>  
> -	return res;
> +	return ret;
>  }
>  
>  /*
> diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
> index 0441e84ea87d..77e5adc8731e 100644
> --- a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
> +++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
> @@ -140,9 +140,8 @@ s32 rtl8723bs_xmit_buf_handler(struct adapter *padapter)
>  		return _SUCCESS;
>  
>  	ret = rtw_register_tx_alive(padapter);
> -	if (ret != _SUCCESS) {
> +	if (ret)
>  		return _SUCCESS;
> -	}

Why are we returning success if there is an error?

thanks,

greg k-h

  reply	other threads:[~2026-10-01 11:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01 10:03 Hungyu Lin
2026-10-01 11:17 ` Greg Kroah-Hartman [this message]
2026-10-01 11:56   ` Hungyu Lin
2026-10-01 12:12     ` Greg Kroah-Hartman

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=2026100153-barber-financial-29f4@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=dennylin0707@gmail.com \
    --cc=error27@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®