@@ -719,23 +719,8 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
719
719
(void) (&_max1 == &_max2); \
720
720
_max1 > _max2 ? _max1 : _max2; })
721
721
722
- #define min3 (x , y , z ) ({ \
723
- typeof(x) _min1 = (x); \
724
- typeof(y) _min2 = (y); \
725
- typeof(z) _min3 = (z); \
726
- (void) (&_min1 == &_min2); \
727
- (void) (&_min1 == &_min3); \
728
- _min1 < _min2 ? (_min1 < _min3 ? _min1 : _min3) : \
729
- (_min2 < _min3 ? _min2 : _min3); })
730
-
731
- #define max3 (x , y , z ) ({ \
732
- typeof(x) _max1 = (x); \
733
- typeof(y) _max2 = (y); \
734
- typeof(z) _max3 = (z); \
735
- (void) (&_max1 == &_max2); \
736
- (void) (&_max1 == &_max3); \
737
- _max1 > _max2 ? (_max1 > _max3 ? _max1 : _max3) : \
738
- (_max2 > _max3 ? _max2 : _max3); })
722
+ #define min3 (x , y , z ) min(min(x, y), z)
723
+ #define max3 (x , y , z ) max(max(x, y), z)
739
724
740
725
/**
741
726
* min_not_zero - return the minimum that is _not_ zero, unless both are zero
@@ -750,20 +735,13 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
750
735
/**
751
736
* clamp - return a value clamped to a given range with strict typechecking
752
737
* @val: current value
753
- * @min: minimum allowable value
754
- * @max: maximum allowable value
738
+ * @lo: lowest allowable value
739
+ * @hi: highest allowable value
755
740
*
756
741
* This macro does strict typechecking of min/max to make sure they are of the
757
742
* same type as val. See the unnecessary pointer comparisons.
758
743
*/
759
- #define clamp (val , min , max ) ({ \
760
- typeof(val) __val = (val); \
761
- typeof(min) __min = (min); \
762
- typeof(max) __max = (max); \
763
- (void) (&__val == &__min); \
764
- (void) (&__val == &__max); \
765
- __val = __val < __min ? __min: __val; \
766
- __val > __max ? __max: __val; })
744
+ #define clamp (val , lo , hi ) min(max(val, lo), hi)
767
745
768
746
/*
769
747
* ..and if you can't take the strict
0 commit comments