diff mbox series

[05/10] iwlwifi: mvm: fix 32-bit build in FTM

Message ID iwlwifi.20211210110539.4b397e664d44.Ib98004ccd2c7a55fd883a8ea7eebd810f406dec6@changeid
State Superseded
Headers show
Series iwlwifi: updates intended for v5.17 2021-12-10 part 2 | expand

Commit Message

Luca Coelho Dec. 10, 2021, 9:12 a.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

On a 32-bit build, the division here needs to be done
using do_div(), otherwise the compiler will try to call
a function that doesn't exist, thus failing to build.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Kalle Valo Dec. 13, 2021, 10:49 a.m. UTC | #1
Luca Coelho <luca@coelho.fi> writes:

> From: Johannes Berg <johannes.berg@intel.com>
>
> On a 32-bit build, the division here needs to be done
> using do_div(), otherwise the compiler will try to call
> a function that doesn't exist, thus failing to build.
>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Fixes tag? And should this go to wireless-drivers?
Luca Coelho Dec. 13, 2021, 11 a.m. UTC | #2
On Mon, 2021-12-13 at 12:49 +0200, Kalle Valo wrote:
> Luca Coelho <luca@coelho.fi> writes:
> 
> > From: Johannes Berg <johannes.berg@intel.com>
> > 
> > On a 32-bit build, the division here needs to be done
> > using do_div(), otherwise the compiler will try to call
> > a function that doesn't exist, thus failing to build.
> > 
> > Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> > Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
> 
> Fixes tag? And should this go to wireless-drivers?

I just checked the patch that this claims to fix internally and it's
rather old.  It went into v5.10:

commit b68bd2e3143adbcbc7afd2bc4974c1b988b87211
Author:     Ilan Peer <ilan.peer@intel.com>
AuthorDate: Wed Sep 30 16:31:12 2020 +0300
Commit:     Luca Coelho <luciano.coelho@intel.com>
CommitDate: Thu Oct 1 22:00:55 2020 +0300

    iwlwifi: mvm: Add FTM initiator RTT smoothing logic


So, if nobody caught this before, I think neither a Fixes tag nor
taking it to wireless-drivers is necessary.

What do you think?

--
Cheers,
Luca.
Kalle Valo Dec. 14, 2021, 5:55 a.m. UTC | #3
Luca Coelho <luca@coelho.fi> writes:

> On Mon, 2021-12-13 at 12:49 +0200, Kalle Valo wrote:
>> Luca Coelho <luca@coelho.fi> writes:
>> 
>> > From: Johannes Berg <johannes.berg@intel.com>
>> > 
>> > On a 32-bit build, the division here needs to be done
>> > using do_div(), otherwise the compiler will try to call
>> > a function that doesn't exist, thus failing to build.
>> > 
>> > Signed-off-by: Johannes Berg <johannes.berg@intel.com>
>> > Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
>> 
>> Fixes tag? And should this go to wireless-drivers?
>
> I just checked the patch that this claims to fix internally and it's
> rather old.  It went into v5.10:
>
> commit b68bd2e3143adbcbc7afd2bc4974c1b988b87211
> Author:     Ilan Peer <ilan.peer@intel.com>
> AuthorDate: Wed Sep 30 16:31:12 2020 +0300
> Commit:     Luca Coelho <luciano.coelho@intel.com>
> CommitDate: Thu Oct 1 22:00:55 2020 +0300
>
>     iwlwifi: mvm: Add FTM initiator RTT smoothing logic
>
>
> So, if nobody caught this before, I think neither a Fixes tag nor
> taking it to wireless-drivers is necessary.
>
> What do you think?

Weird that nobody else has reported it, maybe people don't test 32-bit
builds that much anymore? But I would prefer to have a Fixes tag, makes
it easier for backporters.
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
index 949fb790f8fb..3e6c13fc74eb 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
@@ -1066,7 +1066,8 @@  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) / 100;
+	rtt_avg = alpha * rtt + (100 - alpha) * resp->rtt_avg;
+	do_div(rtt_avg, 100);
 
 	IWL_DEBUG_INFO(mvm,
 		       "%pM: prev rtt_avg=%lld, new rtt_avg=%lld, rtt=%lld\n",