From: YOSHIFUJI Hideaki Date: Mon, 21 Apr 2008 21:28:45 +0000 (-0700) Subject: [DCCP]: Convert do_gettimeofday() to getnstimeofday(). X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cdd04d98f6922f5a7ba52714f077140d42bc67c9;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git [DCCP]: Convert do_gettimeofday() to getnstimeofday(). What do_gettimeofday() does is to call getnstimeofday() and to convert the result from timespec{} to timeval{}. We do not always need timeval{} and we can convert timespec{} when we really need (to print). Signed-off-by: YOSHIFUJI Hideaki Acked-by: Arnaldo Carvalho de Melo Signed-off-by: David S. Miller --- diff --git a/net/dccp/probe.c b/net/dccp/probe.c index 7053bb827bc8..6e1df62bd7c9 100644 --- a/net/dccp/probe.c +++ b/net/dccp/probe.c @@ -46,29 +46,24 @@ struct { struct kfifo *fifo; spinlock_t lock; wait_queue_head_t wait; - struct timeval tstart; + struct timespec tstart; } dccpw; static void printl(const char *fmt, ...) { va_list args; int len; - struct timeval now; + struct timespec now; char tbuf[256]; va_start(args, fmt); - do_gettimeofday(&now); + getnstimeofday(&now); - now.tv_sec -= dccpw.tstart.tv_sec; - now.tv_usec -= dccpw.tstart.tv_usec; - if (now.tv_usec < 0) { - --now.tv_sec; - now.tv_usec += 1000000; - } + now = timespec_sub(now, dccpw.tstart); len = sprintf(tbuf, "%lu.%06lu ", (unsigned long) now.tv_sec, - (unsigned long) now.tv_usec); + (unsigned long) now.tv_nsec / NSEC_PER_USEC); len += vscnprintf(tbuf+len, sizeof(tbuf)-len, fmt, args); va_end(args); @@ -119,7 +114,7 @@ static struct jprobe dccp_send_probe = { static int dccpprobe_open(struct inode *inode, struct file *file) { kfifo_reset(dccpw.fifo); - do_gettimeofday(&dccpw.tstart); + getnstimeofday(&dccpw.tstart); return 0; }