summaryrefslogtreecommitdiff
path: root/include/asm-generic
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2014-03-05 15:33:18 +0100
committerFrederic Weisbecker <fweisbec@gmail.com>2014-03-13 15:56:43 +0100
commit69bb2600c9f8ca450fede9633edf9c2513c9ee6f (patch)
tree882511f34317d6c092430f9f19f6d89e9231c623 /include/asm-generic
parent6f008e72cd111a119b5d8de8c5438d892aae99eb (diff)
cputime: Fix nsecs_to_cputime() return type cast
Even though nsec based cputime_t maps to u64, nsecs_to_cputime() must return a cputime_t value. We want to enforce this kind of cast in order to track down buggy manipulations of cputime_t such as direct access of its values under wrong assumptions on its backend type (nsecs, jiffies, etc...) by core code. Cc: Ingo Molnar <mingo@kernel.org> Cc: Marcelo Tosatti <mtosatti@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Acked-by: Rik van Riel <riel@redhat.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/cputime_nsecs.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/asm-generic/cputime_nsecs.h b/include/asm-generic/cputime_nsecs.h
index 2c9e62c2bfd0..768294f8bf85 100644
--- a/include/asm-generic/cputime_nsecs.h
+++ b/include/asm-generic/cputime_nsecs.h
@@ -44,7 +44,8 @@ typedef u64 __nocast cputime64_t;
/*
* Convert cputime <-> nanoseconds
*/
-#define nsecs_to_cputime(__nsecs) ((__force u64)(__nsecs))
+#define nsecs_to_cputime(__nsecs) \
+ (__force cputime_t)(__nsecs)
/*