diff -rup linux-2.6.18-a/drivers/acpi/battery.c linux-2.6.18-b/drivers/acpi/battery.c --- linux-2.6.18-a/drivers/acpi/battery.c 2006-09-27 23:12:16.000000000 +0400 +++ linux-2.6.18-b/drivers/acpi/battery.c 2006-09-27 23:12:09.000000000 +0400 @@ -324,6 +324,13 @@ static int acpi_battery_check(struct acp return result; } +static void acpi_battery_check_present(struct acpi_battery *battery) +{ + if (!battery->flags.present) { + acpi_battery_check(battery); + } +} + /* -------------------------------------------------------------------------- FS Interface (/proc) -------------------------------------------------------------------------- */ @@ -340,6 +347,8 @@ static int acpi_battery_read_info(struct if (!battery) goto end; + acpi_battery_check_present(battery); + if (battery->flags.present) seq_printf(seq, "present: yes\n"); else { @@ -424,6 +433,8 @@ static int acpi_battery_read_state(struc if (!battery) goto end; + acpi_battery_check_present(battery); + if (battery->flags.present) seq_printf(seq, "present: yes\n"); else { @@ -499,6 +510,8 @@ static int acpi_battery_read_alarm(struc if (!battery) goto end; + acpi_battery_check_present(battery); + if (!battery->flags.present) { seq_printf(seq, "present: no\n"); goto end; @@ -536,6 +549,8 @@ acpi_battery_write_alarm(struct file *fi if (!battery || (count > sizeof(alarm_string) - 1)) return -EINVAL; + acpi_battery_check_present(battery); + if (!battery->flags.present) return -ENODEV;