[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0iteOV=4CnQrVx5ZmnWq5Uf88k7UMMmKcMxgJnco3kxvg@mail.gmail.com>
Date: Fri, 5 Jun 2020 13:30:13 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Mathew King <mathewk@...omium.org>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Len Brown <lenb@...nel.org>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>
Subject: Re: [PATCH] acpi: battery: Always read fresh battery state on update
On Thu, Jun 4, 2020 at 9:57 PM Mathew King <mathewk@...omium.org> wrote:
>
> When the ACPI battery receives a notification event it should always
> read the battery state fresh from the ACPI device and not use the cached
> state.
Why should it?
> Currently the cached state stays valid and the new state may not
> be read when a notification occurs. This can lead to a udev event
> showing that the battery has changed but the sysfs state will still have
> the cached state values.
Is there a bug entry or similar related to that which can be referred
to from this patch?
> This change invalidates the update time forcing
> the state to be updated before notifying the power_supply subsystem of
> the change.
>
> Signed-off-by: Mathew King <mathewk@...omium.org>
> ---
> drivers/acpi/battery.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
> index 366c389175d8..ab7fa4879fbe 100644
> --- a/drivers/acpi/battery.c
> +++ b/drivers/acpi/battery.c
> @@ -981,6 +981,7 @@ static int acpi_battery_update(struct acpi_battery *battery, bool resume)
> acpi_battery_init_alarm(battery);
> }
>
> + battery->update_time = 0;
AFAICS this is equivalent to dropping battery->update_time altogether.
Isn't that a bit too excessive?
> result = acpi_battery_get_state(battery);
> if (result)
> return result;
> --
Powered by blists - more mailing lists