]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ACPI: AC: Update AC state on resume
authorAlexey Starikovskiy <astarikovskiy@suse.de>
Thu, 15 Nov 2007 01:00:39 +0000 (17:00 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 15 Nov 2007 02:45:44 +0000 (18:45 -0800)
Check if AC state has changed across resume and notify userspace if so.

Fixes "[2.6.24-rc1 regression] AC adapter state does not change after resume"

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Tested-by: Andrey Borzenkov <arvidjaar@mail.ru>
Cc: Len Brown <lenb@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/acpi/ac.c

index 1461dc9944a3665055bf0f8d26be946c30840c70..30238f6ff232218bc46c34450d04d3d0f7ddc12c 100644 (file)
@@ -59,6 +59,7 @@ static int acpi_ac_open_fs(struct inode *inode, struct file *file);
 
 static int acpi_ac_add(struct acpi_device *device);
 static int acpi_ac_remove(struct acpi_device *device, int type);
+static int acpi_ac_resume(struct acpi_device *device);
 
 const static struct acpi_device_id ac_device_ids[] = {
        {"ACPI0003", 0},
@@ -73,6 +74,7 @@ static struct acpi_driver acpi_ac_driver = {
        .ops = {
                .add = acpi_ac_add,
                .remove = acpi_ac_remove,
+               .resume = acpi_ac_resume,
                },
 };
 
@@ -307,6 +309,21 @@ static int acpi_ac_add(struct acpi_device *device)
        return result;
 }
 
+static int acpi_ac_resume(struct acpi_device *device)
+{
+       struct acpi_ac *ac;
+       unsigned old_state;
+       if (!device || !acpi_driver_data(device))
+               return -EINVAL;
+       ac = acpi_driver_data(device);
+       old_state = ac->state;
+       if (acpi_ac_get_state(ac))
+               return 0;
+       if (old_state != ac->state)
+               kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
+       return 0;
+}
+
 static int acpi_ac_remove(struct acpi_device *device, int type)
 {
        acpi_status status = AE_OK;