Linux kernel staging patches
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: artur.ugnivenko@gmx.de
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	linux-staging@lists.linux.dev, ahmet@sezginduran.net
Subject: Re: [PATCH v8 3/3] staging: rtl8723bs: refactor queue priority initialization
Date: Thu, 28 May 2026 10:42:14 +0300	[thread overview]
Message-ID: <ahfx1lZoIlL4IeCs@stanley.mountain> (raw)
In-Reply-To: <20260525173619.5012-1-artur.ugnivenko@gmx.de>

On Mon, May 25, 2026 at 07:36:19PM +0200, artur.ugnivenko@gmx.de wrote:
> From: Artur Ugnivenko <artur.ugnivenko@gmx.de>
> 
> Pack individual priority values into an enum-indexed array
> to simplify the initialization code and prevent passing around
> six loose values as function parameters.
> 
> Signed-off-by: Artur Ugnivenko <artur.ugnivenko@gmx.de>
> ---
> Changes in v8:
> - Remove the struct from v7, use an enum-indexed array instead
> - Remove other lines ending in parentheses fixes to keep the
>   commit small
> Changes in v7:
> - Add changelog.
> - Add transmit_queues struct in include/drv_types.h to improve
>   style of _InitNormalChipRegPriority
> Changes in v6: Make the patch apply to gregkh/staging-testing.
> Changes in v5: No changes in this patch.
> Changes in v4: No changes in this patch.
> Changes in v3: Split the patch into multiple patches.
> Changes in v2: Make patch apply to gregkh/staging-testing.
> 
>  drivers/staging/rtl8723bs/hal/sdio_halinit.c  | 108 +++++++++---------
>  drivers/staging/rtl8723bs/include/drv_types.h |  10 ++
>  2 files changed, 65 insertions(+), 53 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
> index 6f2aea984b30..01911188fd44 100644
> --- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c
> +++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
> @@ -188,25 +188,18 @@ static void _InitTxBufferBoundary(struct adapter *padapter)
>  	rtw_write8(padapter, REG_TDECTRL + 1, txpktbuf_bndy);
>  }
>  
> -static void _InitNormalChipRegPriority(
> -	struct adapter *Adapter,
> -	u16 beQ,
> -	u16 bkQ,
> -	u16 viQ,
> -	u16 voQ,
> -	u16 mgtQ,
> -	u16 hiQ
> -)
> +static void _InitNormalChipRegPriority(struct adapter *Adapter,
> +				       u16 queues[TX_Q_MAX])
>  {
>  	u16 value16 = (rtw_read16(Adapter, REG_TRXDMA_CTRL) & 0x7);
>  
>  	value16 |=
> -		_TXDMA_BEQ_MAP(beQ)  |
> -		_TXDMA_BKQ_MAP(bkQ)  |
> -		_TXDMA_VIQ_MAP(viQ)  |
> -		_TXDMA_VOQ_MAP(voQ)  |
> -		_TXDMA_MGQ_MAP(mgtQ) |
> -		_TXDMA_HIQ_MAP(hiQ);
> +		_TXDMA_BEQ_MAP(queues[TX_Q_BE])  |
> +		_TXDMA_BKQ_MAP(queues[TX_Q_BK])  |
> +		_TXDMA_VIQ_MAP(queues[TX_Q_VI])  |
> +		_TXDMA_VOQ_MAP(queues[TX_Q_VO])  |
> +		_TXDMA_MGQ_MAP(queues[TX_Q_MGT]) |
> +		_TXDMA_HIQ_MAP(queues[TX_Q_HI]);
>  
>  	rtw_write16(Adapter, REG_TRXDMA_CTRL, value16);
>  }
> @@ -231,17 +224,18 @@ static void _InitNormalChipOneOutEpPriority(struct adapter *Adapter)
>  		break;
>  	}
>  
> -	_InitNormalChipRegPriority(
> -		Adapter, value, value, value, value, value, value
> -	);
> +	u16 queues[TX_Q_MAX];

Don't declare a variable in the middle of a function.

> +
> +	for (int i = 0; i < TX_Q_MAX; i++)
> +		queues[i] = value;
>  
> +	_InitNormalChipRegPriority(Adapter, queues);
>  }
>  
>  static void _InitNormalChipTwoOutEpPriority(struct adapter *Adapter)
>  {
>  	struct hal_com_data *pHalData = GET_HAL_DATA(Adapter);
>  	struct registry_priv *pregistrypriv = &Adapter->registrypriv;
> -	u16 beQ, bkQ, viQ, voQ, mgtQ, hiQ;
>  
>  	u16 valueHi = 0;
>  	u16 valueLow = 0;
> @@ -263,50 +257,58 @@ static void _InitNormalChipTwoOutEpPriority(struct adapter *Adapter)
>  		break;
>  	}
>  
> +	u16 typical_queues[TX_Q_MAX] = {
> +		[TX_Q_BE] = valueLow,
> +		[TX_Q_BK] = valueLow,
> +		[TX_Q_VI] = valueHi,
> +		[TX_Q_VO] = valueHi,
> +		[TX_Q_MGT] = valueHi,
> +		[TX_Q_HI] = valueHi,
> +	};
> +
> +	u16 wmm_queues[TX_Q_MAX] = {
> +		[TX_Q_BE] = valueLow,
> +		[TX_Q_BK] = valueHi,
> +		[TX_Q_VI] = valueHi,
> +		[TX_Q_VO] = valueLow,
> +		[TX_Q_MGT] = valueHi,
> +		[TX_Q_HI] = valueHi,
> +	};

Same.

> +
>  	if (!pregistrypriv->wifi_spec) {
> -		beQ = valueLow;
> -		bkQ = valueLow;
> -		viQ = valueHi;
> -		voQ = valueHi;
> -		mgtQ = valueHi;
> -		hiQ = valueHi;
> +		_InitNormalChipRegPriority(Adapter, typical_queues);
>  	} else {
>  		/* for WMM , CONFIG_OUT_EP_WIFI_MODE */
> -		beQ = valueLow;
> -		bkQ = valueHi;
> -		viQ = valueHi;
> -		voQ = valueLow;
> -		mgtQ = valueHi;
> -		hiQ = valueHi;
> +		_InitNormalChipRegPriority(Adapter, wmm_queues);
>  	}
> -
> -	_InitNormalChipRegPriority(Adapter, beQ, bkQ, viQ, voQ, mgtQ, hiQ);
> -
>  }
>  
>  static void _InitNormalChipThreeOutEpPriority(struct adapter *padapter)
>  {
>  	struct registry_priv *pregistrypriv = &padapter->registrypriv;
> -	u16 beQ, bkQ, viQ, voQ, mgtQ, hiQ;
>  
> -	if (!pregistrypriv->wifi_spec) {
> -		/*  typical setting */
> -		beQ = QUEUE_LOW;
> -		bkQ = QUEUE_LOW;
> -		viQ = QUEUE_NORMAL;
> -		voQ = QUEUE_HIGH;
> -		mgtQ = QUEUE_HIGH;
> -		hiQ = QUEUE_HIGH;
> -	} else {
> -		/*  for WMM */
> -		beQ = QUEUE_LOW;
> -		bkQ = QUEUE_NORMAL;
> -		viQ = QUEUE_NORMAL;
> -		voQ = QUEUE_HIGH;
> -		mgtQ = QUEUE_HIGH;
> -		hiQ = QUEUE_HIGH;
> -	}
> -	_InitNormalChipRegPriority(padapter, beQ, bkQ, viQ, voQ, mgtQ, hiQ);
> +	u16 typical_queues[TX_Q_MAX] = {
> +		[TX_Q_BE] = QUEUE_LOW,
> +		[TX_Q_BK] = QUEUE_LOW,
> +		[TX_Q_VI] = QUEUE_NORMAL,
> +		[TX_Q_VO] = QUEUE_HIGH,
> +		[TX_Q_MGT] = QUEUE_HIGH,
> +		[TX_Q_HI] = QUEUE_HIGH,
> +	};
> +

No blank lines in the declaration block.

regards,
dan carpenter

> +	u16 wmm_queues[TX_Q_MAX] = {
> +		[TX_Q_BE] = QUEUE_LOW,
> +		[TX_Q_BK] = QUEUE_NORMAL,
> +		[TX_Q_VI] = QUEUE_NORMAL,
> +		[TX_Q_VO] = QUEUE_HIGH,
> +		[TX_Q_MGT] = QUEUE_HIGH,
> +		[TX_Q_HI] = QUEUE_HIGH,
> +	};
> +
> +	if (!pregistrypriv->wifi_spec)
> +		_InitNormalChipRegPriority(padapter, typical_queues);
> +	else
> +		_InitNormalChipRegPriority(padapter, wmm_queues);
>  }
>  
>  static void _InitQueuePriority(struct adapter *Adapter)
> diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
> index 552d0c5fa47f..b2c43f53571a 100644
> --- a/drivers/staging/rtl8723bs/include/drv_types.h
> +++ b/drivers/staging/rtl8723bs/include/drv_types.h
> @@ -373,6 +373,16 @@ struct adapter {
>  	unsigned char     in_cta_test;
>  };
>  
> +enum transmit_queues {
> +	TX_Q_BE = 0,
> +	TX_Q_BK,
> +	TX_Q_VI,
> +	TX_Q_VO,
> +	TX_Q_MGT,
> +	TX_Q_HI,
> +	TX_Q_MAX,
> +};
> +
>  #define adapter_to_dvobj(adapter) (adapter->dvobj)
>  #define adapter_to_pwrctl(adapter) (dvobj_to_pwrctl(adapter->dvobj))
>  #define adapter_wdev_data(adapter) (&((adapter)->wdev_data))
> -- 
> 2.54.0

      reply	other threads:[~2026-05-28  7:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-25 16:35 [PATCH v8 0/3] staging: rtl8723bs: fix several style issues in hal/sdio_halinit.c artur.ugnivenko
2026-05-25 16:35 ` [PATCH v8 1/3] staging: rtl8723bs: shorten long lines " artur.ugnivenko
2026-05-25 16:35 ` [PATCH v8 2/3] staging: rtl8723bs: fix inconsistent braces " artur.ugnivenko
2026-05-25 17:36   ` [PATCH v8 3/3] staging: rtl8723bs: refactor queue priority initialization artur.ugnivenko
2026-05-28  7:42     ` Dan Carpenter [this message]

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=ahfx1lZoIlL4IeCs@stanley.mountain \
    --to=error27@gmail.com \
    --cc=ahmet@sezginduran.net \
    --cc=artur.ugnivenko@gmx.de \
    --cc=gregkh@linuxfoundation.org \
    --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