Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752862AbbDEHcw (ORCPT ); Sun, 5 Apr 2015 03:32:52 -0400 Received: from www.osadl.org ([62.245.132.105]:40972 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752092AbbDEHcj (ORCPT ); Sun, 5 Apr 2015 03:32:39 -0400 From: Nicholas Mc Guire To: Michal Marek Cc: Masahiro Yamada , Sam Ravnborg , Thomas Gleixner , "H. Peter Alvin" , Joe Perches , John Stultz , Andrew Hunter , Paul Turner , linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH 3/3] time: update msecs_to_jiffies doc and move to kernel-doc format Date: Sun, 5 Apr 2015 09:23:56 +0200 Message-Id: <1428218636-3780-4-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1428218636-3780-1-git-send-email-hofrat@osadl.org> References: <1428218636-3780-1-git-send-email-hofrat@osadl.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3174 Lines: 92 update the documentation of msecs_to_jiffies and move to kernel-doc format Signed-off-by: Nicholas Mc Guire --- Patch was compile with x86_64_defconfig Patch is against 4.0-rc6 (localversion-next is -next-20150402) include/linux/jiffies.h | 23 +++++++++++++++++++++++ kernel/time/time.c | 19 ++++++++++--------- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index dcd8ba5..a75158e 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h @@ -290,6 +290,29 @@ static inline u64 jiffies_to_nsecs(const unsigned long j) } extern unsigned long __msecs_to_jiffies(const unsigned int m); + +/** + * msecs_to_jiffies: - convert milliseconds to jiffies + * @m: time in millisecons + * + * conversion is done as follows: + * + * - negative values mean 'infinite timeout' (MAX_JIFFY_OFFSET) + * + * - 'too large' values [that would result in larger than + * MAX_JIFFY_OFFSET values] mean 'infinite timeout' too. + * + * - all other values are converted to jiffies by either multiplying + * the input value by a factor or dividing it with a factor and + * handling any 32-bit overflows. + * for the details see __msecs_to_jiffies() + * + * msecs_to_jiffies() checks for the passed in value being a constant + * via __builtin_constant_p() allowing gcc to eliminate most of the + * code, __msecs_to_jiffies() is called if the value passed does not + * allow constant folding and the actual conversion must be done at + * runtime. + */ static inline unsigned long msecs_to_jiffies(const unsigned int m) { /* diff --git a/kernel/time/time.c b/kernel/time/time.c index 3797540..5d97610 100644 --- a/kernel/time/time.c +++ b/kernel/time/time.c @@ -483,22 +483,23 @@ struct timespec64 ns_to_timespec64(const s64 nsec) } EXPORT_SYMBOL(ns_to_timespec64); #endif -/* - * When we convert to jiffies then we interpret incoming values - * the following way: + +/** + * __msecs_to_jiffies: - convert milliseconds to jiffies + * @m: time in millisecons * - * - negative values mean 'infinite timeout' (MAX_JIFFY_OFFSET) - * negative values are handled in msecs_to_jiffies in - * include/linux/jiffies.h + * conversion is done as follows: * * - 'too large' values [that would result in larger than * MAX_JIFFY_OFFSET values] mean 'infinite timeout' too. * * - all other values are converted to jiffies by either multiplying - * the input value by a factor or dividing it with a factor - * - * We must also be careful about 32-bit overflows. + * the input value by a factor or dividing it with a factor and + * handling any 32-bit overflows. * + * __msecs_to_jiffies() is called if the value passed to + * msecs_to_jiffies() does not allow constant folding and the actual + * conversion must be done at runtime. */ unsigned long __msecs_to_jiffies(const unsigned int m) { -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/