This is a note to let you know that I've just added the patch titled

    ACPI battery: fribble sysfs files from a resume notifier

to the 2.6.38-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     acpi-battery-fribble-sysfs-files-from-a-resume-notifier.patch
and it can be found in the queue-2.6.38 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 25be5821521640eb00b7eb219ffe59664510d073 Mon Sep 17 00:00:00 2001
From: Kyle McMartin <[email protected]>
Date: Tue, 22 Mar 2011 16:19:50 -0400
Subject: ACPI battery: fribble sysfs files from a resume notifier

From: Kyle McMartin <[email protected]>

commit 25be5821521640eb00b7eb219ffe59664510d073 upstream.

Commit da8aeb92 re-poked the battery on resume, but Linus reports that
it broke his eee and partially reverted it in b23fffd7. Unfortunately
this also results in my x201s giving crack values until the sysfs files
are poked again. In the revert message, it was suggested that we poke it
from a PM notifier, so let's do that.

With this in place, I haven't noticed the units going nutty on my
gnome-power-manager across a dozen suspends or so...

Signed-off-by: Kyle McMartin <[email protected]>
Acked-by: Rafael J. Wysocki <[email protected]>
Signed-off-by: Len Brown <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/acpi/battery.c |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -33,6 +33,7 @@
 #include <linux/async.h>
 #include <linux/dmi.h>
 #include <linux/slab.h>
+#include <linux/suspend.h>
 
 #ifdef CONFIG_ACPI_PROCFS_POWER
 #include <linux/proc_fs.h>
@@ -102,6 +103,7 @@ struct acpi_battery {
        struct mutex lock;
        struct power_supply bat;
        struct acpi_device *device;
+       struct notifier_block pm_nb;
        unsigned long update_time;
        int rate_now;
        int capacity_now;
@@ -940,6 +942,21 @@ static void acpi_battery_notify(struct a
                power_supply_changed(&battery->bat);
 }
 
+static int battery_notify(struct notifier_block *nb,
+                              unsigned long mode, void *_unused)
+{
+       struct acpi_battery *battery = container_of(nb, struct acpi_battery,
+                                                   pm_nb);
+       switch (mode) {
+       case PM_POST_SUSPEND:
+               sysfs_remove_battery(battery);
+               sysfs_add_battery(battery);
+               break;
+       }
+
+       return 0;
+}
+
 static int acpi_battery_add(struct acpi_device *device)
 {
        int result = 0;
@@ -972,6 +989,10 @@ static int acpi_battery_add(struct acpi_
 #endif
                kfree(battery);
        }
+
+       battery->pm_nb.notifier_call = battery_notify;
+       register_pm_notifier(&battery->pm_nb);
+
        return result;
 }
 
@@ -982,6 +1003,7 @@ static int acpi_battery_remove(struct ac
        if (!device || !acpi_driver_data(device))
                return -EINVAL;
        battery = acpi_driver_data(device);
+       unregister_pm_notifier(&battery->pm_nb);
 #ifdef CONFIG_ACPI_PROCFS_POWER
        acpi_battery_remove_fs(device);
 #endif


Patches currently in stable-queue which might be from [email protected] are

queue-2.6.38/acpi-battery-fribble-sysfs-files-from-a-resume-notifier.patch

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to