All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andrew F. Davis" <afd@ti.com>
To: "Krzysztof Kozlowski" <krzk@kernel.org>,
	"Pali Rohár" <pali@kernel.org>,
	"Sebastian Reichel" <sre@kernel.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski@proceq.com>,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH 1/2] power: supply: bq27xxx_battery: Notify about all battery changes
Date: Tue, 26 May 2020 21:24:39 -0400	[thread overview]
Message-ID: <fc59bcd5-1868-8c7a-9fc9-67ad70b477f4@ti.com> (raw)
In-Reply-To: <20200525141200.17199-1-krzk@kernel.org>

On 5/25/20 10:11 AM, Krzysztof Kozlowski wrote:
> All battery related data could be important for user-space.  For example
> time-to-full could be shown to user on the screen or health could be
> monitored for any issues.  Instead of comparing few selected old/new
> values, just check if anything changed in the cache.
> 


At least some value will change every time we poll the battery, are we
okay with having power_supply_changed() called every time?

Andrew


> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  drivers/power/supply/bq27xxx_battery.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
> index 942c92127b6d..33c26d42cd02 100644
> --- a/drivers/power/supply/bq27xxx_battery.c
> +++ b/drivers/power/supply/bq27xxx_battery.c
> @@ -1612,12 +1612,10 @@ void bq27xxx_battery_update(struct bq27xxx_device_info *di)
>  			di->charge_design_full = bq27xxx_battery_read_dcap(di);
>  	}
>  
> -	if ((di->cache.capacity != cache.capacity) ||
> -	    (di->cache.flags != cache.flags))
> +	if (memcmp(&di->cache, &cache, sizeof(cache)) != 0) {
>  		power_supply_changed(di->bat);
> -
> -	if (memcmp(&di->cache, &cache, sizeof(cache)) != 0)
>  		di->cache = cache;
> +	}
>  
>  	di->last_update = jiffies;
>  }
> 

  parent reply	other threads:[~2020-05-27  1:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-25 14:11 [PATCH 1/2] power: supply: bq27xxx_battery: Notify about all battery changes Krzysztof Kozlowski
2020-05-25 14:12 ` [PATCH 2/2] power: supply: bq27xxx_battery: Notify about voltage and current changes Krzysztof Kozlowski
2020-05-27  1:24 ` Andrew F. Davis [this message]
2020-05-27  7:22   ` [PATCH 1/2] power: supply: bq27xxx_battery: Notify about all battery changes Krzysztof Kozlowski
2020-05-27  7:30     ` Krzysztof Kozlowski
2020-06-16 10:52   ` Pavel Machek
2020-06-16 11:57     ` 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=fc59bcd5-1868-8c7a-9fc9-67ad70b477f4@ti.com \
    --to=afd@ti.com \
    --cc=krzk@kernel.org \
    --cc=krzysztof.kozlowski@proceq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pali@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 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.