From patchwork Fri Jul 1 08:03:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lan,Tianyu" X-Patchwork-Id: 934792 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6183KUQ012623 for ; Fri, 1 Jul 2011 08:03:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755146Ab1GAIDj (ORCPT ); Fri, 1 Jul 2011 04:03:39 -0400 Received: from mga03.intel.com ([143.182.124.21]:6431 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755122Ab1GAIDj (ORCPT ); Fri, 1 Jul 2011 04:03:39 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 01 Jul 2011 01:03:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.65,456,1304319600"; d="scan'208";a="21362087" Received: from lantianyu-ws.sh.intel.com (HELO localhost) ([10.239.35.77]) by azsmga001.ch.intel.com with ESMTP; 01 Jul 2011 01:03:28 -0700 From: Lan Tianyu To: lenb@kernel.org Cc: linux-acpi@vger.kernel.org, tianyu.lan@intel.com, rui.zhang@intel.com Subject: [PATCH 2/2] ACPI / SBS: Correct the value of power_now and power_avg in the sysfs Date: Fri, 1 Jul 2011 16:03:39 +0800 Message-Id: <1309507419-19247-1-git-send-email-tianyu.lan@intel.com> X-Mailer: git-send-email 1.7.6.rc2.8.g28eb Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 01 Jul 2011 08:03:40 +0000 (UTC) https://bugzilla.kernel.org/show_bug.cgi?id=24492 Signed-off-by: Lan Tianyu --- drivers/acpi/sbs.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 01dad1b..c517ec8 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c @@ -230,11 +230,17 @@ static int acpi_sbs_battery_get_property(struct power_supply *psy, case POWER_SUPPLY_PROP_POWER_NOW: val->intval = abs(battery->rate_now) * acpi_battery_ipscale(battery) * 1000; + val->intval *= (acpi_battery_mode(battery)) ? + (battery->voltage_now * + acpi_battery_vscale(battery) / 1000) : 1; break; case POWER_SUPPLY_PROP_CURRENT_AVG: case POWER_SUPPLY_PROP_POWER_AVG: val->intval = abs(battery->rate_avg) * acpi_battery_ipscale(battery) * 1000; + val->intval *= (acpi_battery_mode(battery)) ? + (battery->voltage_now * + acpi_battery_vscale(battery) / 1000) : 1; break; case POWER_SUPPLY_PROP_CAPACITY: val->intval = battery->state_of_charge;