summaryrefslogtreecommitdiff
path: root/include/util.h
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2018-11-27 12:50:42 -0800
committerCommit Bot <commit-bot@chromium.org>2019-05-30 05:56:41 +0000
commitf81d843fe25267a1660d1e45c0f593fa310f79d9 (patch)
tree7410a86cd60992129c67c066fd71f5242a439516 /include/util.h
parent0aee48bdaab94faf674daa69b327d9a6675090a1 (diff)
downloadchrome-ec-f81d843fe25267a1660d1e45c0f593fa310f79d9.tar.gz
sensor: Adjust max_frequency based on EC performance
Put in max_frequency a value that the sensor AND the EC support. BRANCH=none BUG=b:118205424,b:118851581,chromium:615059 TEST=Compile. Check all max sensors frequencies have been altered with: for i in $(grep -rh max_frequency board | cut -d '=' -f 2 | sort | \ uniq | grep FREQ | sed 's/FREQ.*//') ; do echo -n $i ; git show | grep -q $i || break; echo check done Check on nocturne accel max frequency is still correct. (cherry picked from commit 77b306b340ca428ba6785add204ccdce82185274) Conflicts: driver/mag_lis2mdl.h : driver not present yet. include/config.h : added defines. Reviewed-on: https://chromium-review.googlesource.com/1352063 Commit-Ready: Elthan Huang <elthan_huang@compal.corp-partner.google.com> Reviewed-by: Jesse Schettler <jschettler@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Justin TerAvest <teravest@chromium.org> Change-Id: I848396d9f150a2e94d430a8feeafc1087a6bf2c3 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1621506 Reviewed-by: Enrico Granata <egranata@chromium.org>
Diffstat (limited to 'include/util.h')
-rw-r--r--include/util.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/util.h b/include/util.h
index c8ae09db93..fe66936cf4 100644
--- a/include/util.h
+++ b/include/util.h
@@ -16,13 +16,15 @@
#include <stddef.h>
/* Standard macros / definitions */
+#define GENERIC_MAX(x, y) ((x) > (y) ? (x) : (y))
+#define GENERIC_MIN(x, y) ((x) < (y) ? (x) : (y))
#ifndef MAX
#define MAX(a, b) \
({ \
__typeof__(a) temp_a = (a); \
__typeof__(b) temp_b = (b); \
\
- temp_a > temp_b ? temp_a : temp_b; \
+ GENERIC_MAX(temp_a, temp_b); \
})
#endif
#ifndef MIN
@@ -31,7 +33,7 @@
__typeof__(a) temp_a = (a); \
__typeof__(b) temp_b = (b); \
\
- temp_a < temp_b ? temp_a : temp_b; \
+ GENERIC_MIN(temp_a, temp_b); \
})
#endif
#ifndef NULL