Received: by 10.213.65.68 with SMTP id h4csp1742349imn; Sun, 1 Apr 2018 13:45:15 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+MwBYglDcORyVuh/0G5/YFR/Y7riBtshVeTwXwY76AZYs4jicMV+EVPs+Kk56YOxHK1OhS X-Received: by 2002:a17:902:444:: with SMTP id 62-v6mr7493774ple.127.1522615515486; Sun, 01 Apr 2018 13:45:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522615515; cv=none; d=google.com; s=arc-20160816; b=fuhcAz6w7aW8TyDvI8gHNF+VxmXLkGaOt98S20XJM8yewud5G23cQsSxlHA4rV2qY/ 3+sMrr360qkU+jAMyGUhgAxIfZFZXl54NIhIbCRIO0TCVG/1VBLNYaDuPoWKvxJtudf/ TQa8jaFKkLcLa3+UHwMyJJtCrcniiYK9dldmLPuDcQRZ3JgCMBYn5zBnG6/tNGS0l6eA v76EduMegzEhy5PdShlLUAww48cgCF0+spDtpDnTYmrfLuLMgHlOp6YizyO+/2BmyeMj /HUw+xClFa1CsQWH7eAhHoWjzhG4M0WJuP12bSXTrhcMynjxT4ygYwAZ6GvqVbSp1yye 33pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:to:from:subject :organization:arc-authentication-results; bh=SZ+HgAjBtk3F35mfCDfSnT70xQ3OH/q9/qVrzfLqlRE=; b=0UTOAdxwhvsAko6xZL+pfoU90+1uu5REl39B5mQF74UpyyLVSBSFCyN0Z/BgvBnNDB eArTaPNBgmqbfuvYeByF3WawdlK+q5ehpFbBKdLQzvhEWCcY8rbw0hwhWTKMe3J+hMvA 2MAV22voPXxGLJh6YLOb1mNO19n9mekK9Pnjhh4HltFnz57IiVfxPDNtkjM2BfRgr2Az F+HaDE22irqdDSJeWx2JdQNx79QgdYWxwTbaKszyToEKNTgXPULiR1L98dAssdEbe4UR NLfJn0tW3CUPLhVe5QfqAlt4uHDwFaPkYp+bpNfuKeymAtETOOTMMBBe/W8MKQGEtpTt Tj+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v14si8881956pgq.266.2018.04.01.13.45.01; Sun, 01 Apr 2018 13:45:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754356AbeDAUmO (ORCPT + 99 others); Sun, 1 Apr 2018 16:42:14 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43060 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754342AbeDAUmL (ORCPT ); Sun, 1 Apr 2018 16:42:11 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B4BB9406E96B for ; Sun, 1 Apr 2018 20:42:10 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-59.rdu2.redhat.com [10.10.120.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64C9C215CDAC; Sun, 1 Apr 2018 20:42:10 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH 19/45] C++: Turn ktime_add/sub_ns() into inline template functions From: David Howells To: linux-kernel@vger.kernel.org Date: Sun, 01 Apr 2018 21:42:09 +0100 Message-ID: <152261532989.30503.8240475094491126505.stgit@warthog.procyon.org.uk> In-Reply-To: <152261521484.30503.16131389653845029164.stgit@warthog.procyon.org.uk> References: <152261521484.30503.16131389653845029164.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Sun, 01 Apr 2018 20:42:10 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Sun, 01 Apr 2018 20:42:10 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dhowells@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Turn ktime ns arithmetic functions into template functions to handle the nanosecond value type conversion correctly. Signed-off-by: David Howells --- include/linux/ktime.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/linux/ktime.h b/include/linux/ktime.h index 5b9fddbaac41..d46a16f23ffc 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h @@ -58,13 +58,21 @@ static inline ktime_t ktime_set(const s64 secs, const unsigned long nsecs) * Add a ktime_t variable and a scalar nanosecond value. * res = kt + nsval: */ -#define ktime_add_ns(kt, nsval) ((kt) + (nsval)) +template +static inline ktime_t ktime_add_ns(ktime_t kt, NSVAL nsval) +{ + return kt + nsval; +} /* * Subtract a scalar nanosecod from a ktime_t variable * res = kt - nsval: */ -#define ktime_sub_ns(kt, nsval) ((kt) - (nsval)) +template +static inline ktime_t ktime_sub_ns(ktime_t kt, NSVAL nsval) +{ + return kt - nsval; +} /* convert a timespec to ktime_t format: */ static inline ktime_t timespec_to_ktime(struct timespec ts)