Search Linux Wireless

Re: [PATCH 09/11] rtw89: 8852c: add mac_ctrl_path and mac_cfg_gnt APIs

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

 



Ping-Ke Shih <pkshih@xxxxxxxxxxx> writes:

> From: Chia-Yuan Li <leo.li@xxxxxxxxxxx>
>
> The BT-coexistence uses these function to control antenna and TDMA, so
> implement the variant type to support all chips.
>
> Signed-off-by: Chia-Yuan Li <leo.li@xxxxxxxxxxx>
> Signed-off-by: Ping-Ke Shih <pkshih@xxxxxxxxxxx>

[...]

> +int rtw89_mac_cfg_gnt_v1(struct rtw89_dev *rtwdev,
> +			 const struct rtw89_mac_ax_coex_gnt *gnt_cfg)
> +{
> +	u32 val;
> +
> +	val = (gnt_cfg->band[0].gnt_bt ?
> +	       B_AX_GNT_BT_RFC_S0_VAL | B_AX_GNT_BT_RX_VAL |
> +	       B_AX_GNT_BT_TX_VAL : B_AX_WL_ACT_VAL) |
> +	      (gnt_cfg->band[0].gnt_bt_sw_en ?
> +	       B_AX_GNT_BT_RFC_S0_SWCTRL | B_AX_GNT_BT_RX_SWCTRL |
> +	       B_AX_GNT_BT_TX_SWCTRL | B_AX_WL_ACT_SWCTRL : 0) |
> +	      (gnt_cfg->band[0].gnt_wl ?
> +	       B_AX_GNT_WL_RFC_S0_VAL | B_AX_GNT_WL_RX_VAL |
> +	       B_AX_GNT_WL_TX_VAL | B_AX_GNT_WL_BB_VAL : 0) |
> +	      (gnt_cfg->band[0].gnt_wl_sw_en ?
> +	       B_AX_GNT_WL_RFC_S0_SWCTRL | B_AX_GNT_WL_RX_SWCTRL |
> +	       B_AX_GNT_WL_TX_SWCTRL | B_AX_GNT_WL_BB_SWCTRL : 0) |
> +	      (gnt_cfg->band[1].gnt_bt ?
> +	       B_AX_GNT_BT_RFC_S1_VAL | B_AX_GNT_BT_RX_VAL |
> +	       B_AX_GNT_BT_TX_VAL : B_AX_WL_ACT_VAL) |
> +	      (gnt_cfg->band[1].gnt_bt_sw_en ?
> +	       B_AX_GNT_BT_RFC_S1_SWCTRL | B_AX_GNT_BT_RX_SWCTRL |
> +	       B_AX_GNT_BT_TX_SWCTRL | B_AX_WL_ACT_SWCTRL : 0) |
> +	      (gnt_cfg->band[1].gnt_wl ?
> +	       B_AX_GNT_WL_RFC_S1_VAL | B_AX_GNT_WL_RX_VAL |
> +	       B_AX_GNT_WL_TX_VAL | B_AX_GNT_WL_BB_VAL : 0) |
> +	      (gnt_cfg->band[1].gnt_wl_sw_en ?
> +	       B_AX_GNT_WL_RFC_S1_SWCTRL | B_AX_GNT_WL_RX_SWCTRL |
> +	       B_AX_GNT_WL_TX_SWCTRL | B_AX_GNT_WL_BB_SWCTRL : 0);

Not really a fan of this style, wouldn't this be more readable:

val = 0;

if (gnt_cfg->band[0].gnt_bt)
       val |= B_AX_GNT_BT_RFC_S0_VAL | B_AX_GNT_BT_RX_VAL | B_AX_GNT_BT_TX_VAL;
else
       val |= B_AX_WL_ACT_VAL;

if (gnt_cfg->band[0].gnt_bt_sw_en)
       val |= B_AX_GNT_BT_RFC_S0_SWCTRL | B_AX_GNT_BT_RX_SWCTRL |
              B_AX_GNT_BT_TX_SWCTRL | B_AX_WL_ACT_SWCTRL;

For ": 0" cases the else branch is not needed.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux