@@ -715,23 +715,8 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
715715 (void) (&_max1 == &_max2); \
716716 _max1 > _max2 ? _max1 : _max2; })
717717
718- #define min3 (x , y , z ) ({ \
719- typeof(x) _min1 = (x); \
720- typeof(y) _min2 = (y); \
721- typeof(z) _min3 = (z); \
722- (void) (&_min1 == &_min2); \
723- (void) (&_min1 == &_min3); \
724- _min1 < _min2 ? (_min1 < _min3 ? _min1 : _min3) : \
725- (_min2 < _min3 ? _min2 : _min3); })
726-
727- #define max3 (x , y , z ) ({ \
728- typeof(x) _max1 = (x); \
729- typeof(y) _max2 = (y); \
730- typeof(z) _max3 = (z); \
731- (void) (&_max1 == &_max2); \
732- (void) (&_max1 == &_max3); \
733- _max1 > _max2 ? (_max1 > _max3 ? _max1 : _max3) : \
734- (_max2 > _max3 ? _max2 : _max3); })
718+ #define min3 (x , y , z ) min(min(x, y), z)
719+ #define max3 (x , y , z ) max(max(x, y), z)
735720
736721/**
737722 * min_not_zero - return the minimum that is _not_ zero, unless both are zero
@@ -746,20 +731,13 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
746731/**
747732 * clamp - return a value clamped to a given range with strict typechecking
748733 * @val: current value
749- * @min: minimum allowable value
750- * @max: maximum allowable value
734+ * @lo: lowest allowable value
735+ * @hi: highest allowable value
751736 *
752737 * This macro does strict typechecking of min/max to make sure they are of the
753738 * same type as val. See the unnecessary pointer comparisons.
754739 */
755- #define clamp (val , min , max ) ({ \
756- typeof(val) __val = (val); \
757- typeof(min) __min = (min); \
758- typeof(max) __max = (max); \
759- (void) (&__val == &__min); \
760- (void) (&__val == &__max); \
761- __val = __val < __min ? __min: __val; \
762- __val > __max ? __max: __val; })
740+ #define clamp (val , lo , hi ) min(max(val, lo), hi)
763741
764742/*
765743 * ..and if you can't take the strict
0 commit comments