tags 670958 + patch moreinfo quit Hi all,
Andy Whitcroft wrote[1]: > 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. Instructions: 0. prerequisites: apt-get install git build-essential 1. get a copy of the kernel history, if you don't already have it: git clone \ git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2. add point releases: cd linux git remote add stable \ git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git git fetch stable 3. configure, build, test: git checkout stable/linux-3.2.y cp /boot/config-$(uname -r) .config; # current configuration scripts/config --disable DEBUG_INFO make localmodconfig; # optional: minimize configuration make deb-pkg; # optionally with -j<num> for parallel build dpkg -i ../<name of package>; # as root reboot ... test test test ... Hopefully it reproduces the bug. So: 4. try the patch (attached): cd linux git am -3sc /path/to/patch make deb-pkg; # maybe with -j4 dpkg -i ../<name of package>; # as root reboot ... test test test ... An alternative set of instructions is at [2]. If you get a chance to try this, please describe the result to Andy by replying-to-all to his message (i.e., not this one). Whoever is first should probably also mention that pertinent is misspelled. ;-) If you have any questions, please don't hesitate to ask. Thanks, Jonathan [1] http://thread.gmane.org/gmane.linux.kernel/1084565/focus=52981 [2] http://kernel-handbook.alioth.debian.org/ch-common-tasks.html#s4.2.2 or the corresponding page in the debian-kernel-handbook package
From: Andy Whitcroft <a...@canonical.com> Date: Thu, 3 May 2012 14:48:26 +0100 Subject: battery: only refresh the sysfs files when pertinant information changes We only need to regenerate the sysfs files when the capacity units change, avoid the update otherwise. Signed-off-by: Andy Whitcroft <a...@canonical.com> Signed-off-by: Jonathan Nieder <jrnie...@gmail.com> --- drivers/acpi/battery.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 7711d94a0409..55354777e696 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); } -- 1.7.10.1