@@ -715,23 +715,8 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
715
715
(void) (&_max1 == &_max2); \
716
716
_max1 > _max2 ? _max1 : _max2; })
717
717
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)
735
720
736
721
/**
737
722
* 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) { }
746
731
/**
747
732
* clamp - return a value clamped to a given range with strict typechecking
748
733
* @val: current value
749
- * @min: minimum allowable value
750
- * @max: maximum allowable value
734
+ * @lo: lowest allowable value
735
+ * @hi: highest allowable value
751
736
*
752
737
* This macro does strict typechecking of min/max to make sure they are of the
753
738
* same type as val. See the unnecessary pointer comparisons.
754
739
*/
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)
763
741
764
742
/*
765
743
* ..and if you can't take the strict
0 commit comments