power: supply: Change rk817_chg_cur_to_reg to int
PATCH 1/1 power: supply: Change rk817_chg_cur_to_reg to int
From: Chris Morgan <[email protected]>
Change return value of rk817_chg_cur_to_reg from u8 to int. If the function fails to find a suitable value it returns a -EINVAL, but defined as a u8 it would not return correctly. Additionally, change defined variable that stores return value from u8 to int.
RK817)
--- drivers/power/supply/rk817_charger.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/power/supply/rk817_charger.c +3 -3
@@ -121,7 +121,7 @@ struct rk817_charger {#define ADC_TO_CHARGE_UAH (adc_value, res_div) \ (adc_value / 3600 * 172 / res_div) -static u8 rk817_chg_cur_to_reg (u32 chg_cur_ma) +static int rk817_chg_cur_to_reg (u32 chg_cur_ma) {if (chg_cur_ma >=3500 )return CHG_3_5A ;
@@ -864,8 +864,8 @@ static int rk817_battery_init(struct rk817_charger *charger, {struct rk808 *rk808 = charger->rk808;u32 tmp, max_chg_vol_mv, max_chg_cur_ma; -u8 max_chg_vol_reg, chg_term_i_reg, max_chg_cur_reg; -int ret, chg_term_ma; +u8 max_chg_vol_reg, chg_term_i_reg; +int ret, chg_term_ma, max_chg_cur_reg;u8 bulk_reg[2 ];/* Get initial plug state */
Signature · 1 line
2.25.1
Hi,
Quoted 9 lines · Chris Morgan
From: Chris Morgan <[email protected]>
Change return value of
rk817_chg_cur_to_regfrom u8 to int. If the function fails to find a suitable value it returns a-EINVAL, but defined as a u8 it would not return correctly. Additionally, change defined variable that stores return value from u8 to int.Fixes 11cb8da0189b (power: supply: Add charger driver for RockchipRK817)
Wrong format, must be one line and title should be in quotes in addition to the brackets. (I fixed this while applying)
Quoted 3 lines
Signed-off-by Chris Morgan <[email protected]>Reported-by Dan Carpenter <[email protected]>---
Thanks, queued to fixes branch.
-- Sebastian
Quoted 30 lines
drivers/power/supply/rk817_charger.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/power/supply/rk817_charger.c +3
-3@@ -121,7 +121,7 @@ struct rk817_charger {#define ADC_TO_CHARGE_UAH (adc_value, res_div) \ (adc_value / 3600 * 172 / res_div) -static u8 rk817_chg_cur_to_reg (u32 chg_cur_ma) +static int rk817_chg_cur_to_reg (u32 chg_cur_ma) {if (chg_cur_ma >=3500 )return CHG_3_5A ;@@ -864,8 +864,8 @@ static int rk817_battery_init(struct rk817_charger *charger, {struct rk808 *rk808 = charger->rk808;u32 tmp, max_chg_vol_mv, max_chg_cur_ma; -u8 max_chg_vol_reg, chg_term_i_reg, max_chg_cur_reg; -int ret, chg_term_ma; +u8 max_chg_vol_reg, chg_term_i_reg; +int ret, chg_term_ma, max_chg_cur_reg;u8 bulk_reg[2 ];/* Get initial plug state */ Signature · 1 line
2.25.1