Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1117287imm; Wed, 11 Jul 2018 17:49:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeBP1OGarv/uNz6fX02tfrBv7dg+9uTyxu5zJfMF93kEBHQ9j50xSufyIemqUSEv/CsqCqP X-Received: by 2002:a63:ad07:: with SMTP id g7-v6mr93791pgf.19.1531356586886; Wed, 11 Jul 2018 17:49:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531356586; cv=none; d=google.com; s=arc-20160816; b=irCCRm/ts8T7xPZF9LYkpx+7ZJGH1MbAIh2Hen3TPkFuV5pvYlFZ5KuI55wT9sjgAf 6DfN6kHhEXnQSPnPI0nk8iqlqRahO04VhSLA7Xq43rf8RUB5mVUQWT/r0GZ8ArV7Bbke oj9RzeUWb9WpSWPbcXETld1h3QzXSQ5JfVIUH1A0N//wcJ2h4i4x3o7SsS4FLixHlzU3 /Rg40CeKb6FcGbIodSZlB196LrRZmm9eR2gNYzF1xmcOINSKP9OzVAnn3IhUaD4f0Gqq FCkB7IAtuL0Y7JLFIshqDZqtQ7b5KVM51yoxeqYe8X1PAeTQuvXOaHBJkPe0uiwW0/x/ lAig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=CEZ1FoSaiekmn3kJ50BUocE+MxlrpDOtfRIbZMjFEjU=; b=ioSYmKH7H/q3ngIbQSHPB/mMiMIkYpp2+8CvOb0VoksORBr4EWM+parvvTY8lZcIcE U51svcaE7TkF5e+mMAW/uu++0nKtaiNoQ/muudJepBkO97SbOkf/qr4Zzm/UURwAMYlx TcvCYdzpeOLfAyxjzrC5Jgf8k2yNgpHJuybg+mq7ySUekJIByQE3dWH8lFWJVrOEbnIT sun8oULqPkoWmdNdVAnOSGx7fhoOPZoHceRKL62e0IH0EivZVxmwWOrB+HB2vO1swRHB e0Ln9FPlRz056d5iwAdC4tZDqtrFT0JDQpQROXYwfroH981WJAM/ivLroo9JhEao+gjr Njgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=v2rqONuV; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t71-v6si13926826pgd.271.2018.07.11.17.49.31; Wed, 11 Jul 2018 17:49:46 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=v2rqONuV; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733261AbeGKSWS (ORCPT + 99 others); Wed, 11 Jul 2018 14:22:18 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:34914 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726796AbeGKSWS (ORCPT ); Wed, 11 Jul 2018 14:22:18 -0400 Received: by mail-pl0-f68.google.com with SMTP id k1-v6so9507240plt.2 for ; Wed, 11 Jul 2018 11:16:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=CEZ1FoSaiekmn3kJ50BUocE+MxlrpDOtfRIbZMjFEjU=; b=v2rqONuVexqaJcm3tUSixGXWtf+NwFKIub56Bl+Qri0lqxFbiGCuby3CfRJK2PwMAr g/s7pOS4MR06LNXMBlGGSS2DywtzdlTSD0gQ3Oo12N1vSEVhBF33B9qwKiNj2j8rkDfK XcEwRcORje8FqKA98ENXKDag0rAXK8pkNgphiVJEXNDfQn5c0SzzhWITVrrqojh5Z9ZM wrASNP3x4cdz9emKlfBnp8sxSEbdO0bWj4uiu1TyWSA0L69EZxWMS8k2ScQa5pOsJzXO RMbvXSfmOXJ3dE9dL/qQMlv+k8e9R+XDAKarXlBguf6cHgKxbT6wxofkHvTRJIfYzTUe qPTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=CEZ1FoSaiekmn3kJ50BUocE+MxlrpDOtfRIbZMjFEjU=; b=dKoGtPAOYNJ0vNTOSAmhZ6GlPEJdPKlAVx1EQB4e+5MVgHJ8K0+ZdPqWDbf0ujIvEG qV+fVWHg2OpJPaPWQQhyip0pdE/sRWiuxeEJXycMBlfKQ/cmay36pakBNJj36tjMsb0E VbjAlCMhCwBUw6jKsrD8qobWelYuNGJoFmiKGy0oqBHqzGAThWfxPYhryVIwY65/4FKT RPRZEYjxBo5ETYYqAhHpwjudXukYF8wTSop3+E0iOtppvgJMGsPZKqkhNt0BsKhLG4kd fH9Jv4+oIm54dIozgCyyGuDoqDcJWlL5ij55kYTQAveczerPJ4+mQqKLi+gY7UiP6/6N AaJA== X-Gm-Message-State: APt69E3ZanZQv8G9IgeawV1Hrz24sP7IxQy/rXGalF+ipdR8iwJdA75t JFv6c941SwOLnvgKuWWYMOwafw== X-Received: by 2002:a17:902:9a8a:: with SMTP id w10-v6mr29658232plp.333.1531333007525; Wed, 11 Jul 2018 11:16:47 -0700 (PDT) Received: from localhost ([2620:15c:2c4:201:f5a:7eca:440a:3ead]) by smtp.gmail.com with ESMTPSA id t21-v6sm9739196pfh.45.2018.07.11.11.16.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Jul 2018 11:16:46 -0700 (PDT) From: Eric Dumazet To: Thomas Gleixner Cc: lkml , Eric Dumazet , Willem de Bruijn , Eric Dumazet , John Stultz , Peter Zijlstra , Linus Torvalds Subject: [PATCH] ktime: provide typesafe ktime_to_ns() Date: Wed, 11 Jul 2018 11:16:41 -0700 Message-Id: <20180711181641.10369-1-edumazet@google.com> X-Mailer: git-send-email 2.18.0.203.gfac676dfb9-goog Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Eric Dumazet Reported-by: Willem de Bruijn Cc: John Stultz Cc: Peter Zijlstra Cc: Linus Torvalds --- 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 5b9fddbaac4166b11121f75a3f3b4db7af1aac4c..b2bb44f87f5a3edb6ee6f179c83fcde42a363fe5 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 -- 2.18.0.203.gfac676dfb9-goog