aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-10-16 04:27:28 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:08 -0400
commit1a80521990a0e30e61a92994a009adc52161b070 (patch)
tree3cf900adf9383ff68fd66cd74cfaf0e0ce483845 /arch/um/os-Linux
parent61b63c556c0877ee6d3832ee641bc427ff4d94d6 (diff)
uml: use *SEC_PER_*SEC constants
There are various uses of powers of 1000, plus the odd BILLION constant in the time code. However, there are perfectly good definitions of *SEC_PER_*SEC in linux/time.h which can be used instaed. These are replaced directly in kernel code. Userspace code imports those constants as UM_*SEC_PER_*SEC and uses these. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/os-Linux')
-rw-r--r--arch/um/os-Linux/skas/process.c12
-rw-r--r--arch/um/os-Linux/time.c12
2 files changed, 13 insertions, 11 deletions
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 9936531a2620..8548f126d628 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -294,8 +294,8 @@ void userspace(struct uml_pt_regs *regs)
294 294
295 if (getitimer(ITIMER_VIRTUAL, &timer)) 295 if (getitimer(ITIMER_VIRTUAL, &timer))
296 printk("Failed to get itimer, errno = %d\n", errno); 296 printk("Failed to get itimer, errno = %d\n", errno);
297 nsecs = timer.it_value.tv_sec * BILLION + 297 nsecs = timer.it_value.tv_sec * UM_NSEC_PER_SEC +
298 timer.it_value.tv_usec * 1000; 298 timer.it_value.tv_usec * UM_NSEC_PER_USEC;
299 nsecs += os_nsecs(); 299 nsecs += os_nsecs();
300 300
301 while (1) { 301 while (1) {
@@ -347,8 +347,10 @@ void userspace(struct uml_pt_regs *regs)
347 block_signals(); 347 block_signals();
348 (*sig_info[sig])(sig, regs); 348 (*sig_info[sig])(sig, regs);
349 unblock_signals(); 349 unblock_signals();
350 nsecs = timer.it_value.tv_sec * BILLION + 350 nsecs = timer.it_value.tv_sec *
351 timer.it_value.tv_usec * 1000; 351 UM_NSEC_PER_SEC +
352 timer.it_value.tv_usec *
353 UM_NSEC_PER_USEC;
352 nsecs += os_nsecs(); 354 nsecs += os_nsecs();
353 break; 355 break;
354 case SIGIO: 356 case SIGIO:
@@ -395,7 +397,7 @@ __initcall(init_thread_regs);
395 397
396int copy_context_skas0(unsigned long new_stack, int pid) 398int copy_context_skas0(unsigned long new_stack, int pid)
397{ 399{
398 struct timeval tv = { .tv_sec = 0, .tv_usec = 1000000 / UM_HZ }; 400 struct timeval tv = { .tv_sec = 0, .tv_usec = UM_USEC_PER_SEC / UM_HZ };
399 int err; 401 int err;
400 unsigned long current_stack = current_stub_stack(); 402 unsigned long current_stack = current_stub_stack();
401 struct stub_data *data = (struct stub_data *) current_stack; 403 struct stub_data *data = (struct stub_data *) current_stack;
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index 574b134f0502..e34e1effe0f5 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -14,7 +14,7 @@
14 14
15int set_interval(void) 15int set_interval(void)
16{ 16{
17 int usec = 1000000/UM_HZ; 17 int usec = UM_USEC_PER_SEC / UM_HZ;
18 struct itimerval interval = ((struct itimerval) { { 0, usec }, 18 struct itimerval interval = ((struct itimerval) { { 0, usec },
19 { 0, usec } }); 19 { 0, usec } });
20 20
@@ -26,11 +26,11 @@ int set_interval(void)
26 26
27int timer_one_shot(int ticks) 27int timer_one_shot(int ticks)
28{ 28{
29 unsigned long usec = ticks * 1000000 / UM_HZ; 29 unsigned long usec = ticks * UM_USEC_PER_SEC / UM_HZ;
30 unsigned long sec = usec / 1000000; 30 unsigned long sec = usec / UM_USEC_PER_SEC;
31 struct itimerval interval; 31 struct itimerval interval;
32 32
33 usec %= 1000000; 33 usec %= UM_USEC_PER_SEC;
34 interval = ((struct itimerval) { { 0, 0 }, { sec, usec } }); 34 interval = ((struct itimerval) { { 0, 0 }, { sec, usec } });
35 35
36 if (setitimer(ITIMER_VIRTUAL, &interval, NULL) == -1) 36 if (setitimer(ITIMER_VIRTUAL, &interval, NULL) == -1)
@@ -78,8 +78,8 @@ extern void alarm_handler(int sig, struct sigcontext *sc);
78 78
79void idle_sleep(unsigned long long nsecs) 79void idle_sleep(unsigned long long nsecs)
80{ 80{
81 struct timespec ts = { .tv_sec = nsecs / BILLION, 81 struct timespec ts = { .tv_sec = nsecs / UM_NSEC_PER_SEC,
82 .tv_nsec = nsecs % BILLION }; 82 .tv_nsec = nsecs % UM_NSEC_PER_SEC };
83 83
84 if (nanosleep(&ts, &ts) == 0) 84 if (nanosleep(&ts, &ts) == 0)
85 alarm_handler(SIGVTALRM, NULL); 85 alarm_handler(SIGVTALRM, NULL);