sometimes the AC status is not updated in time, i.e. no AC event when AC is plugged/unplugged. In this case, we need to update its status before exporting it. http://bugzilla.kernel.org/show_bug.cgi?id=12035 Signed-off-by: Zhang Rui <rui.zhang@xxxxxxxxx> CC: Alexey Starikovskiy <astarikovskiy@xxxxxxx> --- drivers/acpi/ac.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) Index: linux-2.6/drivers/acpi/ac.c =================================================================== --- linux-2.6.orig/drivers/acpi/ac.c +++ linux-2.6/drivers/acpi/ac.c @@ -87,6 +87,7 @@ struct acpi_ac { unsigned long long state; }; +static int acpi_ac_get_state(struct acpi_ac *ac); #define to_acpi_ac(x) container_of(x, struct acpi_ac, charger); #ifdef CONFIG_ACPI_PROCFS_POWER @@ -103,15 +104,18 @@ static int get_ac_property(struct power_ enum power_supply_property psp, union power_supply_propval *val) { + int result; struct acpi_ac *ac = to_acpi_ac(psy); + switch (psp) { case POWER_SUPPLY_PROP_ONLINE: + result = acpi_ac_get_state(ac); val->intval = ac->state; break; default: return -EINVAL; } - return 0; + return result; } static enum power_supply_property ac_props[] = { -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html