Re: [2.6.24-rc1 regression] AC adapter state does not change afterresume

From: Alexey Starikovskiy
Date: Tue Oct 30 2007 - 17:09:58 EST


Andrey Borzenkov wrote:
> I suspect new ACPI AC adapter code but have to add some printk's to be sure.
>
> To reproduce - plug in AC cord, suspend, unplug, resume - kpowersave and sysfs
> still show AC adapter online. Or other way round.
>
> -andrey
Please check if this patch helps.

Regards,
Alex.
ACPI: AC: Update AC state on sysfs read

From: Alexey Starikovskiy <astarikovskiy@xxxxxxx>

Signed-off-by: Alexey Starikovskiy <astarikovskiy@xxxxxxx>
---

drivers/acpi/ac.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index e03de37..bb618c8 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -91,6 +91,9 @@ static int get_ac_property(struct power_supply *psy,
union power_supply_propval *val)
{
struct acpi_ac *ac = to_acpi_ac(psy);
+
+ if (acpi_ac_get_state(ac))
+ return 0;
switch (psp) {
case POWER_SUPPLY_PROP_ONLINE:
val->intval = ac->state;