Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: gadget: dummy_hcd: replace timeval with timespec64

The millisecond of the last second will be normal if tv_sec is
overflowed. But for y2038 consistency and demonstration purpose,
and avoiding further risks, we need to remove 'timeval' in this
driver, to avoid similair problems.

Signed-off-by: Pingbo Wen <pingbo.wen@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>

authored by

WEN Pingbo and committed by
Felipe Balbi
04c4d8d4 6344475f

+3 -3
+3 -3
drivers/usb/gadget/udc/dummy_hcd.c
··· 833 833 /* there are both host and device side versions of this call ... */ 834 834 static int dummy_g_get_frame(struct usb_gadget *_gadget) 835 835 { 836 - struct timeval tv; 836 + struct timespec64 ts64; 837 837 838 - do_gettimeofday(&tv); 839 - return tv.tv_usec / 1000; 838 + ktime_get_ts64(&ts64); 839 + return ts64.tv_nsec / NSEC_PER_MSEC; 840 840 } 841 841 842 842 static int dummy_wakeup(struct usb_gadget *_gadget)