From patchwork Thu Jan 8 04:01:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 42864 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f199.google.com (mail-we0-f199.google.com [74.125.82.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C3ADD2055F for ; Thu, 8 Jan 2015 04:03:41 +0000 (UTC) Received: by mail-we0-f199.google.com with SMTP id k11sf206289wes.2 for ; Wed, 07 Jan 2015 20:03:41 -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=j9s6pXEgI0Yrww43LisFcjMxer2sL5Gmt1jNirXmVOk=; b=PuokuTeHIts8JapWTKhA+u6ftjuk6Wh2VfjXX2QStFU2J6SS/V1lE/mXhFIIvtN+S2 g1JkJhWzsz0HxaAfoJ21SDKWQL6A+S9pyaxQkbJisyDCz3Qosx6E49cMrTHP6N51TAGx JyC7FhvlclLuxynfDzU2CaJku3f0DaOYhIAcRnJw+3AV/1kXC6iZk+wvUNhEIGqObgh5 MvmrPEks9PZ/nnt6aci04yeLGGFWDdSMjKQnKqVGcs9lBqIsS4UB2RNmo70Cos7EiThG m+Lzk1sxxQlIn0Q+D6OqR42Y4oOBbhuCv6buUpzR0oa+cM+4SPjTuIey6MxGpIc5VCYt pVeg== X-Gm-Message-State: ALoCoQn3lw0QfcviLSlWbDKoj008EzhEL954Ve8+WS0ZAmujieBBrY0jpF/wtySxfuaEDHH6KLZx X-Received: by 10.112.9.199 with SMTP id c7mr47886lbb.7.1420689821078; Wed, 07 Jan 2015 20:03:41 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.166 with SMTP id f6ls268858lam.39.gmail; Wed, 07 Jan 2015 20:03:40 -0800 (PST) X-Received: by 10.112.164.102 with SMTP id yp6mr9781150lbb.15.1420689820824; Wed, 07 Jan 2015 20:03:40 -0800 (PST) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id bi4si5967885lbc.121.2015.01.07.20.03.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 07 Jan 2015 20:03:40 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id q1so7200921lam.5 for ; Wed, 07 Jan 2015 20:03:40 -0800 (PST) X-Received: by 10.152.23.38 with SMTP id j6mr9983843laf.81.1420689820680; Wed, 07 Jan 2015 20:03:40 -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 c8csp145833lbb; Wed, 7 Jan 2015 20:03:39 -0800 (PST) X-Received: by 10.70.33.228 with SMTP id u4mr11417565pdi.146.1420689813058; Wed, 07 Jan 2015 20:03:33 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5si6383327pdj.119.2015.01.07.20.03.32; Wed, 07 Jan 2015 20:03:33 -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 S932199AbbAHEC5 (ORCPT + 27 others); Wed, 7 Jan 2015 23:02:57 -0500 Received: from mail-pd0-f177.google.com ([209.85.192.177]:35702 "EHLO mail-pd0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932127AbbAHECy (ORCPT ); Wed, 7 Jan 2015 23:02:54 -0500 Received: by mail-pd0-f177.google.com with SMTP id ft15so8691866pdb.8 for ; Wed, 07 Jan 2015 20:02:54 -0800 (PST) X-Received: by 10.68.211.193 with SMTP id ne1mr11186982pbc.49.1420689774387; Wed, 07 Jan 2015 20:02:54 -0800 (PST) Received: from chunyanzhangubtpc.spreadtrum.com ([203.160.240.81]) by mx.google.com with ESMTPSA id mw3sm3067779pdb.70.2015.01.07.20.02.51 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Jan 2015 20:02:53 -0800 (PST) From: Chunyan Zhang To: samuel@sortiz.org Cc: arnd@arndb.de, zhang.lyra@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/6] irda: stir4200: Replace timeval with ktime_t Date: Thu, 8 Jan 2015 12:01:31 +0800 Message-Id: <1420689692-8760-6-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1420689692-8760-1-git-send-email-zhang.chunyan@linaro.org> References: <1420689692-8760-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.46 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: , The stir4200 driver uses 'timeval', which we try to remove in the kernel because all 32-bit time types will break in the year 2038. 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 uses ktime_us_delta to get the elapsed time of microsecond. Signed-off-by: Chunyan Zhang Reviewed-by: Arnd Bergmann --- drivers/net/irda/stir4200.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c index dd1bd10..83cc48a 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,12 @@ 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; 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; + us -= ktime_us_delta(ktime_get(), stir->rx_time); + if (us < 10) return; @@ -823,8 +821,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 +874,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)