summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2023-10-04 12:24:15 +0300
committerKalle Valo <kvalo@kernel.org>2023-10-09 09:56:20 +0300
commit71ffa1bcd7a0b8331c32a81ce90290daaf17fce2 (patch)
tree7a43393ca5862640c091f29463264cb5ede33018
parent14a5b11532e850e7a748cbb4c74ac5c5abf18211 (diff)
downloadlinux-71ffa1bcd7a0b8331c32a81ce90290daaf17fce2.tar.xz
wifi: rtlwifi: use unsigned long for bt_coexist_8723 timestamp
Since 'bt_inq_page_start_time' of 'struct bt_coexist_8723' is in jiffies, prefer 'unsigned long' over 'u32' to avoid possible truncation in 'rtl8723e_dm_bt_inq_page_monitor()' and adjust related code. Found with clang's -Wshorten-64-to-32, compile tested only. Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Acked-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20231004092418.73337-1-dmantipov@yandex.ru
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c16
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/wifi.h2
2 files changed, 8 insertions, 10 deletions
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c
index 53af0d209b11..b34dffc6a30c 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c
@@ -1122,7 +1122,7 @@ static void rtl8723e_dm_bt_2_ant_hid_sco_esco(struct ieee80211_hw *hw)
/* Always ignore WlanAct if bHid|bSCOBusy|bSCOeSCO */
rtl_dbg(rtlpriv, COMP_BT_COEXIST, DBG_DMESG,
- "[BTCoex], BT btInqPageStartTime = 0x%x, btTxRxCntLvl = %d\n",
+ "[BTCoex], BT btInqPageStartTime = 0x%lx, btTxRxCntLvl = %d\n",
hal_coex_8723.bt_inq_page_start_time, bt_tx_rx_cnt_lvl);
if ((hal_coex_8723.bt_inq_page_start_time) ||
(BT_TXRX_CNT_LEVEL_3 == bt_tx_rx_cnt_lvl)) {
@@ -1335,7 +1335,7 @@ static void rtl8723e_dm_bt_2_ant_ftp_a2dp(struct ieee80211_hw *hw)
btdm8723.dec_bt_pwr = true;
rtl_dbg(rtlpriv, COMP_BT_COEXIST, DBG_DMESG,
- "[BTCoex], BT btInqPageStartTime = 0x%x, btTxRxCntLvl = %d\n",
+ "[BTCoex], BT btInqPageStartTime = 0x%lx, btTxRxCntLvl = %d\n",
hal_coex_8723.bt_inq_page_start_time, bt_tx_rx_cnt_lvl);
if ((hal_coex_8723.bt_inq_page_start_time) ||
@@ -1358,9 +1358,8 @@ static void rtl8723e_dm_bt_2_ant_ftp_a2dp(struct ieee80211_hw *hw)
static void rtl8723e_dm_bt_inq_page_monitor(struct ieee80211_hw *hw)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
- u32 cur_time;
+ unsigned long cur_time = jiffies;
- cur_time = jiffies;
if (hal_coex_8723.c2h_bt_inquiry_page) {
/* bt inquiry or page is started. */
if (hal_coex_8723.bt_inq_page_start_time == 0) {
@@ -1368,18 +1367,17 @@ static void rtl8723e_dm_bt_inq_page_monitor(struct ieee80211_hw *hw)
BT_COEX_STATE_BT_INQ_PAGE;
hal_coex_8723.bt_inq_page_start_time = cur_time;
rtl_dbg(rtlpriv, COMP_BT_COEXIST, DBG_DMESG,
- "[BTCoex], BT Inquiry/page is started at time : 0x%x\n",
+ "[BTCoex], BT Inquiry/page is started at time : 0x%lx\n",
hal_coex_8723.bt_inq_page_start_time);
}
}
rtl_dbg(rtlpriv, COMP_BT_COEXIST, DBG_DMESG,
- "[BTCoex], BT Inquiry/page started time : 0x%x, cur_time : 0x%x\n",
+ "[BTCoex], BT Inquiry/page started time : 0x%lx, cur_time : 0x%lx\n",
hal_coex_8723.bt_inq_page_start_time, cur_time);
if (hal_coex_8723.bt_inq_page_start_time) {
- if ((((long)cur_time -
- (long)hal_coex_8723.bt_inq_page_start_time) / HZ)
- >= 10) {
+ if (jiffies_to_msecs(cur_time -
+ hal_coex_8723.bt_inq_page_start_time) >= 10000) {
rtl_dbg(rtlpriv, COMP_BT_COEXIST, DBG_DMESG,
"[BTCoex], BT Inquiry/page >= 10sec!!!\n");
hal_coex_8723.bt_inq_page_start_time = 0;
diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h
index 0f99e3446796..47b4685b6d24 100644
--- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
+++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
@@ -1597,7 +1597,7 @@ struct bt_coexist_8723 {
u8 c2h_bt_info;
bool c2h_bt_info_req_sent;
bool c2h_bt_inquiry_page;
- u32 bt_inq_page_start_time;
+ unsigned long bt_inq_page_start_time;
u8 bt_retry_cnt;
u8 c2h_bt_info_original;
u8 bt_inquiry_page_cnt;