Commit 3c519605 authored by Yan-Hsuan Chuang's avatar Yan-Hsuan Chuang Committed by Kalle Valo

rtw88: remove redundant flag check helper function

These helper functions seems useless. And in some cases
we want to use test_and_[set/clear]_bit, these helpers
will make the code more complicated. So remove them.
Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 66070e86
...@@ -383,9 +383,9 @@ static void rtw_coex_update_wl_link_info(struct rtw_dev *rtwdev, u8 reason) ...@@ -383,9 +383,9 @@ static void rtw_coex_update_wl_link_info(struct rtw_dev *rtwdev, u8 reason)
u8 rssi_step; u8 rssi_step;
u8 rssi; u8 rssi;
scan = rtw_flag_check(rtwdev, RTW_FLAG_SCANNING); scan = test_bit(RTW_FLAG_SCANNING, rtwdev->flags);
coex_stat->wl_connected = !!rtwdev->sta_cnt; coex_stat->wl_connected = !!rtwdev->sta_cnt;
coex_stat->wl_gl_busy = rtw_flag_check(rtwdev, RTW_FLAG_BUSY_TRAFFIC); coex_stat->wl_gl_busy = test_bit(RTW_FLAG_BUSY_TRAFFIC, rtwdev->flags);
if (stats->tx_throughput > stats->rx_throughput) if (stats->tx_throughput > stats->rx_throughput)
coex_stat->wl_tput_dir = COEX_WL_TPUT_TX; coex_stat->wl_tput_dir = COEX_WL_TPUT_TX;
......
...@@ -707,7 +707,7 @@ int rtw_download_firmware(struct rtw_dev *rtwdev, struct rtw_fw_state *fw) ...@@ -707,7 +707,7 @@ int rtw_download_firmware(struct rtw_dev *rtwdev, struct rtw_fw_state *fw)
rtwdev->h2c.last_box_num = 0; rtwdev->h2c.last_box_num = 0;
rtwdev->h2c.seq = 0; rtwdev->h2c.seq = 0;
rtw_flag_set(rtwdev, RTW_FLAG_FW_RUNNING); set_bit(RTW_FLAG_FW_RUNNING, rtwdev->flags);
return 0; return 0;
......
...@@ -19,7 +19,7 @@ static void rtw_ops_tx(struct ieee80211_hw *hw, ...@@ -19,7 +19,7 @@ static void rtw_ops_tx(struct ieee80211_hw *hw,
struct rtw_dev *rtwdev = hw->priv; struct rtw_dev *rtwdev = hw->priv;
struct rtw_tx_pkt_info pkt_info = {0}; struct rtw_tx_pkt_info pkt_info = {0};
if (!rtw_flag_check(rtwdev, RTW_FLAG_RUNNING)) if (!test_bit(RTW_FLAG_RUNNING, rtwdev->flags))
goto out; goto out;
rtw_tx_pkt_info_update(rtwdev, &pkt_info, control, skb); rtw_tx_pkt_info_update(rtwdev, &pkt_info, control, skb);
...@@ -474,8 +474,8 @@ static void rtw_ops_sw_scan_start(struct ieee80211_hw *hw, ...@@ -474,8 +474,8 @@ static void rtw_ops_sw_scan_start(struct ieee80211_hw *hw,
rtw_coex_scan_notify(rtwdev, COEX_SCAN_START); rtw_coex_scan_notify(rtwdev, COEX_SCAN_START);
rtw_flag_set(rtwdev, RTW_FLAG_DIG_DISABLE); set_bit(RTW_FLAG_DIG_DISABLE, rtwdev->flags);
rtw_flag_set(rtwdev, RTW_FLAG_SCANNING); set_bit(RTW_FLAG_SCANNING, rtwdev->flags);
mutex_unlock(&rtwdev->mutex); mutex_unlock(&rtwdev->mutex);
} }
...@@ -489,8 +489,8 @@ static void rtw_ops_sw_scan_complete(struct ieee80211_hw *hw, ...@@ -489,8 +489,8 @@ static void rtw_ops_sw_scan_complete(struct ieee80211_hw *hw,
mutex_lock(&rtwdev->mutex); mutex_lock(&rtwdev->mutex);
rtw_flag_clear(rtwdev, RTW_FLAG_SCANNING); clear_bit(RTW_FLAG_SCANNING, rtwdev->flags);
rtw_flag_clear(rtwdev, RTW_FLAG_DIG_DISABLE); clear_bit(RTW_FLAG_DIG_DISABLE, rtwdev->flags);
ether_addr_copy(rtwvif->mac_addr, vif->addr); ether_addr_copy(rtwvif->mac_addr, vif->addr);
config |= PORT_SET_MAC_ADDR; config |= PORT_SET_MAC_ADDR;
......
...@@ -150,20 +150,20 @@ static void rtw_watch_dog_work(struct work_struct *work) ...@@ -150,20 +150,20 @@ static void rtw_watch_dog_work(struct work_struct *work)
struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, struct rtw_dev *rtwdev = container_of(work, struct rtw_dev,
watch_dog_work.work); watch_dog_work.work);
struct rtw_watch_dog_iter_data data = {}; struct rtw_watch_dog_iter_data data = {};
bool busy_traffic = rtw_flag_check(rtwdev, RTW_FLAG_BUSY_TRAFFIC); bool busy_traffic = test_bit(RTW_FLAG_BUSY_TRAFFIC, rtwdev->flags);
if (!rtw_flag_check(rtwdev, RTW_FLAG_RUNNING)) if (!test_bit(RTW_FLAG_RUNNING, rtwdev->flags))
return; return;
ieee80211_queue_delayed_work(rtwdev->hw, &rtwdev->watch_dog_work, ieee80211_queue_delayed_work(rtwdev->hw, &rtwdev->watch_dog_work,
RTW_WATCH_DOG_DELAY_TIME); RTW_WATCH_DOG_DELAY_TIME);
if (rtwdev->stats.tx_cnt > 100 || rtwdev->stats.rx_cnt > 100) if (rtwdev->stats.tx_cnt > 100 || rtwdev->stats.rx_cnt > 100)
rtw_flag_set(rtwdev, RTW_FLAG_BUSY_TRAFFIC); set_bit(RTW_FLAG_BUSY_TRAFFIC, rtwdev->flags);
else else
rtw_flag_clear(rtwdev, RTW_FLAG_BUSY_TRAFFIC); clear_bit(RTW_FLAG_BUSY_TRAFFIC, rtwdev->flags);
if (busy_traffic != rtw_flag_check(rtwdev, RTW_FLAG_BUSY_TRAFFIC)) if (busy_traffic != test_bit(RTW_FLAG_BUSY_TRAFFIC, rtwdev->flags))
rtw_coex_wl_status_change_notify(rtwdev); rtw_coex_wl_status_change_notify(rtwdev);
/* reset tx/rx statictics */ /* reset tx/rx statictics */
...@@ -183,7 +183,7 @@ static void rtw_watch_dog_work(struct work_struct *work) ...@@ -183,7 +183,7 @@ static void rtw_watch_dog_work(struct work_struct *work)
data.rtwvif && !data.active && data.assoc_cnt == 1) data.rtwvif && !data.active && data.assoc_cnt == 1)
rtw_enter_lps(rtwdev, data.rtwvif); rtw_enter_lps(rtwdev, data.rtwvif);
if (rtw_flag_check(rtwdev, RTW_FLAG_SCANNING)) if (test_bit(RTW_FLAG_SCANNING, rtwdev->flags))
return; return;
rtw_phy_dynamic_mechanism(rtwdev); rtw_phy_dynamic_mechanism(rtwdev);
...@@ -311,7 +311,7 @@ void rtw_set_channel(struct rtw_dev *rtwdev) ...@@ -311,7 +311,7 @@ void rtw_set_channel(struct rtw_dev *rtwdev)
if (hal->current_band_type == RTW_BAND_5G) { if (hal->current_band_type == RTW_BAND_5G) {
rtw_coex_switchband_notify(rtwdev, COEX_SWITCH_TO_5G); rtw_coex_switchband_notify(rtwdev, COEX_SWITCH_TO_5G);
} else { } else {
if (rtw_flag_check(rtwdev, RTW_FLAG_SCANNING)) if (test_bit(RTW_FLAG_SCANNING, rtwdev->flags))
rtw_coex_switchband_notify(rtwdev, COEX_SWITCH_TO_24G); rtw_coex_switchband_notify(rtwdev, COEX_SWITCH_TO_24G);
else else
rtw_coex_switchband_notify(rtwdev, COEX_SWITCH_TO_24G_NOFORSCAN); rtw_coex_switchband_notify(rtwdev, COEX_SWITCH_TO_24G_NOFORSCAN);
...@@ -737,7 +737,7 @@ int rtw_core_start(struct rtw_dev *rtwdev) ...@@ -737,7 +737,7 @@ int rtw_core_start(struct rtw_dev *rtwdev)
ieee80211_queue_delayed_work(rtwdev->hw, &rtwdev->watch_dog_work, ieee80211_queue_delayed_work(rtwdev->hw, &rtwdev->watch_dog_work,
RTW_WATCH_DOG_DELAY_TIME); RTW_WATCH_DOG_DELAY_TIME);
rtw_flag_set(rtwdev, RTW_FLAG_RUNNING); set_bit(RTW_FLAG_RUNNING, rtwdev->flags);
return 0; return 0;
} }
...@@ -752,8 +752,8 @@ void rtw_core_stop(struct rtw_dev *rtwdev) ...@@ -752,8 +752,8 @@ void rtw_core_stop(struct rtw_dev *rtwdev)
{ {
struct rtw_coex *coex = &rtwdev->coex; struct rtw_coex *coex = &rtwdev->coex;
rtw_flag_clear(rtwdev, RTW_FLAG_RUNNING); clear_bit(RTW_FLAG_RUNNING, rtwdev->flags);
rtw_flag_clear(rtwdev, RTW_FLAG_FW_RUNNING); clear_bit(RTW_FLAG_FW_RUNNING, rtwdev->flags);
cancel_delayed_work_sync(&rtwdev->watch_dog_work); cancel_delayed_work_sync(&rtwdev->watch_dog_work);
cancel_delayed_work_sync(&coex->bt_relink_work); cancel_delayed_work_sync(&coex->bt_relink_work);
......
...@@ -1378,21 +1378,6 @@ struct rtw_dev { ...@@ -1378,21 +1378,6 @@ struct rtw_dev {
#include "hci.h" #include "hci.h"
static inline bool rtw_flag_check(struct rtw_dev *rtwdev, enum rtw_flags flag)
{
return test_bit(flag, rtwdev->flags);
}
static inline void rtw_flag_clear(struct rtw_dev *rtwdev, enum rtw_flags flag)
{
clear_bit(flag, rtwdev->flags);
}
static inline void rtw_flag_set(struct rtw_dev *rtwdev, enum rtw_flags flag)
{
set_bit(flag, rtwdev->flags);
}
static inline bool rtw_is_assoc(struct rtw_dev *rtwdev) static inline bool rtw_is_assoc(struct rtw_dev *rtwdev)
{ {
return !!rtwdev->sta_cnt; return !!rtwdev->sta_cnt;
......
...@@ -394,7 +394,7 @@ static void rtw_phy_dig(struct rtw_dev *rtwdev) ...@@ -394,7 +394,7 @@ static void rtw_phy_dig(struct rtw_dev *rtwdev)
u8 step[3]; u8 step[3];
bool linked; bool linked;
if (rtw_flag_check(rtwdev, RTW_FLAG_DIG_DISABLE)) if (test_bit(RTW_FLAG_DIG_DISABLE, rtwdev->flags))
return; return;
if (rtw_phy_dig_check_damping(dm_info)) if (rtw_phy_dig_check_damping(dm_info))
......
...@@ -18,14 +18,14 @@ static int rtw_ips_pwr_up(struct rtw_dev *rtwdev) ...@@ -18,14 +18,14 @@ static int rtw_ips_pwr_up(struct rtw_dev *rtwdev)
rtw_err(rtwdev, "leave idle state failed\n"); rtw_err(rtwdev, "leave idle state failed\n");
rtw_set_channel(rtwdev); rtw_set_channel(rtwdev);
rtw_flag_clear(rtwdev, RTW_FLAG_INACTIVE_PS); clear_bit(RTW_FLAG_INACTIVE_PS, rtwdev->flags);
return ret; return ret;
} }
int rtw_enter_ips(struct rtw_dev *rtwdev) int rtw_enter_ips(struct rtw_dev *rtwdev)
{ {
rtw_flag_set(rtwdev, RTW_FLAG_INACTIVE_PS); set_bit(RTW_FLAG_INACTIVE_PS, rtwdev->flags);
rtw_coex_ips_notify(rtwdev, COEX_IPS_ENTER); rtw_coex_ips_notify(rtwdev, COEX_IPS_ENTER);
...@@ -71,7 +71,7 @@ static void rtw_leave_lps_core(struct rtw_dev *rtwdev) ...@@ -71,7 +71,7 @@ static void rtw_leave_lps_core(struct rtw_dev *rtwdev)
conf->smart_ps = 0; conf->smart_ps = 0;
rtw_fw_set_pwr_mode(rtwdev); rtw_fw_set_pwr_mode(rtwdev);
rtw_flag_clear(rtwdev, RTW_FLAG_LEISURE_PS); clear_bit(RTW_FLAG_LEISURE_PS, rtwdev->flags);
rtw_coex_lps_notify(rtwdev, COEX_LPS_DISABLE); rtw_coex_lps_notify(rtwdev, COEX_LPS_DISABLE);
} }
...@@ -88,7 +88,7 @@ static void rtw_enter_lps_core(struct rtw_dev *rtwdev) ...@@ -88,7 +88,7 @@ static void rtw_enter_lps_core(struct rtw_dev *rtwdev)
rtw_coex_lps_notify(rtwdev, COEX_LPS_ENABLE); rtw_coex_lps_notify(rtwdev, COEX_LPS_ENABLE);
rtw_fw_set_pwr_mode(rtwdev); rtw_fw_set_pwr_mode(rtwdev);
rtw_flag_set(rtwdev, RTW_FLAG_LEISURE_PS); set_bit(RTW_FLAG_LEISURE_PS, rtwdev->flags);
} }
void rtw_lps_work(struct work_struct *work) void rtw_lps_work(struct work_struct *work)
...@@ -137,7 +137,7 @@ void rtw_leave_lps_irqsafe(struct rtw_dev *rtwdev, struct rtw_vif *rtwvif) ...@@ -137,7 +137,7 @@ void rtw_leave_lps_irqsafe(struct rtw_dev *rtwdev, struct rtw_vif *rtwvif)
bool rtw_in_lps(struct rtw_dev *rtwdev) bool rtw_in_lps(struct rtw_dev *rtwdev)
{ {
return rtw_flag_check(rtwdev, RTW_FLAG_LEISURE_PS); return test_bit(RTW_FLAG_LEISURE_PS, rtwdev->flags);
} }
void rtw_enter_lps(struct rtw_dev *rtwdev, struct rtw_vif *rtwvif) void rtw_enter_lps(struct rtw_dev *rtwdev, struct rtw_vif *rtwvif)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment