Skip to content

Commit 92304df

Browse files
arndbtorvalds
authored andcommitted
power: supply: qcom_battmgr: remove bogus do_div()
The argument to do_div() is a 32-bit integer, and it was read from a 32-bit register so there is no point in doing a 64-bit division on it. On 32-bit arm, do_div() causes a compile-time warning here: include/asm-generic/div64.h:238:22: error: passing argument 1 of '__div64_32' from incompatible pointer type [-Werror=incompatible-pointer-types] 238 | __rem = __div64_32(&(n), __base); \ | ^~~~ | | | unsigned int * drivers/power/supply/qcom_battmgr.c:1130:4: note: in expansion of macro 'do_div' 1130 | do_div(battmgr->status.percent, 100); Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Acked-by: Sebastian Reichel <[email protected]> Reviewed-by: Konrad Dybcio <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent f122a08 commit 92304df

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/power/supply/qcom_battmgr.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,8 +1126,7 @@ static void qcom_battmgr_sm8350_callback(struct qcom_battmgr *battmgr,
11261126
battmgr->info.charge_type = le32_to_cpu(resp->intval.value);
11271127
break;
11281128
case BATT_CAPACITY:
1129-
battmgr->status.percent = le32_to_cpu(resp->intval.value);
1130-
do_div(battmgr->status.percent, 100);
1129+
battmgr->status.percent = le32_to_cpu(resp->intval.value) / 100;
11311130
break;
11321131
case BATT_VOLT_OCV:
11331132
battmgr->status.voltage_ocv = le32_to_cpu(resp->intval.value);

0 commit comments

Comments
 (0)