Skip to content

Commit 71ffa1b

Browse files
dmantipovKalle Valo
authored andcommitted
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 <[email protected]> Acked-by: Ping-Ke Shih <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 14a5b11 commit 71ffa1b

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ static void rtl8723e_dm_bt_2_ant_hid_sco_esco(struct ieee80211_hw *hw)
11221122
/* Always ignore WlanAct if bHid|bSCOBusy|bSCOeSCO */
11231123

11241124
rtl_dbg(rtlpriv, COMP_BT_COEXIST, DBG_DMESG,
1125-
"[BTCoex], BT btInqPageStartTime = 0x%x, btTxRxCntLvl = %d\n",
1125+
"[BTCoex], BT btInqPageStartTime = 0x%lx, btTxRxCntLvl = %d\n",
11261126
hal_coex_8723.bt_inq_page_start_time, bt_tx_rx_cnt_lvl);
11271127
if ((hal_coex_8723.bt_inq_page_start_time) ||
11281128
(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)
13351335
btdm8723.dec_bt_pwr = true;
13361336

13371337
rtl_dbg(rtlpriv, COMP_BT_COEXIST, DBG_DMESG,
1338-
"[BTCoex], BT btInqPageStartTime = 0x%x, btTxRxCntLvl = %d\n",
1338+
"[BTCoex], BT btInqPageStartTime = 0x%lx, btTxRxCntLvl = %d\n",
13391339
hal_coex_8723.bt_inq_page_start_time, bt_tx_rx_cnt_lvl);
13401340

13411341
if ((hal_coex_8723.bt_inq_page_start_time) ||
@@ -1358,28 +1358,26 @@ static void rtl8723e_dm_bt_2_ant_ftp_a2dp(struct ieee80211_hw *hw)
13581358
static void rtl8723e_dm_bt_inq_page_monitor(struct ieee80211_hw *hw)
13591359
{
13601360
struct rtl_priv *rtlpriv = rtl_priv(hw);
1361-
u32 cur_time;
1361+
unsigned long cur_time = jiffies;
13621362

1363-
cur_time = jiffies;
13641363
if (hal_coex_8723.c2h_bt_inquiry_page) {
13651364
/* bt inquiry or page is started. */
13661365
if (hal_coex_8723.bt_inq_page_start_time == 0) {
13671366
rtlpriv->btcoexist.cstate |=
13681367
BT_COEX_STATE_BT_INQ_PAGE;
13691368
hal_coex_8723.bt_inq_page_start_time = cur_time;
13701369
rtl_dbg(rtlpriv, COMP_BT_COEXIST, DBG_DMESG,
1371-
"[BTCoex], BT Inquiry/page is started at time : 0x%x\n",
1370+
"[BTCoex], BT Inquiry/page is started at time : 0x%lx\n",
13721371
hal_coex_8723.bt_inq_page_start_time);
13731372
}
13741373
}
13751374
rtl_dbg(rtlpriv, COMP_BT_COEXIST, DBG_DMESG,
1376-
"[BTCoex], BT Inquiry/page started time : 0x%x, cur_time : 0x%x\n",
1375+
"[BTCoex], BT Inquiry/page started time : 0x%lx, cur_time : 0x%lx\n",
13771376
hal_coex_8723.bt_inq_page_start_time, cur_time);
13781377

13791378
if (hal_coex_8723.bt_inq_page_start_time) {
1380-
if ((((long)cur_time -
1381-
(long)hal_coex_8723.bt_inq_page_start_time) / HZ)
1382-
>= 10) {
1379+
if (jiffies_to_msecs(cur_time -
1380+
hal_coex_8723.bt_inq_page_start_time) >= 10000) {
13831381
rtl_dbg(rtlpriv, COMP_BT_COEXIST, DBG_DMESG,
13841382
"[BTCoex], BT Inquiry/page >= 10sec!!!\n");
13851383
hal_coex_8723.bt_inq_page_start_time = 0;

drivers/net/wireless/realtek/rtlwifi/wifi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1597,7 +1597,7 @@ struct bt_coexist_8723 {
15971597
u8 c2h_bt_info;
15981598
bool c2h_bt_info_req_sent;
15991599
bool c2h_bt_inquiry_page;
1600-
u32 bt_inq_page_start_time;
1600+
unsigned long bt_inq_page_start_time;
16011601
u8 bt_retry_cnt;
16021602
u8 c2h_bt_info_original;
16031603
u8 bt_inquiry_page_cnt;

0 commit comments

Comments
 (0)