diff options
-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) /* |