From patchwork Wed Dec 17 05:11:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 42368 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C1E9426C90 for ; Wed, 17 Dec 2014 05:13:32 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id l15sf5811499wiw.0 for ; Tue, 16 Dec 2014 21:13:31 -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=dmbSv7vy6yTsWsASIlKgA2/TXEHWIA7jRmxfETWGEyM=; b=d3GNSEIgUriCxXjw7UcWg3sNm/esMm96Dv2lbTG4Lvw0YXM7RWBGWbQnauwbdSAf2z PD+d3toSCJUiNtcKdD5GqibixaW+I5cKI5VtVi5XVswa8IrWMv6vRa5medfaIAC3CTkj S4eWEwyHe6CPE04s5U+/jEP8tXDU8Z1Cf/KVPPtj7IdM28WXmrTFS8eFMVrh03aUtU9z GmkUacNOqJl9r1WcT6Klxe2Oz9rwWC+7d4Q9Pyifz0OeHQZ56pjJCCsSpEFFFr7xUtJI KItcM3Mlyy0UURjPCVhcsMBPvFqBHQ9CPsRV4680VCyNrjzF2fAH2at+XFPhAiGewj+0 1mrQ== X-Gm-Message-State: ALoCoQm4OYELdvRMr9onpYcSXNGPDGDLMAEZIfXCD1BxSG2vl0cekClr2iVFQB+6BOIIc/zkquMT X-Received: by 10.152.44.225 with SMTP id h1mr23269lam.2.1418793211859; Tue, 16 Dec 2014 21:13:31 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.100 with SMTP id i4ls738249laa.106.gmail; Tue, 16 Dec 2014 21:13:31 -0800 (PST) X-Received: by 10.152.44.129 with SMTP id e1mr20121132lam.43.1418793211460; Tue, 16 Dec 2014 21:13:31 -0800 (PST) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id um10si2650897lbb.117.2014.12.16.21.13.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Dec 2014 21:13:31 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by mail-lb0-f182.google.com with SMTP id f15so13327401lbj.13 for ; Tue, 16 Dec 2014 21:13:31 -0800 (PST) X-Received: by 10.152.87.12 with SMTP id t12mr26903249laz.31.1418793211285; Tue, 16 Dec 2014 21:13:31 -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.142.69 with SMTP id ru5csp1248711lbb; Tue, 16 Dec 2014 21:13:30 -0800 (PST) X-Received: by 10.68.239.70 with SMTP id vq6mr20656951pbc.110.1418793209504; Tue, 16 Dec 2014 21:13:29 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y13si4011997pde.84.2014.12.16.21.13.28; Tue, 16 Dec 2014 21:13:29 -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 S1751506AbaLQFNU (ORCPT + 27 others); Wed, 17 Dec 2014 00:13:20 -0500 Received: from mail-pa0-f41.google.com ([209.85.220.41]:34900 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750790AbaLQFNT (ORCPT ); Wed, 17 Dec 2014 00:13:19 -0500 Received: by mail-pa0-f41.google.com with SMTP id rd3so15642272pab.28 for ; Tue, 16 Dec 2014 21:13:19 -0800 (PST) X-Received: by 10.68.197.161 with SMTP id iv1mr1379821pbc.147.1418793198897; Tue, 16 Dec 2014 21:13:18 -0800 (PST) Received: from chunyanzhangubtpc.spreadtrum.com ([203.160.240.81]) by mx.google.com with ESMTPSA id pn2sm2556208pbb.42.2014.12.16.21.13.14 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Dec 2014 21:13:17 -0800 (PST) From: Chunyan Zhang To: tglx@linutronix.de, davem@davemloft.net, john.stultz@linaro.org, dborkman@redhat.com Cc: arnd@linaro.org, linux-kernel@vger.kernel.org, zhang.lyra@gmail.com Subject: [PATCH] ktime.h: Introduce ktime_ms_delta Date: Wed, 17 Dec 2014 13:11:35 +0800 Message-Id: <1418793095-18780-1-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: 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.182 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 adds a reusable time difference function which returns the difference in millisecond, as often used in some driver code, e.g. mtd/test, media/rc, etc. Signed-off-by: Chunyan Zhang Acked-by: Arnd Bergmann --- include/linux/ktime.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/ktime.h b/include/linux/ktime.h index c9d645a..891ea92 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h @@ -186,6 +186,11 @@ static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier) return ktime_to_us(ktime_sub(later, earlier)); } +static inline s64 ktime_ms_delta(const ktime_t later, const ktime_t earlier) +{ + return ktime_to_ms(ktime_sub(later, earlier)); +} + static inline ktime_t ktime_add_us(const ktime_t kt, const u64 usec) { return ktime_add_ns(kt, usec * NSEC_PER_USEC);