All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iwlwifi: fix 64-bit division
@ 2019-03-04 20:38 Arnd Bergmann
  2019-03-05  6:43 ` Luciano Coelho
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Arnd Bergmann @ 2019-03-04 20:38 UTC (permalink / raw)
  To: Johannes Berg, Emmanuel Grumbach, Luca Coelho,
	Intel Linux Wireless, Kalle Valo, David S. Miller
  Cc: Arnd Bergmann, Avraham Stern, linux-wireless, netdev, linux-kernel

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(-)

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);
-- 
2.20.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] iwlwifi: fix 64-bit division
  2019-03-04 20:38 [PATCH] iwlwifi: fix 64-bit division Arnd Bergmann
@ 2019-03-05  6:43 ` Luciano Coelho
  2019-03-05  8:37   ` Arnd Bergmann
  2019-03-05 11:11 ` Kalle Valo
  2019-03-07 17:15 ` Kalle Valo
  2 siblings, 1 reply; 7+ messages in thread
From: Luciano Coelho @ 2019-03-05  6:43 UTC (permalink / raw)
  To: Arnd Bergmann, Johannes Berg, Emmanuel Grumbach,
	Intel Linux Wireless, Kalle Valo, David S. Miller
  Cc: Avraham Stern, linux-wireless, netdev, linux-kernel

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] iwlwifi: fix 64-bit division
  2019-03-05  6:43 ` Luciano Coelho
@ 2019-03-05  8:37   ` Arnd Bergmann
  2019-03-05  8:46     ` Luciano Coelho
  0 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2019-03-05  8:37 UTC (permalink / raw)
  To: Luciano Coelho
  Cc: Johannes Berg, Emmanuel Grumbach, Intel Linux Wireless,
	Kalle Valo, David S. Miller, Avraham Stern, linux-wireless,
	Networking, Linux Kernel Mailing List

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] iwlwifi: fix 64-bit division
  2019-03-05  8:37   ` Arnd Bergmann
@ 2019-03-05  8:46     ` Luciano Coelho
  0 siblings, 0 replies; 7+ messages in thread
From: Luciano Coelho @ 2019-03-05  8:46 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Johannes Berg, Emmanuel Grumbach, Intel Linux Wireless,
	Kalle Valo, David S. Miller, Avraham Stern, linux-wireless,
	Networking, Linux Kernel Mailing List

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] iwlwifi: fix 64-bit division
  2019-03-04 20:38 [PATCH] iwlwifi: fix 64-bit division Arnd Bergmann
  2019-03-05  6:43 ` Luciano Coelho
@ 2019-03-05 11:11 ` Kalle Valo
  2019-03-05 11:46   ` Luca Coelho
  2019-03-07 17:15 ` Kalle Valo
  2 siblings, 1 reply; 7+ messages in thread
From: Kalle Valo @ 2019-03-05 11:11 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Johannes Berg, Emmanuel Grumbach, Luca Coelho,
	Intel Linux Wireless, David S. Miller, Avraham Stern,
	linux-wireless, netdev, linux-kernel

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] iwlwifi: fix 64-bit division
  2019-03-05 11:11 ` Kalle Valo
@ 2019-03-05 11:46   ` Luca Coelho
  0 siblings, 0 replies; 7+ messages in thread
From: Luca Coelho @ 2019-03-05 11:46 UTC (permalink / raw)
  To: Kalle Valo, Arnd Bergmann
  Cc: Johannes Berg, Emmanuel Grumbach, Intel Linux Wireless,
	David S. Miller, Avraham Stern, linux-wireless, netdev,
	linux-kernel

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] iwlwifi: fix 64-bit division
  2019-03-04 20:38 [PATCH] iwlwifi: fix 64-bit division Arnd Bergmann
  2019-03-05  6:43 ` Luciano Coelho
  2019-03-05 11:11 ` Kalle Valo
@ 2019-03-07 17:15 ` Kalle Valo
  2 siblings, 0 replies; 7+ messages in thread
From: Kalle Valo @ 2019-03-07 17:15 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Johannes Berg, Emmanuel Grumbach, Luca Coelho,
	Intel Linux Wireless, David S. Miller, Arnd Bergmann,
	Avraham Stern, linux-wireless, netdev, linux-kernel

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-03-07 17:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-04 20:38 [PATCH] iwlwifi: fix 64-bit division Arnd Bergmann
2019-03-05  6:43 ` Luciano Coelho
2019-03-05  8:37   ` Arnd Bergmann
2019-03-05  8:46     ` Luciano Coelho
2019-03-05 11:11 ` Kalle Valo
2019-03-05 11:46   ` Luca Coelho
2019-03-07 17:15 ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.