From patchwork Tue Jul 30 01:54:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lan,Tianyu" X-Patchwork-Id: 2835212 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3710FC0319 for ; Tue, 30 Jul 2013 02:03:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3B3B520211 for ; Tue, 30 Jul 2013 02:03:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5DC722022D for ; Tue, 30 Jul 2013 02:03:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752529Ab3G3CDN (ORCPT ); Mon, 29 Jul 2013 22:03:13 -0400 Received: from mga09.intel.com ([134.134.136.24]:22237 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752062Ab3G3CDN (ORCPT ); Mon, 29 Jul 2013 22:03:13 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 29 Jul 2013 19:00:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.89,774,1367996400"; d="scan'208";a="378618925" Received: from lantianyu-ws.sh.intel.com (HELO localhost) ([10.239.36.12]) by orsmga002.jf.intel.com with ESMTP; 29 Jul 2013 19:03:11 -0700 From: tianyu.lan@intel.com To: rjw@sisk.pl, lenb@kernel.org Cc: Lan Tianyu , linux-acpi@vger.kernel.org, jan.christian.hoffmann@gmail.com Subject: [PATCH] ACPI/Battery: Fix parsing _BIX return value Date: Tue, 30 Jul 2013 09:54:58 +0800 Message-Id: <1375149298-28206-1-git-send-email-tianyu.lan@intel.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Lan Tianyu 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 Reference: http://bugzilla.kernel.org/show_bug.cgi?id=60519 CC: stable@vger.kernel.org #v2.6.34+ Signed-off-by: Lan Tianyu --- drivers/acpi/battery.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index c760b61..2c9958c 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -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},