From: Krzysztof Kozlowski <krzk@kernel.org>
To: Hans de Goede <hdegoede@redhat.com>,
Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Sebastian Reichel <sre@kernel.org>,
linux-pm@vger.kernel.org
Cc: Purism Kernel Team <kernel@puri.sm>,
Rob Herring <robh@kernel.org>,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 1/4] power: supply: max17042_battery: Add unit conversion macros
Date: Fri, 18 Mar 2022 10:06:42 +0100 [thread overview]
Message-ID: <f15c415a-ad08-ae4f-c79c-574964ab9cb0@kernel.org> (raw)
In-Reply-To: <3c890d11-75c6-8370-5659-a78b1a9baea2@redhat.com>
On 18/03/2022 10:00, Hans de Goede wrote:
> Hi,
>
> On 3/18/22 09:16, Krzysztof Kozlowski wrote:
>> On 18/03/2022 01:10, Sebastian Krzyszkowiak wrote:
>>> Instead of sprinkling the code with magic numbers, put the unit
>>> definitions used by the gauge into a set of macros. Macros are
>>> used instead of simple defines in order to not require floating
>>> point operations for divisions.
>>>
>>> Signed-off-by: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>
>>> ---
>>> drivers/power/supply/max17042_battery.c | 40 +++++++++++++++----------
>>> 1 file changed, 24 insertions(+), 16 deletions(-)
>>>
>>> diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c
>>> index ab031bbfbe78..c019d6c52363 100644
>>> --- a/drivers/power/supply/max17042_battery.c
>>> +++ b/drivers/power/supply/max17042_battery.c
>>> @@ -51,6 +51,15 @@
>>>
>>> #define MAX17042_VMAX_TOLERANCE 50 /* 50 mV */
>>>
>>> +#define MAX17042_CURRENT_LSB 1562500ll /* µV */
>>
>> Is this really long long? The usage in max17042_get_status() is with int
>> operand and result.
>
> The "ll" is part of the original code which these macros replace,
> dropping the "ll" is IMHO out of scope for this patch, it would
> clearly break the only change 1 thing per patch/commit rule.
Not in max17042_get_status(). The usage there is without ll. Three other
places use it in 64-bit context (result is 64-bit), so there indeed. But
in max17042_get_status() this is now different.
Best regards,
Krzysztof
next prev parent reply other threads:[~2022-03-18 9:06 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-18 0:10 [PATCH 0/4] MAX17055 model configuration via DT Sebastian Krzyszkowiak
2022-03-18 0:10 ` [PATCH 1/4] power: supply: max17042_battery: Add unit conversion macros Sebastian Krzyszkowiak
2022-03-18 8:16 ` Krzysztof Kozlowski
2022-03-18 9:00 ` Hans de Goede
2022-03-18 9:06 ` Krzysztof Kozlowski [this message]
2022-03-18 9:51 ` Hans de Goede
2022-03-18 20:06 ` Sebastian Krzyszkowiak
2022-03-19 13:47 ` Hans de Goede
2022-03-18 8:59 ` Hans de Goede
2022-03-18 0:10 ` [PATCH 2/4] power: supply: max17042_battery: use ModelCfg refresh on max17055 Sebastian Krzyszkowiak
2022-03-18 8:22 ` Krzysztof Kozlowski
2022-03-18 19:58 ` Sebastian Krzyszkowiak
2022-03-20 12:18 ` Krzysztof Kozlowski
2022-03-20 20:44 ` Sebastian Krzyszkowiak
2022-03-23 9:47 ` Krzysztof Kozlowski
2022-03-18 9:04 ` Hans de Goede
2022-03-18 0:10 ` [PATCH 3/4] dt-bindings: power: supply: max17042: Add monitored-battery phandle Sebastian Krzyszkowiak
2022-03-18 8:23 ` Krzysztof Kozlowski
2022-03-18 0:10 ` [PATCH 4/4] power: supply: max17042_battery: read battery properties from device tree Sebastian Krzyszkowiak
2022-03-18 8:40 ` Krzysztof Kozlowski
2022-03-20 21:24 ` Sebastian Krzyszkowiak
2022-03-23 9:48 ` Krzysztof Kozlowski
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=f15c415a-ad08-ae4f-c79c-574964ab9cb0@kernel.org \
--to=krzk@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=hdegoede@redhat.com \
--cc=kernel@puri.sm \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=robh@kernel.org \
--cc=sebastian.krzyszkowiak@puri.sm \
--cc=sre@kernel.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;
as well as URLs for NNTP newsgroup(s).