From: Ralf Jung <post@ralfj.de>
To: Andy Whitcroft <apw@canonical.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
Jonathan Nieder <jrnieder@gmail.com>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
"Linux-pm mailing list" <linux-pm@lists.linux-foundation.org>,
Adrian Fita <adrian.fita@gmail.com>, Len Brown <lenb@kernel.org>,
Paolo Scarabelli <paolo@msw.it>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] battery: only refresh the sysfs files when pertinant information changes
Date: Fri, 4 May 2012 15:29:06 +0200 [thread overview]
Message-ID: <201205041529.07142.post@ralfj.de> (raw)
In-Reply-To: <1336052907-15084-1-git-send-email-apw@canonical.com>
Hi,
I applied this to 3.4-rc5, and it fixes the issue. Thanks a lot :)
> We only need to regenerate the sysfs files when the capacity units
> change, avoid the update otherwise.
>
> Signed-off-by: Andy Whitcroft <apw@canonical.com>
Tested-by: Ralf Jung <post@ralfj.de>
> ---
> drivers/acpi/battery.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> Based on Matthew's feedback here is a version which optimises
> based on the power_unit field as returned from the battery info.
> Could someone who suffers from this issue please test this out
> and report back. Thanks.
>
> diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
> index 86933ca..7dd3f9f 100644
> --- a/drivers/acpi/battery.c
> +++ b/drivers/acpi/battery.c
> @@ -643,11 +643,19 @@ static int acpi_battery_update(struct acpi_battery
> *battery)
>
> static void acpi_battery_refresh(struct acpi_battery *battery)
> {
> + int power_unit;
> +
> if (!battery->bat.dev)
> return;
>
> + power_unit = battery->power_unit;
> +
> acpi_battery_get_info(battery);
> - /* The battery may have changed its reporting units. */
> +
> + if (power_unit == battery->power_unit)
> + return;
> +
> + /* The battery has changed its reporting units. */
> sysfs_remove_battery(battery);
> sysfs_add_battery(battery);
> }
Kind regards,
Ralf Jung
next prev parent reply other threads:[~2012-05-04 13:29 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-06 22:31 [PATCH 0/11] Various ACPI patches for 2.6.38 Rafael J. Wysocki
2011-01-06 22:32 ` [PATCH 1/11] ACPI / ACPICA: Fix global lock acquisition Rafael J. Wysocki
2011-01-06 22:33 ` [PATCH 2/11] ACPI / PM: Do not enable multiple devices to wake up simultaneously Rafael J. Wysocki
2011-01-06 22:34 ` [PATCH 3/11] ACPI / PM: Use device wakeup flags for handling ACPI wakeup devices Rafael J. Wysocki
2011-01-06 22:35 ` [PATCH 4/11] ACPI / PM: Drop special ACPI wakeup flags Rafael J. Wysocki
2011-01-06 22:36 ` [PATCH 5/11] ACPI / PM: Report wakeup events from buttons Rafael J. Wysocki
2011-01-06 22:37 ` [PATCH 6/11] ACPI / PM: Blacklist Averatec machine known to require acpi_sleep=nonvs Rafael J. Wysocki
2011-01-06 22:38 ` [PATCH 7/11] ACPI / PM: Rename acpi_power_off_device() Rafael J. Wysocki
2011-01-06 22:38 ` [PATCH 8/11] ACPI / PM: Check status of power resources under mutexes Rafael J. Wysocki
2011-01-06 22:40 ` [PATCH 9/11] ACPI: Always check if _PRW is present before trying to evaluate it Rafael J. Wysocki
2011-01-06 22:41 ` [PATCH 10/11] ACPI: Drop device flag wake_capable Rafael J. Wysocki
2011-01-06 23:52 ` [linux-pm] " David Brownell
2011-01-07 0:22 ` Rafael J. Wysocki
2011-01-06 22:42 ` [PATCH 11/11] ACPI / Battery: Update information on info notification and resume Rafael J. Wysocki
2012-05-01 18:47 ` [bug?] Battery notifications produce flashing battery icon, syslog spam (Re: [PATCH 11/11] ACPI / Battery: Update information on info notification and resume) Jonathan Nieder
2012-05-01 19:00 ` Adrian Fita
2012-05-01 19:14 ` Jonathan Nieder
2012-05-01 19:42 ` Ralf Jung
2012-05-02 11:49 ` Paolo Scarabelli
2012-05-03 8:54 ` Andy Whitcroft
2012-05-03 12:47 ` Matthew Garrett
2012-05-03 13:48 ` [PATCH 1/1] battery: only refresh the sysfs files when pertinant information changes Andy Whitcroft
2012-05-04 13:29 ` Ralf Jung [this message]
2012-05-05 10:37 ` Adrian Fita
2012-05-08 5:50 ` Len Brown
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=201205041529.07142.post@ralfj.de \
--to=post@ralfj.de \
--cc=adrian.fita@gmail.com \
--cc=apw@canonical.com \
--cc=jrnieder@gmail.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=mjg59@srcf.ucam.org \
--cc=paolo@msw.it \
--cc=rjw@sisk.pl \
/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).