The patch titled add kerneldoc for clamp(), clamp_t(), clamp_val() macros has been removed from the -mm tree. Its filename was add-macros-similar-to-min-max-min_t-max_t-doc.patch This patch was dropped because it was folded into add-macros-similar-to-min-max-min_t-max_t.patch The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: add kerneldoc for clamp(), clamp_t(), clamp_val() macros From: Harvey Harrison <harvey.harrison@xxxxxxxxx> Signed-off-by: Harvey Harrison <harvey.harrison@xxxxxxxxx> Acked-by: Randy Dunlap <randy.dunlap@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/kernel.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff -puN include/linux/kernel.h~add-macros-similar-to-min-max-min_t-max_t-doc include/linux/kernel.h --- a/include/linux/kernel.h~add-macros-similar-to-min-max-min_t-max_t-doc +++ a/include/linux/kernel.h @@ -354,6 +354,15 @@ extern void print_hex_dump_bytes(const c (void) (&_max1 == &_max2); \ _max1 > _max2 ? _max1 : _max2; }) +/** + * clamp - return a value clamped to a given range with strict typechecking + * @val: current value + * @min: minimum allowable value + * @max: maximum allowable value + * + * This macro does strict typechecking of min/max to make sure they are of the + * same type as val. See the unnecessary pointer comparisons. + */ #define clamp(val, min, max) ({ \ typeof(val) __val = (val); \ typeof(min) __min = (min); \ @@ -379,6 +388,16 @@ extern void print_hex_dump_bytes(const c type __max2 = (y); \ __max1 > __max2 ? __max1: __max2; }) +/** + * clamp_t - return a value clamped to a given range using a given type + * @type: the type of variable to use + * @val: current value + * @min: minimum allowable value + * @max: maximum allowable value + * + * This macro does no typechecking and uses temporary variables of type + * 'type' to make all the comparisons. + */ #define clamp_t(type, val, min, max) ({ \ type __val = (val); \ type __min = (min); \ @@ -386,6 +405,17 @@ extern void print_hex_dump_bytes(const c __val = __val < __min ? __min: __val; \ __val > __max ? __max: __val; }) +/** + * clamp_val - return a value clamped to a given range using val's type + * @val: current value + * @min: minimum allowable value + * @max: maximum allowable value + * + * This macro does no typechecking and uses temporary variables of whatever + * type the input argument 'val' is. This is useful when val is an unsigned + * type and min and max are literals that will otherwise be assigned a signed + * integer type. + */ #define clamp_val(val, min, max) ({ \ typeof(val) __val = (val); \ typeof(val) __min = (min); \ _ Patches currently in -mm which might be from harvey.harrison@xxxxxxxxx are origin.patch char-fix-sparse-shadowed-variable-warnings-in-espc.patch char-espc-fix-possible-double-unlock.patch char-rocketc-fix-sparse-variable-shadowing-and-int-as-null-pointer.patch cycladesc-fix-sparse-shadowed-variable-warnings.patch epcac-static-functions-and-integer-as-null-pointer-fixes.patch add-macros-similar-to-min-max-min_t-max_t.patch add-macros-similar-to-min-max-min_t-max_t-doc.patch ide-eliminate-fit-macro.patch ata-remove-fit-macro.patch b43-replace-limit_value-macro-with-clamp_val.patch b43legacy-replace-limit_value-macro-with-clamp_val.patch fuse-use-clamp-rather-than-nested-min-max.patch ide-tape-use-clamp_t-rather-than-nested-min_t-max_t.patch input-ff-memlessc-use-clamp_val-macro.patch dccp-ccid2c-ccid3c-use-clamp-clamp_t.patch drivers-replace-remaining-__function__-occurrences.patch mm-remove-remaining-__function__-occurances.patch block-remove-remaining-__function__-occurances.patch kernel-replace-remaining-__function__-occurances.patch lib-replace-remaining-__function__-occurances.patch afs-replace-remaining-__function__-occurrences.patch fs-replace-remaining-__function__-occurrences.patch drivers-char-replace-remaining-__function__-occurrences.patch serial-replace-remaining-__function__-occurrences.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html