]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
rtlwifi: rtl8821ae: replace _rtl8821ae_mrate_idx_to_arfr_id with generic version
authorColin Ian King <colin.king@canonical.com>
Mon, 8 Oct 2018 08:50:28 +0000 (09:50 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Sat, 13 Oct 2018 12:00:37 +0000 (15:00 +0300)
Function _rtl8821ae_mrate_idx_to_arfr_id is functionally identical to
the generic version rtl_mrate_idx_to_arfr_id, so remove
_rtl8821ae_mrate_idx_to_arfr_id and use the generic one instead.

This also fixes a missing break statement found by CoverityScan in
_rtl8821ae_mrate_idx_to_arfr_id, namely: CID#1167237 ("Missing break
in switch")

Thanks to Joe Perches for spotting this when I submitted an earlier patch.

Fixes: 3c05bedb5fef ("Staging: rtl8812ae: Add Realtek 8821 PCI WIFI driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
ACKed-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c

index 317c1b3101dad1607bc670e8a3d5f9662754a05a..ba258318ee9f36814365bca8f5436f9eff167aba 100644 (file)
@@ -3404,75 +3404,6 @@ static void rtl8821ae_update_hal_rate_table(struct ieee80211_hw *hw,
                 "%x\n", rtl_read_dword(rtlpriv, REG_ARFR0));
 }
 
-static u8 _rtl8821ae_mrate_idx_to_arfr_id(
-       struct ieee80211_hw *hw, u8 rate_index,
-       enum wireless_mode wirelessmode)
-{
-       struct rtl_priv *rtlpriv = rtl_priv(hw);
-       struct rtl_phy *rtlphy = &rtlpriv->phy;
-       u8 ret = 0;
-       switch (rate_index) {
-       case RATR_INX_WIRELESS_NGB:
-               if (rtlphy->rf_type == RF_1T1R)
-                       ret = 1;
-               else
-                       ret = 0;
-               ; break;
-       case RATR_INX_WIRELESS_N:
-       case RATR_INX_WIRELESS_NG:
-               if (rtlphy->rf_type == RF_1T1R)
-                       ret = 5;
-               else
-                       ret = 4;
-               ; break;
-       case RATR_INX_WIRELESS_NB:
-               if (rtlphy->rf_type == RF_1T1R)
-                       ret = 3;
-               else
-                       ret = 2;
-               ; break;
-       case RATR_INX_WIRELESS_GB:
-               ret = 6;
-               break;
-       case RATR_INX_WIRELESS_G:
-               ret = 7;
-               break;
-       case RATR_INX_WIRELESS_B:
-               ret = 8;
-               break;
-       case RATR_INX_WIRELESS_MC:
-               if ((wirelessmode == WIRELESS_MODE_B)
-                       || (wirelessmode == WIRELESS_MODE_G)
-                       || (wirelessmode == WIRELESS_MODE_N_24G)
-                       || (wirelessmode == WIRELESS_MODE_AC_24G))
-                       ret = 6;
-               else
-                       ret = 7;
-       case RATR_INX_WIRELESS_AC_5N:
-               if (rtlphy->rf_type == RF_1T1R)
-                       ret = 10;
-               else
-                       ret = 9;
-               break;
-       case RATR_INX_WIRELESS_AC_24N:
-               if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_80) {
-                       if (rtlphy->rf_type == RF_1T1R)
-                               ret = 10;
-                       else
-                               ret = 9;
-               } else {
-                       if (rtlphy->rf_type == RF_1T1R)
-                               ret = 11;
-                       else
-                               ret = 12;
-               }
-               break;
-       default:
-               ret = 0; break;
-       }
-       return ret;
-}
-
 static u32 _rtl8821ae_rate_to_bitmap_2ssvht(__le16 vht_rate)
 {
        u8 i, j, tmp_rate;
@@ -3761,7 +3692,7 @@ static void rtl8821ae_update_hal_rate_mask(struct ieee80211_hw *hw,
                break;
        }
 
-       ratr_index = _rtl8821ae_mrate_idx_to_arfr_id(hw, ratr_index, wirelessmode);
+       ratr_index = rtl_mrate_idx_to_arfr_id(hw, ratr_index, wirelessmode);
        sta_entry->ratr_index = ratr_index;
        ratr_bitmap = _rtl8821ae_set_ra_vht_ratr_bitmap(hw, wirelessmode,
                                                        ratr_bitmap);