Skip to contentSkip to conversation

alpha/osf_sys: use helper functions to convert between tv and jiffies

PATCH In review [email protected] 2 participants 2 messages May 13, 2005 – May 14, 2005 Alpha port

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 alpha/osf_sys: use helper functions to convert between tv and jiffies

From: Nishanth Aravamudan <[email protected]>

Use helper functions to convert between timeval structure and jiffies rather than custom logic.

---
 osf_sys.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
arch/alpha/kernel/osf_sys.c +2 -5
Index: quilt/arch/alpha/kernel/osf_sys.c
===================================================================
@@ -1150,16 +1150,13 @@ osf_usleep_thread(struct timeval32 __use
 	if (get_tv32(&tmp, sleep))
 		goto fault;
 
-	ticks = tmp.tv_usec;
-	ticks = (ticks + (1000000 / HZ) - 1) / (1000000 / HZ);
-	ticks += tmp.tv_sec * HZ;
+	ticks = timeval_to_jiffies(&tmp);
 
 	current->state = TASK_INTERRUPTIBLE;
 	ticks = schedule_timeout(ticks);
 
 	if (remain) {
-		tmp.tv_sec = ticks / HZ;
-		tmp.tv_usec = ticks % HZ;
+		jiffies_to_timeval(ticks, &tmp);
 		if (put_tv32(remain, &tmp))
 			goto fault;
 	}

--

#1 lore raw
Quoted 5 lines · On Saturday 14 May 2005 01:44, [email protected] wrote:

Use helper functions to convert between timeval structure and jiffies rather than custom logic.

arch/alpha/kernel/osf_sys.c osf_usleep_thread(struct timeval32 __use · line 1159

Quoted 9 lines
arch/alpha/kernel/osf_sys.c +2 -5
 
-	ticks = tmp.tv_usec;
-	ticks = (ticks + (1000000 / HZ) - 1) / (1000000 / HZ);
-	ticks += tmp.tv_sec * HZ;
+	ticks = timeval_to_jiffies(&tmp);
 
-		tmp.tv_sec = ticks / HZ;
-		tmp.tv_usec = ticks % HZ;
+		jiffies_to_timeval(ticks, &tmp);

Nitpicking comment: both timeval_to_jiffies and jiffies_to_timeval are prototyped in include/linux/jiffies.h. However, arch/alpha/kernel/osf_sys.c doesn't directly #include it.