Re: [PATCH 1/2] [RFC] staging: rtl8723bs: refactor to reduce indents

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, May 22, 2021 at 02:47:18PM +0530, Shreyansh Chouhan wrote:
> Reduce the number of indents in rtw_wlan_util.c file by refactoring the
> code.
> 
> Moved the part of code that rearranged ac paramaters in the function
> WMMOnAssocResp to a separate function named sort_wmm_ac_params. It takes
> both the array of ac params and their indexes as arguments and sorts them.
> Has return type void.
> 
> Moved the part of code that checked for the realtek vendor in the
> function check_assoc_AP to a separate function named
> get_realtek_assoc_AP_vender. It takes a pointer to struct
> ndis_80211_var_ie as an argument and returns a u32 realtek vendor.
> 
> Signed-off-by: Shreyansh Chouhan <chouhan.shreyansh630@xxxxxxxxx>
> ---
>  .../staging/rtl8723bs/core/rtw_wlan_util.c    | 108 +++++++++---------
>  1 file changed, 56 insertions(+), 52 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
> index ce47ef4edea0..36e515a7ab5c 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
> @@ -777,6 +777,32 @@ int WMM_param_handler(struct adapter *padapter, struct ndis_80211_var_ie *pIE)
>  	return true;
>  }
>  
> +static void sort_wmm_ac_params(u32 *inx, u32 *edca)
> +{
> +	u32 i, j, change_inx = false;
> +
> +	/* entry indx: 0->vo, 1->vi, 2->be, 3->bk. */
> +	for (i = 0; i < 4; i++) {
> +		for (j = i + 1; j < 4; j++) {
> +			/* compare CW and AIFS */
> +			if ((edca[j] & 0xFFFF) < (edca[i] & 0xFFFF)) {
> +				change_inx = true;
> +			} else if ((edca[j] & 0xFFFF) == (edca[i] & 0xFFFF)) {
> +				/* compare TXOP */
> +				if ((edca[j] >> 16) > (edca[i] >> 16))
> +					change_inx = true;
> +			}
> +
> +			if (change_inx) {
> +				swap(edca[i], edca[j]);
> +				swap(inx[i], inx[j]);

Using swap() is the correct thing to do, but send that change as a
separate patch.

Don't send RFC patches, just send normal patches.  No need for comments.

> +
> +				change_inx = false;
> +			}
> +		}
> +	}
> +}

regards,
dan carpenter





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux