public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: ozwpan: Fix build warning.
@ 2013-08-04 17:43 Rupesh Gujare
  2013-08-04 18:17 ` Anca Emanuel
  0 siblings, 1 reply; 4+ messages in thread
From: Rupesh Gujare @ 2013-08-04 17:43 UTC (permalink / raw)
  To: devel; +Cc: fengguang.wu, linux-usb, linux-kernel, gregkh

This patch fixes following build warning.

drivers/built-in.o: In function `oz_hcd_heartbeat':
>> (.text+0x30aadd): undefined reference to `__divdi3'
   drivers/built-in.o: In function `oz_hcd_heartbeat':
>> (.text+0x30ac85): undefined reference to `__divdi3'

Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com>
---
 drivers/staging/ozwpan/ozhcd.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ozwpan/ozhcd.c b/drivers/staging/ozwpan/ozhcd.c
index f81a0c5..db9c81e 100644
--- a/drivers/staging/ozwpan/ozhcd.c
+++ b/drivers/staging/ozwpan/ozhcd.c
@@ -1042,7 +1042,7 @@ int oz_hcd_heartbeat(void *hport)
 		if (ep->credit < 0)
 			continue;
 		delta = timespec_sub(ts, ep->timestamp);
-		ep->credit += timespec_to_ns(&delta) / NSEC_PER_MSEC;
+		ep->credit += div64_u64(timespec_to_ns(&delta), NSEC_PER_MSEC);
 		if (ep->credit > ep->credit_ceiling)
 			ep->credit = ep->credit_ceiling;
 		ep->timestamp = ts;
@@ -1086,7 +1086,7 @@ int oz_hcd_heartbeat(void *hport)
 			continue;
 		}
 		delta = timespec_sub(ts, ep->timestamp);
-		ep->credit += timespec_to_ns(&delta) / NSEC_PER_MSEC;
+		ep->credit += div64_u64(timespec_to_ns(&delta), NSEC_PER_MSEC);
 		ep->timestamp = ts;
 		while (!list_empty(&ep->urb_list)) {
 			struct oz_urb_link *urbl =
-- 
1.7.9.5


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

* Re: [PATCH] staging: ozwpan: Fix build warning.
  2013-08-04 17:43 [PATCH] staging: ozwpan: Fix build warning Rupesh Gujare
@ 2013-08-04 18:17 ` Anca Emanuel
  2013-08-05 10:03   ` Rupesh Gujare
  0 siblings, 1 reply; 4+ messages in thread
From: Anca Emanuel @ 2013-08-04 18:17 UTC (permalink / raw)
  To: Rupesh Gujare
  Cc: devel, Wu Fengguang, linux-usb, LKML, gregkh@linuxfoundation.org

Why do not use div_u64() ?

[quote]unsigned 64bit divide with 32bit divisor

This is the most common 64bit divide and should be used if possible,
as many 32bit archs can optimize this variant better than a full 64bit
divide.
[/quote]

> -               ep->credit += timespec_to_ns(&delta) / NSEC_PER_MSEC;
> +               ep->credit += div64_u64(timespec_to_ns(&delta), NSEC_PER_MSEC);

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

* Re: [PATCH] staging: ozwpan: Fix build warning.
  2013-08-04 18:17 ` Anca Emanuel
@ 2013-08-05 10:03   ` Rupesh Gujare
  2013-08-05 11:14     ` [PATCH v2] " Rupesh Gujare
  0 siblings, 1 reply; 4+ messages in thread
From: Rupesh Gujare @ 2013-08-05 10:03 UTC (permalink / raw)
  To: Anca Emanuel
  Cc: devel, Wu Fengguang, linux-usb, LKML, gregkh@linuxfoundation.org

On 04/08/13 19:17, Anca Emanuel wrote:
> Why do not use div_u64() ?
>
> [quote]unsigned 64bit divide with 32bit divisor
>
> This is the most common 64bit divide and should be used if possible,
> as many 32bit archs can optimize this variant better than a full 64bit
> divide.
> [/quote]
>
>> -               ep->credit += timespec_to_ns(&delta) / NSEC_PER_MSEC;
>> +               ep->credit += div64_u64(timespec_to_ns(&delta), NSEC_PER_MSEC);

Thank you Anca.

I will resend the patch.

-- 
Regards,
Rupesh Gujare


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

* [PATCH v2] staging: ozwpan: Fix build warning.
  2013-08-05 10:03   ` Rupesh Gujare
@ 2013-08-05 11:14     ` Rupesh Gujare
  0 siblings, 0 replies; 4+ messages in thread
From: Rupesh Gujare @ 2013-08-05 11:14 UTC (permalink / raw)
  To: devel; +Cc: anca.emanuel, fengguang.wu, linux-usb, linux-kernel, gregkh

This patch fixes following build warning.

drivers/built-in.o: In function `oz_hcd_heartbeat':
>> (.text+0x30aadd): undefined reference to `__divdi3'
   drivers/built-in.o: In function `oz_hcd_heartbeat':
>> (.text+0x30ac85): undefined reference to `__divdi3'

Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com>
---
 drivers/staging/ozwpan/ozhcd.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ozwpan/ozhcd.c b/drivers/staging/ozwpan/ozhcd.c
index f81a0c5..ed63868 100644
--- a/drivers/staging/ozwpan/ozhcd.c
+++ b/drivers/staging/ozwpan/ozhcd.c
@@ -1042,7 +1042,7 @@ int oz_hcd_heartbeat(void *hport)
 		if (ep->credit < 0)
 			continue;
 		delta = timespec_sub(ts, ep->timestamp);
-		ep->credit += timespec_to_ns(&delta) / NSEC_PER_MSEC;
+		ep->credit += div_u64(timespec_to_ns(&delta), NSEC_PER_MSEC);
 		if (ep->credit > ep->credit_ceiling)
 			ep->credit = ep->credit_ceiling;
 		ep->timestamp = ts;
@@ -1086,7 +1086,7 @@ int oz_hcd_heartbeat(void *hport)
 			continue;
 		}
 		delta = timespec_sub(ts, ep->timestamp);
-		ep->credit += timespec_to_ns(&delta) / NSEC_PER_MSEC;
+		ep->credit += div_u64(timespec_to_ns(&delta), NSEC_PER_MSEC);
 		ep->timestamp = ts;
 		while (!list_empty(&ep->urb_list)) {
 			struct oz_urb_link *urbl =
-- 
1.7.9.5


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

end of thread, other threads:[~2013-08-05 11:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-04 17:43 [PATCH] staging: ozwpan: Fix build warning Rupesh Gujare
2013-08-04 18:17 ` Anca Emanuel
2013-08-05 10:03   ` Rupesh Gujare
2013-08-05 11:14     ` [PATCH v2] " Rupesh Gujare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox