summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-02-18 15:02:22 -0700
committerCommit Bot <commit-bot@chromium.org>2021-02-19 03:59:51 +0000
commit98371feb0fa808330c2b5b3977b962268351b19e (patch)
tree57609fd88cd0da67bc6ac7fa1b4b3283d5808eae /include
parent656bc81935932af371d4a1f78531f39afdef1ee1 (diff)
downloadchrome-ec-98371feb0fa808330c2b5b3977b962268351b19e.tar.gz
zephyr: Avoid duplicate CLAMP() macros
This defined in Zephyr's sys/util.h so we should not define it again when building for Zephyr. Add an #ifdef to fix this. BUG=b:180409973 BRANCH=none TEST=build and see there is no duplicate warning for CLAMP() Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I51cf1661b247adb423356f28a516967a80d1e064 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2705445 Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/util.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/util.h b/include/util.h
index 3970a9024f..a25bbbd77a 100644
--- a/include/util.h
+++ b/include/util.h
@@ -54,7 +54,9 @@ extern "C" {
* @return `v` if it is already between `min`/`max`, `min` if `v` was smaller
* than `min`, `max` if `v` was bigger than `max`.
*/
+#ifndef CONFIG_ZEPHYR
#define CLAMP(v, min, max) MIN(max, MAX(v, min))
+#endif
/*
* Convert a pointer to a base struct into a pointer to the struct that