Skip to content

Commit 4ccdcc8

Browse files
nathanchancekuba-moo
authored andcommitted
iwlwifi: mvm: Use div_s64 instead of do_div in iwl_mvm_ftm_rtt_smoothing()
When building ARCH=arm allmodconfig: drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c: In function ‘iwl_mvm_ftm_rtt_smoothing’: ./include/asm-generic/div64.h:222:35: error: comparison of distinct pointer types lacks a cast [-Werror] 222 | (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ | ^~ drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c:1070:9: note: in expansion of macro ‘do_div’ 1070 | do_div(rtt_avg, 100); | ^~~~~~ do_div() has to be used with an unsigned 64-bit integer dividend but rtt_avg is a signed 64-bit integer. div_s64() expects a signed 64-bit integer dividend and signed 32-bit divisor, which fits this scenario, so use that function here to fix the warning. Fixes: 8b0f925 ("iwlwifi: mvm: fix 32-bit build in FTM") Signed-off-by: Nathan Chancellor <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 77bbcb6 commit 4ccdcc8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,8 +1066,7 @@ static void iwl_mvm_ftm_rtt_smoothing(struct iwl_mvm *mvm,
10661066
overshoot = IWL_MVM_FTM_INITIATOR_SMOOTH_OVERSHOOT;
10671067
alpha = IWL_MVM_FTM_INITIATOR_SMOOTH_ALPHA;
10681068

1069-
rtt_avg = alpha * rtt + (100 - alpha) * resp->rtt_avg;
1070-
do_div(rtt_avg, 100);
1069+
rtt_avg = div_s64(alpha * rtt + (100 - alpha) * resp->rtt_avg, 100);
10711070

10721071
IWL_DEBUG_INFO(mvm,
10731072
"%pM: prev rtt_avg=%lld, new rtt_avg=%lld, rtt=%lld\n",

0 commit comments

Comments
 (0)