diff options
author | Eric Yilun Lin <yllin@chromium.org> | 2020-12-03 14:23:48 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-12-04 03:49:55 +0000 |
commit | defe99857e24f63ac85d460e3fdfeaa0b5b4dac1 (patch) | |
tree | 15939a0b8856f2cc36495716634afd579fe1c8cc | |
parent | 651090dfdaf33751200492432ce0ecfb4343f762 (diff) | |
download | chrome-ec-defe99857e24f63ac85d460e3fdfeaa0b5b4dac1.tar.gz |
sm5803: add parenthesis to the input of macros
Inputs have to be guarded with parenthesis.
BUG=none
TEST=make buildall
BRANCH=main
Change-Id: Iedf678e1a2b0f3525aa2b788b0e2c9171d3b4acc
Signed-off-by: Eric Yilun Lin <yllin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2570885
Reviewed-by: Tzung-Bi Shih <tzungbi@chromium.org>
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
-rw-r--r-- | driver/charger/sm5803.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/driver/charger/sm5803.h b/driver/charger/sm5803.h index 65dc64f34f..d1181478a4 100644 --- a/driver/charger/sm5803.h +++ b/driver/charger/sm5803.h @@ -225,8 +225,8 @@ enum sm5803_charger_modes { #define SM5803_REG_CHG_ILIM 0x24 #define SM5803_CHG_ILIM_RAW GENMASK(4, 0) #define SM5803_CURRENT_STEP 100 -#define SM5803_REG_TO_CURRENT(r) (r * SM5803_CURRENT_STEP) -#define SM5803_CURRENT_TO_REG(c) (c / SM5803_CURRENT_STEP) +#define SM5803_REG_TO_CURRENT(r) ((r) * SM5803_CURRENT_STEP) +#define SM5803_CURRENT_TO_REG(c) ((c) / SM5803_CURRENT_STEP) /* * DPM Voltage loop regulation contains the 8 bits with MSB register @@ -265,8 +265,8 @@ enum sm5803_charger_modes { #define SM5803_VOLTAGE_STEP 10 #define SM5803_VOLTAGE_SHIFT 2720 #define SM5803_REG_TO_VOLTAGE(r) (SM5803_VOLTAGE_SHIFT + \ - r * SM5803_VOLTAGE_STEP) -#define SM5803_VOLTAGE_TO_REG(v) ((v - SM5803_VOLTAGE_SHIFT) \ + (r) * SM5803_VOLTAGE_STEP) +#define SM5803_VOLTAGE_TO_REG(v) (((v) - SM5803_VOLTAGE_SHIFT) \ / SM5803_VOLTAGE_STEP) /* |