Linux Power Management development
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Linus Walleij <linus.walleij@linaro.org>,
	Sebastian Reichel <sre@kernel.org>
Cc: linux-pm@vger.kernel.org, Chunyan Zhang <chunyan.zhang@unisoc.com>
Subject: Re: [PATCH] power: supply: core: Break capacity loop
Date: Mon, 15 Nov 2021 18:24:49 +0800	[thread overview]
Message-ID: <cd74a6c0-b9c9-c174-dc14-29ea30c64bcc@linux.alibaba.com> (raw)
In-Reply-To: <20211114231207.1877495-1-linus.walleij@linaro.org>



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) {
> 

  reply	other threads:[~2021-11-15 10:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-14 23:12 [PATCH] power: supply: core: Break capacity loop Linus Walleij
2021-11-15 10:24 ` Baolin Wang [this message]
2021-11-15 15:19   ` 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=cd74a6c0-b9c9-c174-dc14-29ea30c64bcc@linux.alibaba.com \
    --to=baolin.wang@linux.alibaba.com \
    --cc=chunyan.zhang@unisoc.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-pm@vger.kernel.org \
    --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