summaryrefslogtreecommitdiff
path: root/board/nvidia
diff options
context:
space:
mode:
authorDoug Anderson <dianders@chromium.org>2011-10-20 16:04:53 -0700
committerDoug Anderson <dianders@chromium.org>2011-10-25 10:15:15 -0700
commit28f587c69545fee3d7f2c3f2239d1e26bcc91141 (patch)
tree5a9fe08f040e9e025865996ca5d017cd18e4a2ac /board/nvidia
parentd69f2460c5db7d74b8431d4f1c373b6bd1b7e38a (diff)
pmu: Move definition of abs() and stp() out of pmu header file
These two functions were only used in pmu.c, so there was no reason for them to be in the header file. They probably should be moved elsewhere eventually, but this is a better location than they were. BUG=None TEST=Compiled Change-Id: Ia13cfd0fd828589862bfd555c3a34d3b6b4bda1c Signed-off-by: Doug Anderson <dianders@chromium.org> Reviewed-on: http://gerrit.chromium.org/gerrit/10455 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Warren <twarren@nvidia.com>
Diffstat (limited to 'board/nvidia')
-rw-r--r--board/nvidia/common/pmu.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/board/nvidia/common/pmu.c b/board/nvidia/common/pmu.c
index 71da479f27..a71d436baf 100644
--- a/board/nvidia/common/pmu.c
+++ b/board/nvidia/common/pmu.c
@@ -32,6 +32,20 @@
#include <i2c.h>
#include "board.h"
+/*
+ * abs() handles unsigned ints, shorts and chars and returns a signed long.
+ */
+#define abs(x) ({ \
+ long ret; \
+ { \
+ typeof((x)) __x = (x); \
+ ret = (__x < 0) ? -__x : __x; \
+ } \
+ ret; \
+ })
+
+#define stp(x, y) ((x < y) ? VDD_TRANSITION_STEP : -VDD_TRANSITION_STEP)
+
struct vdd_settings {
int data;
int nominal;