From: john stultz <johnstul@us.ibm.com>
To: lkml <linux-kernel@vger.kernel.org>
Cc: george anzinger <george@mvista.com>
Subject: [RFC] linux-2.5.70_time-macro-cleanup_A0
Date: 13 Jun 2003 16:24:06 -0700 [thread overview]
Message-ID: <1055546646.18636.187.camel@w-jstultz2.beaverton.ibm.com> (raw)
All,
This quick patch cleans up the i386 time code to use USEC_PER_SEC and
friends. I think George Anzinger has had similar such changes in various
patches he has mailed out, but this splits the cleanup out by itself.
Let me know if you have any comments or suggestions.
thanks
-john
diff -Nru a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
--- a/arch/i386/kernel/time.c Fri Jun 13 16:16:11 2003
+++ b/arch/i386/kernel/time.c Fri Jun 13 16:16:11 2003
@@ -99,14 +99,14 @@
{
unsigned long lost = jiffies - wall_jiffies;
if (lost)
- usec += lost * (1000000 / HZ);
+ usec += lost * (USEC_PER_SEC / HZ);
}
sec = xtime.tv_sec;
- usec += (xtime.tv_nsec / 1000);
+ usec += (xtime.tv_nsec / NSEC_PER_USEC);
} while (read_seqretry(&xtime_lock, seq));
- while (usec >= 1000000) {
- usec -= 1000000;
+ while (usec >= USEC_PER_SEC) {
+ usec -= USEC_PER_SEC;
sec++;
}
@@ -213,9 +213,9 @@
*/
if ((time_status & STA_UNSYNC) == 0 &&
xtime.tv_sec > last_rtc_update + 660 &&
- (xtime.tv_nsec / 1000)
+ (xtime.tv_nsec / NSEC_PER_USEC)
>= USEC_AFTER - ((unsigned) TICK_SIZE) / 2 &&
- (xtime.tv_nsec / 1000)
+ (xtime.tv_nsec / NSEC_PER_USEC)
<= USEC_BEFORE + ((unsigned) TICK_SIZE) / 2) {
if (set_rtc_mmss(xtime.tv_sec) == 0)
last_rtc_update = xtime.tv_sec;
diff -Nru a/arch/i386/kernel/timers/timer_cyclone.c b/arch/i386/kernel/timers/timer_cyclone.c
--- a/arch/i386/kernel/timers/timer_cyclone.c Fri Jun 13 16:16:11 2003
+++ b/arch/i386/kernel/timers/timer_cyclone.c Fri Jun 13 16:16:11 2003
@@ -67,10 +67,10 @@
/* lost tick compensation */
delta = last_cyclone_low - delta;
- delta /= (CYCLONE_TIMER_FREQ/1000000);
+ delta /= (CYCLONE_TIMER_FREQ/USEC_PER_SEC);
delta += delay_at_last_interrupt;
- lost = delta/(1000000/HZ);
- delay = delta%(1000000/HZ);
+ lost = delta/(USEC_PER_SEC/HZ);
+ delay = delta%(USEC_PER_SEC/HZ);
if (lost >= 2)
jiffies += lost-1;
@@ -107,7 +107,7 @@
/* convert cyclone ticks to microseconds */
/* XXX slow, can we speed this up? */
- offset = offset/(CYCLONE_TIMER_FREQ/1000000);
+ offset = offset/(CYCLONE_TIMER_FREQ/USEC_PER_SEC);
/* our adjusted time offset in microseconds */
return delay_at_last_interrupt + offset;
@@ -131,7 +131,7 @@
/* convert to nanoseconds */
ret = base + ((this_offset - last_offset)&CYCLONE_TIMER_MASK);
- return ret * (1000000000 / CYCLONE_TIMER_FREQ);
+ return ret * (NSEC_PER_SEC / CYCLONE_TIMER_FREQ);
}
static int __init init_cyclone(char* override)
diff -Nru a/arch/i386/kernel/timers/timer_tsc.c b/arch/i386/kernel/timers/timer_tsc.c
--- a/arch/i386/kernel/timers/timer_tsc.c Fri Jun 13 16:16:11 2003
+++ b/arch/i386/kernel/timers/timer_tsc.c Fri Jun 13 16:16:11 2003
@@ -176,8 +176,8 @@
delta = edx;
}
delta += delay_at_last_interrupt;
- lost = delta/(1000000/HZ);
- delay = delta%(1000000/HZ);
+ lost = delta/(USEC_PER_SEC/HZ);
+ delay = delta%(USEC_PER_SEC/HZ);
if (lost >= 2)
jiffies += lost-1;
reply other threads:[~2003-06-13 23:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1055546646.18636.187.camel@w-jstultz2.beaverton.ibm.com \
--to=johnstul@us.ibm.com \
--cc=george@mvista.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).