Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] iwlwifi: mvm: Use div_s64 instead of do_div in iwl_mvm_ftm_rtt_smoothing()
@ 2021-12-27 19:17 Nathan Chancellor
2022-01-10 0:33 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2021-12-27 19:17 UTC (permalink / raw)
To: Luca Coelho
Cc: Kalle Valo, Johannes Berg, linux-wireless, netdev, linux-kernel,
Nathan Chancellor
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: 8b0f92549f2c ("iwlwifi: mvm: fix 32-bit build in FTM")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
index 9449d1af3c11..628aee634b2a 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
@@ -1066,8 +1066,7 @@ static void iwl_mvm_ftm_rtt_smoothing(struct iwl_mvm *mvm,
overshoot = IWL_MVM_FTM_INITIATOR_SMOOTH_OVERSHOOT;
alpha = IWL_MVM_FTM_INITIATOR_SMOOTH_ALPHA;
- rtt_avg = alpha * rtt + (100 - alpha) * resp->rtt_avg;
- do_div(rtt_avg, 100);
+ rtt_avg = div_s64(alpha * rtt + (100 - alpha) * resp->rtt_avg, 100);
IWL_DEBUG_INFO(mvm,
"%pM: prev rtt_avg=%lld, new rtt_avg=%lld, rtt=%lld\n",
base-commit: bcbddc4f9d020a4a0b881cc065729c3aaeb28098
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iwlwifi: mvm: Use div_s64 instead of do_div in iwl_mvm_ftm_rtt_smoothing()
2021-12-27 19:17 [PATCH] iwlwifi: mvm: Use div_s64 instead of do_div in iwl_mvm_ftm_rtt_smoothing() Nathan Chancellor
@ 2022-01-10 0:33 ` Jakub Kicinski
2022-01-10 8:08 ` Kalle Valo
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2022-01-10 0:33 UTC (permalink / raw)
To: nathan
Cc: johannes.berg, kvalo, linux-kernel, linux-wireless,
luciano.coelho, netdev, Jakub Kicinski
> 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);
> | ^~~~~~
Let me take this one directly to net-next, hope that's okay.
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iwlwifi: mvm: Use div_s64 instead of do_div in iwl_mvm_ftm_rtt_smoothing()
2022-01-10 0:33 ` Jakub Kicinski
@ 2022-01-10 8:08 ` Kalle Valo
0 siblings, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2022-01-10 8:08 UTC (permalink / raw)
To: Jakub Kicinski
Cc: nathan, johannes.berg, linux-kernel, linux-wireless,
luciano.coelho, netdev
Jakub Kicinski <kuba@kernel.org> writes:
>> 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);
>> | ^~~~~~
>
> Let me take this one directly to net-next, hope that's okay.
Thanks, please do, I was offline for a longer period and just came back.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-10 8:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-27 19:17 [PATCH] iwlwifi: mvm: Use div_s64 instead of do_div in iwl_mvm_ftm_rtt_smoothing() Nathan Chancellor
2022-01-10 0:33 ` Jakub Kicinski
2022-01-10 8:08 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).