From patchwork Wed Jan 7 03:39:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 42805 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 561662062F for ; Wed, 7 Jan 2015 03:41:23 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id p9sf245142lbv.9 for ; Tue, 06 Jan 2015 19:41:22 -0800 (PST) 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=gRLMnxQRy5wTPRjq5hc1LmeispFeVMe8xSYrA12cKnQ=; b=DAK4vVi8zn68qsfpPbKCve7RxghFA8bWqCuvWB5An/beXcDZvcO4WDvhQC/vFwhUty nCgeIujnHu8cZbDhwwafPItQN4ExVv+Q5EeH5g6ikePQROyN6JPG6S3Lrkq3//8Y8Cyg jxiNy3AMruvPAD3splIGRIMXoEST98jZaREb3lCz2hKmrGD8HRNyl5Wv8F28Sik5DCjU Vzd4UxGy0ZyT4TH6d+UkYJDfn+4U6MnXSpQdh8tlRkjHhRScRkppxLX0/Ahx4gQc+lMj LoLDAJf9ls69HTukbUsSAAlvd6AqQAupIi/khBoHSFGVKcB1T9pK/jndSKvAs6+wGgge ktRw== X-Gm-Message-State: ALoCoQlcVaO+IBgEndlvgDBHq1tgloBqVmDrjbiOf2RsCOEIsfmG7KDK/ufu1MsqFQmDTrEQiHvs X-Received: by 10.180.89.211 with SMTP id bq19mr2622875wib.4.1420602082278; Tue, 06 Jan 2015 19:41:22 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.234.203 with SMTP id ug11ls95590lac.67.gmail; Tue, 06 Jan 2015 19:41:22 -0800 (PST) X-Received: by 10.152.3.100 with SMTP id b4mr819365lab.68.1420602082090; Tue, 06 Jan 2015 19:41:22 -0800 (PST) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id qp3si477262lbb.81.2015.01.06.19.41.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 Jan 2015 19:41:22 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id gd6so1258627lab.3 for ; Tue, 06 Jan 2015 19:41:21 -0800 (PST) X-Received: by 10.152.6.132 with SMTP id b4mr788834laa.59.1420602081903; Tue, 06 Jan 2015 19:41:21 -0800 (PST) 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.9.200 with SMTP id c8csp1355664lbb; Tue, 6 Jan 2015 19:41:21 -0800 (PST) X-Received: by 10.66.102.41 with SMTP id fl9mr1313783pab.7.1420602076458; Tue, 06 Jan 2015 19:41:16 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ot1si438366pdb.239.2015.01.06.19.41.15; Tue, 06 Jan 2015 19:41:16 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757587AbbAGDlK (ORCPT + 27 others); Tue, 6 Jan 2015 22:41:10 -0500 Received: from mail-pa0-f53.google.com ([209.85.220.53]:58224 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757278AbbAGDlF (ORCPT ); Tue, 6 Jan 2015 22:41:05 -0500 Received: by mail-pa0-f53.google.com with SMTP id kq14so1972522pab.12 for ; Tue, 06 Jan 2015 19:41:04 -0800 (PST) X-Received: by 10.68.190.103 with SMTP id gp7mr1240345pbc.55.1420602064640; Tue, 06 Jan 2015 19:41:04 -0800 (PST) Received: from chunyanzhangubtpc.spreadtrum.com ([203.160.240.81]) by mx.google.com with ESMTPSA id pf10sm261320pbc.82.2015.01.06.19.41.01 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Jan 2015 19:41:03 -0800 (PST) From: Chunyan Zhang To: samuel@sortiz.org Cc: arnd@linaro.org, zhang.lyra@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/6] driver/net/irda: Replace timeval with ktime_t in stir4200 Date: Wed, 7 Jan 2015 11:39:37 +0800 Message-Id: <1420601978-15866-6-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1420601978-15866-1-git-send-email-zhang.chunyan@linaro.org> References: <1420601978-15866-1-git-send-email-zhang.chunyan@linaro.org> 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: zhang.chunyan@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.215.44 as permitted sender) smtp.mail=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: , This patch changes the 32-bit time type (timeval) to the 64-bit one (ktime_t), since 32-bit time types will break in the year 2038. So, I use ktime_t instead of all uses of timeval. This patch also changes do_gettimeofday() to ktime_get() accordingly, since ktime_get returns a ktime_t, but do_gettimeofday returns a struct timeval, and the other reason is that ktime_get() uses the monotonic clock. This patch use ktime_us_delta to get the elapsed time of microsecond. Signed-off-by: Chunyan Zhang --- drivers/net/irda/stir4200.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c index dd1bd10..008e12d 100644 --- a/drivers/net/irda/stir4200.c +++ b/drivers/net/irda/stir4200.c @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -174,7 +175,7 @@ struct stir_cb { __u8 *fifo_status; iobuff_t rx_buff; /* receive unwrap state machine */ - struct timeval rx_time; + ktime_t rx_time; int receiving; struct urb *rx_urb; }; @@ -650,15 +651,14 @@ static int fifo_txwait(struct stir_cb *stir, int space) static void turnaround_delay(const struct stir_cb *stir, long us) { long ticks; - struct timeval now; + ktime_t now; if (us <= 0) return; - do_gettimeofday(&now); - if (now.tv_sec - stir->rx_time.tv_sec > 0) - us -= USEC_PER_SEC; - us -= now.tv_usec - stir->rx_time.tv_usec; + now = ktime_get(); + us -= ktime_us_delta(now, stir->rx_time); + if (us < 10) return; @@ -823,8 +823,8 @@ static void stir_rcv_irq(struct urb *urb) pr_debug("receive %d\n", urb->actual_length); unwrap_chars(stir, urb->transfer_buffer, urb->actual_length); - - do_gettimeofday(&stir->rx_time); + + stir->rx_time = ktime_get(); } /* kernel thread is stopping receiver don't resubmit */ @@ -876,7 +876,7 @@ static int stir_net_open(struct net_device *netdev) skb_reserve(stir->rx_buff.skb, 1); stir->rx_buff.head = stir->rx_buff.skb->data; - do_gettimeofday(&stir->rx_time); + stir->rx_time = ktime_get(); stir->rx_urb = usb_alloc_urb(0, GFP_KERNEL); if (!stir->rx_urb)