From patchwork Fri Sep 18 02:51:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pingbo Wen X-Patchwork-Id: 53857 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 949FF22E57 for ; Fri, 18 Sep 2015 02:53:46 +0000 (UTC) Received: by lamp12 with SMTP id p12sf12817869lam.2 for ; Thu, 17 Sep 2015 19:53:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=kMT3eBV/56Iu9HdfaLONBNGsTTerBgerdQyUK40Ud9I=; b=H+MHslxzhHBPrLvKRcPE7GiOqvlWeqwdVMTChRy5vAnbmhiIGc9MmhedMcaAvSX7z1 BCi57iGzG8jHjzCuuTriiMdNjpmHC4ioCrUgrxABL1p7dXAY+PIhZSwUO/HXqlmqnkxw VHzgyK40pfHQLfL6W+vgyvIOXbWpr2ocCFGk9ju29i6oGQ80b16X0vnDQu/vPp0ZGZ6p OHJuSub03Ao8ynI2lDtPcydE4Y2qa+DcOaQGkoFcM4+QKREN7beQxhc0P5A0cVfKbI1z UD6nu1wePz+XCQbl+H1pLCTL7zM93kJ0xP94Dpcjnakk9sPtcMHvKr5Wd31u7bydyLVJ s04Q== X-Gm-Message-State: ALoCoQnICFgxzHNO5mEx9bnzHfz4Bx1OJX7ArkenDGGLhBEjfduYOWsnsVFMMpmAGFRvh22c1xol X-Received: by 10.112.202.165 with SMTP id kj5mr407986lbc.5.1442544824645; Thu, 17 Sep 2015 19:53:44 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.219.35 with SMTP id pl3ls152585lac.16.gmail; Thu, 17 Sep 2015 19:53:44 -0700 (PDT) X-Received: by 10.112.36.229 with SMTP id t5mr2033930lbj.61.1442544824478; Thu, 17 Sep 2015 19:53:44 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id m6si2326127laf.62.2015.09.17.19.53.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Sep 2015 19:53:44 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by lbbvu2 with SMTP id vu2so18664683lbb.0 for ; Thu, 17 Sep 2015 19:53:44 -0700 (PDT) X-Received: by 10.152.26.98 with SMTP id k2mr2022859lag.41.1442544824176; Thu, 17 Sep 2015 19:53:44 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp31350lbq; Thu, 17 Sep 2015 19:53:43 -0700 (PDT) X-Received: by 10.67.6.73 with SMTP id cs9mr4437583pad.130.1442544822942; Thu, 17 Sep 2015 19:53:42 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id is9si9777680pbc.208.2015.09.17.19.53.42; Thu, 17 Sep 2015 19:53:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752711AbbIRCxl (ORCPT + 30 others); Thu, 17 Sep 2015 22:53:41 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:33808 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752010AbbIRCxj (ORCPT ); Thu, 17 Sep 2015 22:53:39 -0400 Received: by padhy16 with SMTP id hy16so36816080pad.1 for ; Thu, 17 Sep 2015 19:53:39 -0700 (PDT) X-Received: by 10.68.238.161 with SMTP id vl1mr4440289pbc.114.1442544818956; Thu, 17 Sep 2015 19:53:38 -0700 (PDT) Received: from localhost.localdomain ([202.130.115.78]) by smtp.gmail.com with ESMTPSA id pe5sm5868180pac.17.2015.09.17.19.53.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Sep 2015 19:53:38 -0700 (PDT) From: WEN Pingbo To: linux-usb@vger.kernel.org Cc: y2038@lists.linaro.org, linux-kernel@vger.kernel.org, arnd@arndb.de, balbi@ti.com, peter@stuge.se, stern@rowland.harvard.edu, WEN Pingbo Subject: [PATCH V3] dummy_hcd: replace timeval with timespec64 Date: Fri, 18 Sep 2015 10:51:26 +0800 Message-Id: <1442544686-15571-1-git-send-email-pingbo.wen@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1527029.ps0FmI1B3T@wuerfel> References: <1527029.ps0FmI1B3T@wuerfel> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pingbo.wen@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 Reviewed-by: Arnd Bergmann --- V3 Updates: - using ts64 variable name to avoid confusion V2 Updates: - using monotonic time here by replacing getnstimeofday() with ktime_get_ts64(), to avoid leap second issues. The frame time in USB is always 1ms, no matter what speed, so ktime_get_ts64() have enough resolution to cover this. - using NSEC_PER_MSEC instead of hard code. drivers/usb/gadget/udc/dummy_hcd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c index 1379ad4..2ac9a13 100644 --- a/drivers/usb/gadget/udc/dummy_hcd.c +++ b/drivers/usb/gadget/udc/dummy_hcd.c @@ -833,10 +833,10 @@ static const struct usb_ep_ops dummy_ep_ops = { /* there are both host and device side versions of this call ... */ static int dummy_g_get_frame(struct usb_gadget *_gadget) { - struct timeval tv; + struct timespec64 ts64; - do_gettimeofday(&tv); - return tv.tv_usec / 1000; + ktime_get_ts64(&ts64); + return ts64.tv_nsec / NSEC_PER_MSEC; } static int dummy_wakeup(struct usb_gadget *_gadget)