public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kernel/time.c: Silence gcc warning 'integer constant to large for long type'
@ 2008-05-02 18:58 H. Peter Anvin
  2008-05-02 21:14 ` Linus Torvalds
  0 siblings, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2008-05-02 18:58 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Carlos R. Mafra, Linux Kernel Mailing List

From: Carlos R. Mafra <crmafra@ift.unesp.br>

This patch removes these gcc warnings:

kernel/time.c: In function msecs_to_jiffies:
kernel/time.c:479: warning: integer constant is too large for long type
kernel/time.c: In function usecs_to_jiffies:
kernel/time.c:494: warning: integer constant is too large for long type

by casting MSEC_TO_HZ_ADJ32 and USEC_TO_HZ_ADJ32 to u64.

This resolves bugzilla 10153.

Signed-off-by: Carlos R. Mafra <crmafra@ift.unesp.br>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 kernel/time.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/time.c b/kernel/time.c
index cbe0d5a..76dcc0f 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -476,7 +476,7 @@ unsigned long msecs_to_jiffies(const unsigned int m)
 	if (HZ > MSEC_PER_SEC && m > jiffies_to_msecs(MAX_JIFFY_OFFSET))
 		return MAX_JIFFY_OFFSET;
 
-	return ((u64)MSEC_TO_HZ_MUL32 * m + MSEC_TO_HZ_ADJ32)
+	return ((u64)MSEC_TO_HZ_MUL32 * m + (u64)MSEC_TO_HZ_ADJ32)
 		>> MSEC_TO_HZ_SHR32;
 #endif
 }
@@ -491,7 +491,7 @@ unsigned long usecs_to_jiffies(const unsigned int u)
 #elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC)
 	return u * (HZ / USEC_PER_SEC);
 #else
-	return ((u64)USEC_TO_HZ_MUL32 * u + USEC_TO_HZ_ADJ32)
+	return ((u64)USEC_TO_HZ_MUL32 * u + (u64)USEC_TO_HZ_ADJ32)
 		>> USEC_TO_HZ_SHR32;
 #endif
 }
-- 
1.5.4.3




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

end of thread, other threads:[~2008-05-03 17:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-02 18:58 [PATCH] kernel/time.c: Silence gcc warning 'integer constant to large for long type' H. Peter Anvin
2008-05-02 21:14 ` Linus Torvalds
2008-05-02 21:33   ` H. Peter Anvin
2008-05-02 22:17     ` Linus Torvalds
2008-05-02 22:33       ` Linus Torvalds
2008-05-02 22:45         ` H. Peter Anvin
2008-05-02 23:23         ` H. Peter Anvin
2008-05-03 17:57           ` Linus Torvalds

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