projects
/
firefly-linux-kernel-4.4.55.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/vegard...
[firefly-linux-kernel-4.4.55.git]
/
kernel
/
time.c
diff --git
a/kernel/time.c
b/kernel/time.c
index 29511943871a15b2acf87cccf528513b07e57880..2e2e469a7fecea49ea9124eaedf5b025075d789e 100644
(file)
--- a/
kernel/time.c
+++ b/
kernel/time.c
@@
-370,13
+370,20
@@
EXPORT_SYMBOL(mktime);
* 0 <= tv_nsec < NSEC_PER_SEC
* For negative values only the tv_sec field is negative !
*/
* 0 <= tv_nsec < NSEC_PER_SEC
* For negative values only the tv_sec field is negative !
*/
-void set_normalized_timespec(struct timespec *ts, time_t sec,
long
nsec)
+void set_normalized_timespec(struct timespec *ts, time_t sec,
s64
nsec)
{
while (nsec >= NSEC_PER_SEC) {
{
while (nsec >= NSEC_PER_SEC) {
+ /*
+ * The following asm() prevents the compiler from
+ * optimising this loop into a modulo operation. See
+ * also __iter_div_u64_rem() in include/linux/time.h
+ */
+ asm("" : "+rm"(nsec));
nsec -= NSEC_PER_SEC;
++sec;
}
while (nsec < 0) {
nsec -= NSEC_PER_SEC;
++sec;
}
while (nsec < 0) {
+ asm("" : "+rm"(nsec));
nsec += NSEC_PER_SEC;
--sec;
}
nsec += NSEC_PER_SEC;
--sec;
}