rtlwifi: rtl8192cu: remove duplicated routine in hw.c and mac.c
PATCH 1/1 rtlwifi: rtl8192cu: remove duplicated routine in hw.c and mac.c
rtl92c_set_xxx_filter is same routine with rtl92cu_set_hw_reg. so i remove those functions that are rtl92c_set_xxx_filter. (rtl92c_get_xxx_filter is also same reason.)
also i add code updating struct rtl_mac member variable in the rtl92cu_set_hw_reg.
after that, no more _update_mac_setting is not useful. thus i remove that.
--- drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | 38 +++++++++++--------------- drivers/net/wireless/rtlwifi/rtl8192cu/mac.c | 41 ---------------------------- drivers/net/wireless/rtlwifi/rtl8192cu/mac.h | 9 ------ 3 files changed, 16 insertions(+), 72 deletions(-)
drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +16 -22
@@ -818,26 +818,29 @@ static void _rtl92cu_init_usb_aggregation(struct ieee80211_hw *hw)static void _rtl92cu_init_wmac_setting (struct ieee80211_hw *hw) { -u16 value16; - +u16 value16; +u32 value32;struct rtl_priv *rtlpriv =rtl_priv (hw); -struct rtl_mac *mac =rtl_mac (rtl_priv (hw)); - mac->rx_conf = (RCR_APM |RCR_AM |RCR_ADF |RCR_AB |RCR_APPFCS | -RCR_APP_ICV |RCR_AMF |RCR_HTC_LOC_CTRL | -RCR_APP_MIC |RCR_APP_PHYSTS |RCR_ACRC32 ); -rtl_write_dword (rtlpriv,REG_RCR , mac->rx_conf); + value32 = (RCR_APM |RCR_AM |RCR_ADF |RCR_AB |RCR_APPFCS | +RCR_APP_ICV |RCR_AMF |RCR_HTC_LOC_CTRL | +RCR_APP_MIC |RCR_APP_PHYSTS |RCR_ACRC32 ); + rtlpriv->cfg->ops->set_hw_reg (hw,HW_VAR_RCR , (u8 *)(&value32));/* Accept all multicast address */ rtl_write_dword (rtlpriv,REG_MAR ,0xFFFFFFFF );rtl_write_dword (rtlpriv,REG_MAR +4 ,0xFFFFFFFF );/* Accept all management frames */ value16 =0xFFFF ; -rtl92c_set_mgt_filter (hw, value16); + rtlpriv->cfg->ops->set_hw_reg (hw,HW_VAR_MGT_FILTER , + (u8 *)(&value16));/* Reject all control frame - default value is 0 */ -rtl92c_set_ctrl_filter (hw,0x0 ); + value16 =0x0 ; + rtlpriv->cfg->ops->set_hw_reg (hw,HW_VAR_CTRL_FILTER , + (u8 *)(&value16));/* Accept all data frames */ value16 =0xFFFF ; -rtl92c_set_data_filter (hw, value16); + rtlpriv->cfg->ops->set_hw_reg (hw,HW_VAR_DATA_FILTER , + (u8 *)(&value16)); }static int _rtl92cu_init_mac (struct ieee80211_hw *hw)
@@ -968,17 +971,6 @@ static void _InitPABias(struct ieee80211_hw *hw) } } -static void _update_mac_setting (struct ieee80211_hw *hw) -{ -struct rtl_priv *rtlpriv =rtl_priv (hw); -struct rtl_mac *mac =rtl_mac (rtl_priv (hw)); - - mac->rx_conf =rtl_read_dword (rtlpriv,REG_RCR ); - mac->rx_mgt_filter =rtl_read_word (rtlpriv,REG_RXFLTMAP0 ); - mac->rx_ctrl_filter =rtl_read_word (rtlpriv,REG_RXFLTMAP1 ); - mac->rx_data_filter =rtl_read_word (rtlpriv,REG_RXFLTMAP2 ); -} -int rtl92cu_hw_init (struct ieee80211_hw *hw) {struct rtl_priv *rtlpriv =rtl_priv (hw);
@@ -1049,7 +1041,6 @@ int rtl92cu_hw_init(struct ieee80211_hw *hw) }_rtl92cu_hw_configure (hw);_InitPABias (hw); -_update_mac_setting (hw);rtl92c_dm_init (hw); exit:local_irq_restore (flags);
@@ -1997,12 +1988,15 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) }case HW_VAR_MGT_FILTER :rtl_write_word (rtlpriv,REG_RXFLTMAP0 , *(u16 *)val); + mac->rx_mgt_filter = *(u16 *)val;break ;case HW_VAR_CTRL_FILTER :rtl_write_word (rtlpriv,REG_RXFLTMAP1 , *(u16 *)val); + mac->rx_ctrl_filter = *(u16 *)val;break ;case HW_VAR_DATA_FILTER :rtl_write_word (rtlpriv,REG_RXFLTMAP2 , *(u16 *)val); + mac->rx_data_filter = *(u16 *)val;break ;default : RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
drivers/net/wireless/rtlwifi/rtl8192cu/mac.c +0 -41
47 lines not on this page · raw message
drivers/net/wireless/rtlwifi/rtl8192cu/mac.h +0 -9
@@ -76,15 +76,6 @@ void rtl92c_init_beacon_parameters(struct ieee80211_hw *hw,void rtl92c_disable_fast_edca (struct ieee80211_hw *hw);void rtl92c_set_min_space (struct ieee80211_hw *hw,bool is2T); -/* For filter */ -u16 rtl92c_get_mgt_filter (struct ieee80211_hw *hw); -void rtl92c_set_mgt_filter (struct ieee80211_hw *hw,u16 filter); -u16 rtl92c_get_ctrl_filter (struct ieee80211_hw *hw); -void rtl92c_set_ctrl_filter (struct ieee80211_hw *hw,u16 filter); -u16 rtl92c_get_data_filter (struct ieee80211_hw *hw); -void rtl92c_set_data_filter (struct ieee80211_hw *hw,u16 filter); - -u32 rtl92c_get_txdma_status (struct ieee80211_hw *hw);struct rx_fwinfo_92c {
Signature · 1 line
1.9.1
Kalle Valo
AppliedQuoted 9 lines
rtl92c_set_xxx_filteris same routine withrtl92cu_set_hw_reg. so i remove those functions that arertl92c_set_xxx_filter. (rtl92c_get_xxx_filteris also same reason.)
also i add code updating structrtl_macmember variable in thertl92cu_set_hw_reg.
after that, no more_update_mac_settingis not useful. thus i remove that.Signed-off-by Taehee Yoo <[email protected]>
Thanks, applied to wireless-drivers-next.git.
Kalle Valo