Message ID | 20190304203924.2111146-1-arnd@arndb.de |
---|---|
State | Accepted |
Commit | 688cd8bd2c0fa9dc88e5ced55a73ddc79edf875d |
Headers | show |
Series | iwlwifi: fix 64-bit division | expand |
Hi Arnd, On Mon, 2019-03-04 at 21:38 +0100, Arnd Bergmann wrote: > do_div() expects unsigned operands and otherwise triggers a warning > like: > > drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c:465:2: error: > comparison of distinct pointer types ('typeof ((rtt_avg)) *' (aka > 'long long *') and 'uint64_t *' (aka 'unsigned long long *')) [- > Werror,-Wcompare-distinct-pointer-types] > do_div(rtt_avg, 6666); > ^~~~~~~~~~~~~~~~~~~~~ > include/asm-generic/div64.h:222:28: note: expanded from macro > 'do_div' > (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ > ~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~ > 1 error generated. > > Change the do_div() to the simpler div_s64() that can handle > negative inputs correctly. > > Fixes: 937b10c0de68 ("iwlwifi: mvm: add debug prints for FTM") > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > --- This was already fixed with this patch: https://patchwork.kernel.org/patch/10823267/ ...but it hasn't reached the mainline yet. I'm planning to send it to the v5.1-rc series as soon as the merge window closes. Is that quick enough for you? -- Cheers, Luca.
On Tue, Mar 5, 2019 at 7:44 AM Luciano Coelho <luciano.coelho@intel.com> wrote: > On Mon, 2019-03-04 at 21:38 +0100, Arnd Bergmann wrote: > This was already fixed with this patch: > > https://patchwork.kernel.org/patch/10823267/ > > ...but it hasn't reached the mainline yet. > > I'm planning to send it to the v5.1-rc series as soon as the merge > window closes. Is that quick enough for you? That's fine, I just want it to reach 5.1 so it does not regress against 5.0. Sorry for the slightly bad timing of my submission. I had just restarted my randconfig tests the other day and wanted to get my 60 new patches out as quickly as possible. Arnd
On Tue, 2019-03-05 at 09:37 +0100, Arnd Bergmann wrote: > On Tue, Mar 5, 2019 at 7:44 AM Luciano Coelho < > luciano.coelho@intel.com> wrote: > > On Mon, 2019-03-04 at 21:38 +0100, Arnd Bergmann wrote: > > This was already fixed with this patch: > > > > https://patchwork.kernel.org/patch/10823267/ > > > > ...but it hasn't reached the mainline yet. > > > > I'm planning to send it to the v5.1-rc series as soon as the merge > > window closes. Is that quick enough for you? > > That's fine, I just want it to reach 5.1 so it does not regress > against 5.0. Okay, I'll push it to 5.1-rc series for sure. > Sorry for the slightly bad timing of my submission. I had just > restarted > my randconfig tests the other day and wanted to get my 60 new patches > out as quickly as possible. No problem! I really appreciate your sending patches and reviews. -- Cheers, Luca.
Arnd Bergmann <arnd@arndb.de> writes: > do_div() expects unsigned operands and otherwise triggers a warning like: > > drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c:465:2: error: comparison of distinct pointer types ('typeof ((rtt_avg)) *' (aka 'long long *') and 'uint64_t *' (aka 'unsigned long long *')) [-Werror,-Wcompare-distinct-pointer-types] > do_div(rtt_avg, 6666); > ^~~~~~~~~~~~~~~~~~~~~ > include/asm-generic/div64.h:222:28: note: expanded from macro 'do_div' > (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ > ~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~ > 1 error generated. > > Change the do_div() to the simpler div_s64() that can handle > negative inputs correctly. > > Fixes: 937b10c0de68 ("iwlwifi: mvm: add debug prints for FTM") > Signed-off-by: Arnd Bergmann <arnd@arndb.de> Luca, can I take this directly? -- Kalle Valo
On Tue, 2019-03-05 at 13:11 +0200, Kalle Valo wrote: > Arnd Bergmann <arnd@arndb.de> writes: > > > do_div() expects unsigned operands and otherwise triggers a warning > > like: > > > > drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c:465:2: > > error: comparison of distinct pointer types ('typeof ((rtt_avg)) *' > > (aka 'long long *') and 'uint64_t *' (aka 'unsigned long long *')) > > [-Werror,-Wcompare-distinct-pointer-types] > > do_div(rtt_avg, 6666); > > ^~~~~~~~~~~~~~~~~~~~~ > > include/asm-generic/div64.h:222:28: note: expanded from macro > > 'do_div' > > (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ > > ~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~ > > 1 error generated. > > > > Change the do_div() to the simpler div_s64() that can handle > > negative inputs correctly. > > > > Fixes: 937b10c0de68 ("iwlwifi: mvm: add debug prints for FTM") > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > > Luca, can I take this directly? Yeah, I guess to make things simpler, and since you're planning to send fixes to 5.1 already anyway, you can just take this one. I'll assign it to you in patchwork. Arnd, this way you'll get it earlier. ;) -- Cheers, Luca.
Arnd Bergmann <arnd@arndb.de> wrote: > do_div() expects unsigned operands and otherwise triggers a warning like: > > drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c:465:2: error: comparison of distinct pointer types ('typeof ((rtt_avg)) *' (aka 'long long *') and 'uint64_t *' (aka 'unsigned long long *')) [-Werror,-Wcompare-distinct-pointer-types] > do_div(rtt_avg, 6666); > ^~~~~~~~~~~~~~~~~~~~~ > include/asm-generic/div64.h:222:28: note: expanded from macro 'do_div' > (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ > ~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~ > 1 error generated. > > Change the do_div() to the simpler div_s64() that can handle > negative inputs correctly. > > Fixes: 937b10c0de68 ("iwlwifi: mvm: add debug prints for FTM") > Signed-off-by: Arnd Bergmann <arnd@arndb.de> Patch applied to wireless-drivers.git, thanks. 688cd8bd2c0f iwlwifi: fix 64-bit division -- https://patchwork.kernel.org/patch/10838587/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c index e9822a3ec373..94132cfd1f56 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c @@ -460,9 +460,7 @@ static int iwl_mvm_ftm_range_resp_valid(struct iwl_mvm *mvm, u8 request_id, static void iwl_mvm_debug_range_resp(struct iwl_mvm *mvm, u8 index, struct cfg80211_pmsr_result *res) { - s64 rtt_avg = res->ftm.rtt_avg * 100; - - do_div(rtt_avg, 6666); + s64 rtt_avg = div_s64(res->ftm.rtt_avg * 100, 6666); IWL_DEBUG_INFO(mvm, "entry %d\n", index); IWL_DEBUG_INFO(mvm, "\tstatus: %d\n", res->status);
do_div() expects unsigned operands and otherwise triggers a warning like: drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c:465:2: error: comparison of distinct pointer types ('typeof ((rtt_avg)) *' (aka 'long long *') and 'uint64_t *' (aka 'unsigned long long *')) [-Werror,-Wcompare-distinct-pointer-types] do_div(rtt_avg, 6666); ^~~~~~~~~~~~~~~~~~~~~ include/asm-generic/div64.h:222:28: note: expanded from macro 'do_div' (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ ~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~ 1 error generated. Change the do_div() to the simpler div_s64() that can handle negative inputs correctly. Fixes: 937b10c0de68 ("iwlwifi: mvm: add debug prints for FTM") Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.20.0