* [PATCH] power: supply: core: Break capacity loop
@ 2021-11-14 23:12 Linus Walleij
2021-11-15 10:24 ` Baolin Wang
0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2021-11-14 23:12 UTC (permalink / raw)
To: Sebastian Reichel; +Cc: linux-pm, Linus Walleij, Chunyan Zhang, Baolin Wang
We should not go on looking for more capacity tables after
we realize we have looked at the last one in
power_supply_find_ocv2cap_table().
Fixes: 3afb50d7125b ("power: supply: core: Add some helpers to use the battery OCV capacity table")
Cc: Chunyan Zhang <chunyan.zhang@unisoc.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/power/supply/power_supply_core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index 038e35ea7fbe..885c92dc0379 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -852,6 +852,10 @@ power_supply_find_ocv2cap_table(struct power_supply_battery_info *info,
return NULL;
for (i = 0; i < POWER_SUPPLY_OCV_TEMP_MAX; i++) {
+ /* Out of capacity tables */
+ if (!info->ocv_table[i])
+ break;
+
temp_diff = abs(info->ocv_temp[i] - temp);
if (temp_diff < best_temp_diff) {
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] power: supply: core: Break capacity loop
2021-11-14 23:12 [PATCH] power: supply: core: Break capacity loop Linus Walleij
@ 2021-11-15 10:24 ` Baolin Wang
2021-11-15 15:19 ` Sebastian Reichel
0 siblings, 1 reply; 3+ messages in thread
From: Baolin Wang @ 2021-11-15 10:24 UTC (permalink / raw)
To: Linus Walleij, Sebastian Reichel; +Cc: linux-pm, Chunyan Zhang
On 2021/11/15 7:12, Linus Walleij wrote:
> We should not go on looking for more capacity tables after
> we realize we have looked at the last one in
> power_supply_find_ocv2cap_table().
>
> Fixes: 3afb50d7125b ("power: supply: core: Add some helpers to use the battery OCV capacity table")
> Cc: Chunyan Zhang <chunyan.zhang@unisoc.com>
> Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
LGTM.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> ---
> drivers/power/supply/power_supply_core.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
> index 038e35ea7fbe..885c92dc0379 100644
> --- a/drivers/power/supply/power_supply_core.c
> +++ b/drivers/power/supply/power_supply_core.c
> @@ -852,6 +852,10 @@ power_supply_find_ocv2cap_table(struct power_supply_battery_info *info,
> return NULL;
>
> for (i = 0; i < POWER_SUPPLY_OCV_TEMP_MAX; i++) {
> + /* Out of capacity tables */
> + if (!info->ocv_table[i])
> + break;
> +
> temp_diff = abs(info->ocv_temp[i] - temp);
>
> if (temp_diff < best_temp_diff) {
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] power: supply: core: Break capacity loop
2021-11-15 10:24 ` Baolin Wang
@ 2021-11-15 15:19 ` Sebastian Reichel
0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2021-11-15 15:19 UTC (permalink / raw)
To: Baolin Wang; +Cc: Linus Walleij, linux-pm, Chunyan Zhang
[-- Attachment #1: Type: text/plain, Size: 1410 bytes --]
Hi,
On Mon, Nov 15, 2021 at 06:24:49PM +0800, Baolin Wang wrote:
>
>
> On 2021/11/15 7:12, Linus Walleij wrote:
> > We should not go on looking for more capacity tables after
> > we realize we have looked at the last one in
> > power_supply_find_ocv2cap_table().
> >
> > Fixes: 3afb50d7125b ("power: supply: core: Add some helpers to use the battery OCV capacity table")
> > Cc: Chunyan Zhang <chunyan.zhang@unisoc.com>
> > Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>
> LGTM.
> Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Thanks, queued to fixes branch.
-- Sebastian
> > ---
> > drivers/power/supply/power_supply_core.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
> > index 038e35ea7fbe..885c92dc0379 100644
> > --- a/drivers/power/supply/power_supply_core.c
> > +++ b/drivers/power/supply/power_supply_core.c
> > @@ -852,6 +852,10 @@ power_supply_find_ocv2cap_table(struct power_supply_battery_info *info,
> > return NULL;
> > for (i = 0; i < POWER_SUPPLY_OCV_TEMP_MAX; i++) {
> > + /* Out of capacity tables */
> > + if (!info->ocv_table[i])
> > + break;
> > +
> > temp_diff = abs(info->ocv_temp[i] - temp);
> > if (temp_diff < best_temp_diff) {
> >
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-15 15:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-14 23:12 [PATCH] power: supply: core: Break capacity loop Linus Walleij
2021-11-15 10:24 ` Baolin Wang
2021-11-15 15:19 ` Sebastian Reichel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.