aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2010-09-10 14:07:38 -0400
committerJens Axboe <axboe@carl.home.kernel.dk>2010-09-10 14:07:38 -0400
commitc8bf1336824ebd698d37b71763e1c43190f2229a (patch)
tree19948b3c686ba71bb2e85883a5325cec069015b7 /include/linux/kernel.h
parent76be97c1fc945db08aae1f1b746012662d643e97 (diff)
Consolidate min_not_zero
We have several users of min_not_zero, each of them using their own definition. Move the define to kernel.h. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <axboe@carl.home.kernel.dk>
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r--include/linux/kernel.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 2b0a35e6bc69..f5df2f4acb0d 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -641,6 +641,16 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
641 _max1 > _max2 ? _max1 : _max2; }) 641 _max1 > _max2 ? _max1 : _max2; })
642 642
643/** 643/**
644 * min_not_zero - return the minimum that is _not_ zero, unless both are zero
645 * @x: value1
646 * @y: value2
647 */
648#define min_not_zero(x, y) ({ \
649 typeof(x) __x = (x); \
650 typeof(y) __y = (y); \
651 __x == 0 ? __y : ((__y == 0) ? __x : min(__x, __y)); })
652
653/**
644 * clamp - return a value clamped to a given range with strict typechecking 654 * clamp - return a value clamped to a given range with strict typechecking
645 * @val: current value 655 * @val: current value
646 * @min: minimum allowable value 656 * @min: minimum allowable value