Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI / battery: Fix parsing _BIX return value

The _BIX method returns extended battery info as a package.
According the ACPI spec (ACPI 5, Section 10.2.2.2), the first member
of that package should be "Revision". However, the current ACPI
battery driver treats the first member as "Power Unit" which should
be the second member. This causes the result of _BIX return data
parsing to be incorrect.

Fix this by adding a new member called 'revision' to struct
acpi_battery and adding the offsetof() information on it to
extended_info_offsets[] as the first row.

[rjw: Changelog]
Reported-and-tested-by: Jan Hoffmann <jan.christian.hoffmann@gmail.com>
References: http://bugzilla.kernel.org/show_bug.cgi?id=60519
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Cc: 2.6.34+ <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Lan Tianyu and committed by
Rafael J. Wysocki
016d5baa 2a998599

+2
+2
drivers/acpi/battery.c
··· 117 117 struct acpi_device *device; 118 118 struct notifier_block pm_nb; 119 119 unsigned long update_time; 120 + int revision; 120 121 int rate_now; 121 122 int capacity_now; 122 123 int voltage_now; ··· 360 359 }; 361 360 362 361 static struct acpi_offsets extended_info_offsets[] = { 362 + {offsetof(struct acpi_battery, revision), 0}, 363 363 {offsetof(struct acpi_battery, power_unit), 0}, 364 364 {offsetof(struct acpi_battery, design_capacity), 0}, 365 365 {offsetof(struct acpi_battery, full_charge_capacity), 0},