From patchwork Wed Jan 7 03:39:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 42804 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f198.google.com (mail-we0-f198.google.com [74.125.82.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4DF322062F for ; Wed, 7 Jan 2015 03:41:20 +0000 (UTC) Received: by mail-we0-f198.google.com with SMTP id q59sf247339wes.9 for ; Tue, 06 Jan 2015 19:41:19 -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=SFAzdig1BZ3d3xyhImS2jdThFjmiuIxDsu67wdMm4Ek=; b=dMt2xw+xJG0t4F3+2ODsyfkwxXT4DspWxIANBJkC45oGnLV5Vt1z++JA0mUrvuoUqv QjEgSgM4a/fVQ912uJfyUbHcox57ffOi1YP23XomLEIOzTc44QQK+I+jFFuPO45JCUge yTRgrv4ANDxrQN7eo3L2EhFncX/UJHZGQfZLZU+jycowT1rcKaQH4AfIVDeBLFrg1puc fbC6YPfLYrJovbF6nknvoB8XC/qHIaO2OerWQxCDeZAVsxCvH2FhowFWjpuFlKFqSI43 +pVzvPjbOdorvM2CLENwpfP+VVZuDDmBQWqgoPrMX9vX9jcu6bDdeKydHHgKXOyP5tjv YjBg== X-Gm-Message-State: ALoCoQkZuSMLIChh5suOxNsq+Z7f7m7hi5m1Ve02cV0joLef7/L9xBbL9eHDX+X2sOph9sRxJMfa X-Received: by 10.181.13.147 with SMTP id ey19mr2623536wid.2.1420602079568; Tue, 06 Jan 2015 19:41:19 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.234 with SMTP id r10ls96867lal.17.gmail; Tue, 06 Jan 2015 19:41:19 -0800 (PST) X-Received: by 10.152.87.46 with SMTP id u14mr875728laz.36.1420602079378; Tue, 06 Jan 2015 19:41:19 -0800 (PST) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id zp10si454537lbb.104.2015.01.06.19.41.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 Jan 2015 19:41:19 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by mail-lb0-f181.google.com with SMTP id l4so424120lbv.12 for ; Tue, 06 Jan 2015 19:41:19 -0800 (PST) X-Received: by 10.152.26.201 with SMTP id n9mr877708lag.50.1420602079253; Tue, 06 Jan 2015 19:41:19 -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 c8csp1355648lbb; Tue, 6 Jan 2015 19:41:18 -0800 (PST) X-Received: by 10.70.64.197 with SMTP id q5mr1113072pds.129.1420602075498; Tue, 06 Jan 2015 19:41:15 -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.14; Tue, 06 Jan 2015 19:41:15 -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 S1757496AbbAGDlF (ORCPT + 27 others); Tue, 6 Jan 2015 22:41:05 -0500 Received: from mail-pa0-f52.google.com ([209.85.220.52]:55497 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757099AbbAGDlB (ORCPT ); Tue, 6 Jan 2015 22:41:01 -0500 Received: by mail-pa0-f52.google.com with SMTP id eu11so1977268pac.11 for ; Tue, 06 Jan 2015 19:41:01 -0800 (PST) X-Received: by 10.70.33.228 with SMTP id u4mr1359802pdi.146.1420602061155; Tue, 06 Jan 2015 19:41:01 -0800 (PST) Received: from chunyanzhangubtpc.spreadtrum.com ([203.160.240.81]) by mx.google.com with ESMTPSA id pf10sm261320pbc.82.2015.01.06.19.40.57 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Jan 2015 19:41:00 -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 4/6] driver/net/irda: Replace timeval with ktime_t in nsc-ircc Date: Wed, 7 Jan 2015 11:39:36 +0800 Message-Id: <1420601978-15866-5-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.217.181 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, and in this way it no longer needs to check for the overflow, because ktime_us_delta returns time difference of microsecond. Signed-off-by: Chunyan Zhang --- drivers/net/irda/nsc-ircc.c | 8 +++----- drivers/net/irda/nsc-ircc.h | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c index e7317b1..cabb82e 100644 --- a/drivers/net/irda/nsc-ircc.c +++ b/drivers/net/irda/nsc-ircc.c @@ -1501,10 +1501,8 @@ static netdev_tx_t nsc_ircc_hard_xmit_fir(struct sk_buff *skb, mtt = irda_get_mtt(skb); if (mtt) { /* Check how much time we have used already */ - do_gettimeofday(&self->now); - diff = self->now.tv_usec - self->stamp.tv_usec; - if (diff < 0) - diff += 1000000; + self->now = ktime_get(); + diff = ktime_us_delta(self->now, self->stamp); /* Check if the mtt is larger than the time we have * already used by all the protocol processing @@ -1867,7 +1865,7 @@ static int nsc_ircc_dma_receive_complete(struct nsc_ircc_cb *self, int iobase) * reduce the min turn time a bit since we will know * how much time we have used for protocol processing */ - do_gettimeofday(&self->stamp); + self->stamp = ktime_get(); skb = dev_alloc_skb(len+1); if (skb == NULL) { diff --git a/drivers/net/irda/nsc-ircc.h b/drivers/net/irda/nsc-ircc.h index 32fa582..dd2185a 100644 --- a/drivers/net/irda/nsc-ircc.h +++ b/drivers/net/irda/nsc-ircc.h @@ -28,7 +28,7 @@ #ifndef NSC_IRCC_H #define NSC_IRCC_H -#include +#include #include #include @@ -263,8 +263,8 @@ struct nsc_ircc_cb { __u8 ier; /* Interrupt enable register */ - struct timeval stamp; - struct timeval now; + ktime_t stamp; + ktime_t now; spinlock_t lock; /* For serializing operations */