Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2065571imm; Thu, 12 Jul 2018 12:38:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdy2EE9nqqqhsRAKajEihodcVHyfQWUGWuPs5JmynCPLbX0z+8pkJuvE5ZSg97SLHd+p33y X-Received: by 2002:a62:ff0e:: with SMTP id b14-v6mr3756216pfn.135.1531424334542; Thu, 12 Jul 2018 12:38:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531424334; cv=none; d=google.com; s=arc-20160816; b=XCIGleRa7FLe+uQGYdWtdUdDp+zmGzQOfMoE9DmJbzewBVGP0c3/b8xOy52UlM1ZHk 03XuG+TxW5e1Cos2hVBVojL0PX/T01oJQNJKLio9TVVYxxvHdVX/HAbnwyGDexAAISgf 83oE7der1XReU7vXWO0/k0bBa2ncqGMk0I8LVfXPtMwRAe202AC2alrX92qCY0N4p1/P D8A95jCg3PrEBNSbU4lqUuW6jGITNL4kPIATO8d6en4X8uqZswAiamPlhV8t+rgx44FG NNdWTjb2WJ70pQRSSmfTwvzcmomx1mPZitOz9eX97kN7mnWe6IsEUOH4tsGIL8RDnBve ca+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=1H4ZVoxTvgMs0JiGpNJMfldzuQJmp0i6MfNkkcj76r4=; b=rq74rNjcIoC9cWmwgmfVaG0lD93UiONT+tCuNCpEWBldHIGnq+5Jg5PyzSi9hKb6KE a252/sALcJO4JV+7QXe71oOMQhqUv5xiqgS81Na8DgTsOlK/qF5H9fAmMlwQXkDLpiQV d8lSmkpiTvh0RAz6/cadurc6v9NI3SrxSAevBAHtvyYCMLPMpdWhB0oGjAyds/E7Vllk aeSkAQA4Jt0ZoQ6oE+KHPPBsAIFVcDlcDYI3lX0mKBHVRssKpUvcD+NTa8qdvH77o4aY T4ROY3b9qldyYOMAXugnZxHrlv7MIk0eKfVPP30yiJ8NPbA0fgFKsBUV4xRimvmLmyUc xXZg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h91-v6si21657031pld.132.2018.07.12.12.38.38; Thu, 12 Jul 2018 12:38:54 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732229AbeGLTsy (ORCPT + 99 others); Thu, 12 Jul 2018 15:48:54 -0400 Received: from terminus.zytor.com ([198.137.202.136]:44033 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726583AbeGLTsy (ORCPT ); Thu, 12 Jul 2018 15:48:54 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w6CJbTgc4025697 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 12 Jul 2018 12:37:29 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w6CJbTQ34025694; Thu, 12 Jul 2018 12:37:29 -0700 Date: Thu, 12 Jul 2018 12:37:29 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Eric Dumazet Message-ID: Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, peterz@infradead.org, john.stultz@linaro.org, edumazet@google.com, willemb@google.com, eric.dumazet@gmail.com, hpa@zytor.com, torvalds@linux-foundation.org, mingo@kernel.org Reply-To: tglx@linutronix.de, edumazet@google.com, peterz@infradead.org, john.stultz@linaro.org, linux-kernel@vger.kernel.org, willemb@google.com, hpa@zytor.com, eric.dumazet@gmail.com, mingo@kernel.org, torvalds@linux-foundation.org In-Reply-To: <20180711181641.10369-1-edumazet@google.com> References: <20180711181641.10369-1-edumazet@google.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/core] ktime: Provide typesafe ktime_to_ns() Git-Commit-ID: a8802d97e73346bc81609df9dfba7d3306f40d87 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: a8802d97e73346bc81609df9dfba7d3306f40d87 Gitweb: https://git.kernel.org/tip/a8802d97e73346bc81609df9dfba7d3306f40d87 Author: Eric Dumazet AuthorDate: Wed, 11 Jul 2018 11:16:41 -0700 Committer: Thomas Gleixner CommitDate: Thu, 12 Jul 2018 21:35:28 +0200 ktime: Provide typesafe ktime_to_ns() Using ktime_to_ns() is nice to help backports to stable kernels. Having a typesafe function instead of a macro avoid stupid typos and waste of time tracking these typos. Reported-by: Willem de Bruijn Signed-off-by: Eric Dumazet Signed-off-by: Thomas Gleixner Cc: Eric Dumazet Cc: John Stultz Cc: Peter Zijlstra Cc: Linus Torvalds Link: https://lkml.kernel.org/r/20180711181641.10369-1-edumazet@google.com --- include/linux/ktime.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/linux/ktime.h b/include/linux/ktime.h index 5b9fddbaac41..b2bb44f87f5a 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h @@ -93,8 +93,11 @@ static inline ktime_t timeval_to_ktime(struct timeval tv) /* Map the ktime_t to timeval conversion to ns_to_timeval function */ #define ktime_to_timeval(kt) ns_to_timeval((kt)) -/* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */ -#define ktime_to_ns(kt) (kt) +/* Convert ktime_t to nanoseconds */ +static inline s64 ktime_to_ns(const ktime_t kt) +{ + return kt; +} /** * ktime_compare - Compares two ktime_t variables for less, greater or equal