summaryrefslogtreecommitdiff
path: root/include/util.h
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2018-11-27 12:50:42 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-12-03 03:11:54 -0800
commit77b306b340ca428ba6785add204ccdce82185274 (patch)
treec7bb8333c3ebdfb13463285885c8c5ebbbbf4893 /include/util.h
parent45189f94d9684c88200c71bc781bfd983277a8aa (diff)
downloadchrome-ec-77b306b340ca428ba6785add204ccdce82185274.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. Change-Id: I848396d9f150a2e94d430a8feeafc1087a6bf2c3 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> 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>
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 39a07e4b1e..5c2a7f38a6 100644
--- a/include/util.h
+++ b/include/util.h
@@ -20,13 +20,15 @@ extern "C" {
#endif
/* 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
@@ -35,7 +37,7 @@ extern "C" {
__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