diff options
author | Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> | 2014-07-26 17:24:42 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-07-28 07:31:18 +0200 |
commit | 343ccff163789949f2c683dcea819ceb68dbcf02 (patch) | |
tree | 48f39c1ccb0365abefb39a4a55ea5713abe6bc08 /include | |
parent | 418add62c1391ae9195ec1c145906332732dc93c (diff) | |
download | barebox-343ccff163789949f2c683dcea819ceb68dbcf02.tar.gz barebox-343ccff163789949f2c683dcea819ceb68dbcf02.tar.xz |
USB: EHCI: use min3 from Linux
EHCI HCD has a private version of min3() determining the smallest
number out of 3. We already have min()/max() imported from Linux,
also get min3()/max3() and use it instead of EHCI's private one.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/kernel.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 4322f01580..f588d3b003 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -21,6 +21,24 @@ (void) (&_max1 == &_max2); \ _max1 > _max2 ? _max1 : _max2; }) +#define min3(x, y, z) ({ \ + typeof(x) _min1 = (x); \ + typeof(y) _min2 = (y); \ + typeof(z) _min3 = (z); \ + (void) (&_min1 == &_min2); \ + (void) (&_min1 == &_min3); \ + _min1 < _min2 ? (_min1 < _min3 ? _min1 : _min3) : \ + (_min2 < _min3 ? _min2 : _min3); }) + +#define max3(x, y, z) ({ \ + typeof(x) _max1 = (x); \ + typeof(y) _max2 = (y); \ + typeof(z) _max3 = (z); \ + (void) (&_max1 == &_max2); \ + (void) (&_max1 == &_max3); \ + _max1 > _max2 ? (_max1 > _max3 ? _max1 : _max3) : \ + (_max2 > _max3 ? _max2 : _max3); }) + /** * clamp - return a value clamped to a given range with strict typechecking * @val: current value |