From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Konrad Dybcio <konrad.dybcio@linaro.org>
Cc: Arnd Bergmann <arnd@kernel.org>, Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Arnd Bergmann <arnd@arndb.de>,
Neil Armstrong <neil.armstrong@linaro.org>,
linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] power: supply: qcom_battmgr: remove bogus do_div()
Date: Tue, 14 Feb 2023 23:02:10 +0100 [thread overview]
Message-ID: <20230214220210.cpviycsmcppylkgj@mercury.elektranox.org> (raw)
In-Reply-To: <e55c4253-4c55-61cf-a5fd-4284fa164db8@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 1960 bytes --]
Hi,
On Tue, Feb 14, 2023 at 02:36:03PM +0100, Konrad Dybcio wrote:
> On 14.02.2023 14:20, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > 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 <arnd@arndb.de>
> > ---
> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Needs to go through the Qualcomm tree:
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
-- Sebastian
> > drivers/power/supply/qcom_battmgr.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/power/supply/qcom_battmgr.c b/drivers/power/supply/qcom_battmgr.c
> > index ec31f887184f..de77df97b3a4 100644
> > --- a/drivers/power/supply/qcom_battmgr.c
> > +++ b/drivers/power/supply/qcom_battmgr.c
> > @@ -1126,8 +1126,7 @@ static void qcom_battmgr_sm8350_callback(struct qcom_battmgr *battmgr,
> > battmgr->info.charge_type = le32_to_cpu(resp->intval.value);
> > break;
> > case BATT_CAPACITY:
> > - battmgr->status.percent = le32_to_cpu(resp->intval.value);
> > - do_div(battmgr->status.percent, 100);
> > + battmgr->status.percent = le32_to_cpu(resp->intval.value) / 100;
> > break;
> > case BATT_VOLT_OCV:
> > battmgr->status.voltage_ocv = le32_to_cpu(resp->intval.value);
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2023-02-14 22:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-14 13:20 Arnd Bergmann
2023-02-14 13:36 ` Konrad Dybcio
2023-02-14 22:02 ` Sebastian Reichel [this message]
2023-02-28 8:51 ` Geert Uytterhoeven
2023-03-01 18:16 ` Nathan Chancellor
2023-03-01 18:50 ` Linus Torvalds
2023-03-04 1:37 ` Sebastian Reichel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230214220210.cpviycsmcppylkgj@mercury.elektranox.org \
--to=sebastian.reichel@collabora.com \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=neil.armstrong@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®