Skip to contentSkip to conversation

ACPI/Battery: Fix parsing _BIX return value

PATCH In review [email protected] 2 participants 2 messages Jul 30, 2013 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI/Battery: Fix parsing _BIX return value

From: Lan Tianyu <[email protected]>

The _BIX method returns extended battery info as a package. According ACPI spec 10.2.2.2, the first member should be "Revision". However, current acpi battery driver treats the first member as "Power Unit" which should be the second member. So the parsing operation is mismatch. This patch is to fix it.

Reported-and-tested-by Jan Hoffmann <[email protected]>

Reference: http://bugzilla.kernel.org/show_bug.cgi?id=60519

---
 drivers/acpi/battery.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/acpi/battery.c +2 -0
index c760b61..2c9958c 100644
@@ -117,6 +117,7 @@ struct acpi_battery {
 	struct acpi_device *device;
 	struct notifier_block pm_nb;
 	unsigned long update_time;
+	int revision;
 	int rate_now;
 	int capacity_now;
 	int voltage_now;
@@ -359,6 +360,7 @@ static struct acpi_offsets info_offsets[] = {
 };
 
 static struct acpi_offsets extended_info_offsets[] = {
+	{offsetof(struct acpi_battery, revision), 0},
 	{offsetof(struct acpi_battery, power_unit), 0},
 	{offsetof(struct acpi_battery, design_capacity), 0},
 	{offsetof(struct acpi_battery, full_charge_capacity), 0},
Signature · 1 line
1.8.3.2
#1 lore raw
Quoted 8 lines · On Tuesday, July 30, 2013 09:54:58 AM [email protected] wrote:

From: Lan Tianyu <[email protected]>

The _BIX method returns extended battery info as a package. According ACPI spec 10.2.2.2, the first member should be "Revision". However, current acpi battery driver treats the first member as "Power Unit" which should be the second member. So the parsing operation is mismatch. This patch is to fix it.

Quoted 4 lines
Reported-and-tested-by Jan Hoffmann <[email protected]>

Reference: http://bugzilla.kernel.org/show_bug.cgi?id=60519

Well, that's one of the most embarrassing bugs I've ever seen. :-)

Queued up as a fix for 3.11.

Thanks,
Rafael

Quoted 25 lines
---
 drivers/acpi/battery.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/acpi/battery.c +2 -0
index c760b61..2c9958c 100644
@@ -117,6 +117,7 @@ struct acpi_battery {
 	struct acpi_device *device;
 	struct notifier_block pm_nb;
 	unsigned long update_time;
+	int revision;
 	int rate_now;
 	int capacity_now;
 	int voltage_now;
@@ -359,6 +360,7 @@ static struct acpi_offsets info_offsets[] = {
 };
 
 static struct acpi_offsets extended_info_offsets[] = {
+	{offsetof(struct acpi_battery, revision), 0},
 	{offsetof(struct acpi_battery, power_unit), 0},
 	{offsetof(struct acpi_battery, design_capacity), 0},
 	{offsetof(struct acpi_battery, full_charge_capacity), 0},
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.