From patchwork Thu Jan 8 04:01:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 42863 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6AC5D2055F for ; Thu, 8 Jan 2015 04:03:39 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id z12sf543118lbi.2 for ; Wed, 07 Jan 2015 20:03:38 -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=pJTlcYpaO4DiRC+CV4nMpikVkdeOdTc7hvDPac85itM=; b=FvPsnOvT13rLO+jykhFmIrWGykoDVIx/C7OlgN6v9X8q78W4m3Tllp95IpGMwKH/Vk jocGYlN1jz4JM7isZmk8QIB4WuJYtfk+z4foUMf3V5+grI0UjFvA14Hr1qPRLpVol2pH rVl3dhdmxE7L0jX4f3HsUscQhf6XZxFCh64c9/FtV2ia0SuRhLP+wckgdFFsZK3TlnE+ MtaimsSsKqOvRGGoclq/t0KyaqYr6Qlau1+Ukg4mFTq4ax0KBoL6UOYN6v9xVMGu2SVS xIstjfXFoZsZyog9z/Iuwn6WxXv1HHwTUMYLenAM/yERko+6/hJPgK4BpefQR+kcRkmt 75uw== X-Gm-Message-State: ALoCoQm0Ai3RPpOiMRJVTMKCFUxcHLNGqpNa/M+ygl2Np2LKAxyhcJefZRAXaNoH1Ekz7wREm3LG X-Received: by 10.112.141.232 with SMTP id rr8mr885549lbb.0.1420689818406; Wed, 07 Jan 2015 20:03:38 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.70 with SMTP id be6ls136605lab.42.gmail; Wed, 07 Jan 2015 20:03:38 -0800 (PST) X-Received: by 10.112.119.201 with SMTP id kw9mr9797217lbb.99.1420689818159; Wed, 07 Jan 2015 20:03:38 -0800 (PST) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id ob7si5968897lbb.127.2015.01.07.20.03.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 07 Jan 2015 20:03:38 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by mail-lb0-f178.google.com with SMTP id u14so893551lbd.9 for ; Wed, 07 Jan 2015 20:03:37 -0800 (PST) X-Received: by 10.152.43.103 with SMTP id v7mr10012302lal.29.1420689817822; Wed, 07 Jan 2015 20:03:37 -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 c8csp145817lbb; Wed, 7 Jan 2015 20:03:36 -0800 (PST) X-Received: by 10.68.69.48 with SMTP id b16mr10966709pbu.59.1420689812113; Wed, 07 Jan 2015 20:03:32 -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.31; Wed, 07 Jan 2015 20:03:32 -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 S932124AbbAHECy (ORCPT + 27 others); Wed, 7 Jan 2015 23:02:54 -0500 Received: from mail-pd0-f182.google.com ([209.85.192.182]:38545 "EHLO mail-pd0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755979AbbAHECv (ORCPT ); Wed, 7 Jan 2015 23:02:51 -0500 Received: by mail-pd0-f182.google.com with SMTP id p10so8668229pdj.13 for ; Wed, 07 Jan 2015 20:02:50 -0800 (PST) X-Received: by 10.68.65.79 with SMTP id v15mr11436121pbs.56.1420689770692; Wed, 07 Jan 2015 20:02:50 -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.47 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Jan 2015 20:02:49 -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 4/6] irda: nsc-ircc: Replace timeval with ktime_t Date: Thu, 8 Jan 2015 12:01:30 +0800 Message-Id: <1420689692-8760-5-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.217.178 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 nsc ircc 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, 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 Reviewed-by: Arnd Bergmann --- drivers/net/irda/nsc-ircc.c | 7 ++----- drivers/net/irda/nsc-ircc.h | 5 ++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c index e7317b1..dc0dbd8 100644 --- a/drivers/net/irda/nsc-ircc.c +++ b/drivers/net/irda/nsc-ircc.c @@ -1501,10 +1501,7 @@ 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; + diff = ktime_us_delta(ktime_get(), self->stamp); /* Check if the mtt is larger than the time we have * already used by all the protocol processing @@ -1867,7 +1864,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..7be5acb 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,7 @@ struct nsc_ircc_cb { __u8 ier; /* Interrupt enable register */ - struct timeval stamp; - struct timeval now; + ktime_t stamp; spinlock_t lock; /* For serializing operations */