From patchwork Fri Jan 9 09:26:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 1483 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n099NxNi003124 for ; Fri, 9 Jan 2009 01:24:37 -0800 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753020AbZAIJ2T (ORCPT ); Fri, 9 Jan 2009 04:28:19 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753607AbZAIJ2S (ORCPT ); Fri, 9 Jan 2009 04:28:18 -0500 Received: from vms042pub.verizon.net ([206.46.252.42]:62823 "EHLO vms042pub.verizon.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753020AbZAIJ2H (ORCPT ); Fri, 9 Jan 2009 04:28:07 -0500 Received: from localhost.localdomain ([96.237.168.40]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0KD700GDW6AI7CPB@vms042.mailsrvcs.net> for linux-acpi@vger.kernel.org; Fri, 09 Jan 2009 03:27:55 -0600 (CST) Received: from localhost.localdomain (d975xbx2 [127.0.0.1]) by localhost.localdomain (8.14.2/8.14.2) with ESMTP id n099Rr9C011863; Fri, 09 Jan 2009 04:27:53 -0500 Received: (from lenb@localhost) by localhost.localdomain (8.14.2/8.14.2/Submit) id n099RqhC011862; Fri, 09 Jan 2009 04:27:52 -0500 Date: Fri, 09 Jan 2009 04:26:18 -0500 From: Len Brown Subject: [PATCH 16/94] Newly inserted battery might differ from one just removed, so In-reply-to: <1231493256-11678-1-git-send-email-lenb@kernel.org> In-reply-to: To: linux-acpi@vger.kernel.org Cc: Alexey Starikovskiy , Len Brown Message-id: <50b178512b7d6e7724f87459f6bd06504c9c2da1.1231492608.git.len.brown@intel.com> Organization: Intel Open Source Technology Center X-Mailer: git-send-email 1.6.1.76.gc123b References: <1231493256-11678-1-git-send-email-lenb@kernel.org> References: Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Alexey Starikovskiy Signed-off-by: Alexey Starikovskiy Acked-by: Andy Neitzke Signed-off-by: Alexey Starikovskiy suse.de> Signed-off-by: Len Brown --- drivers/acpi/battery.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 1423b0c..65132f9 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -471,7 +471,7 @@ static void sysfs_remove_battery(struct acpi_battery *battery) static int acpi_battery_update(struct acpi_battery *battery) { - int result; + int result, old_present = acpi_battery_present(battery); result = acpi_battery_get_status(battery); if (result) return result; @@ -482,7 +482,8 @@ static int acpi_battery_update(struct acpi_battery *battery) return 0; } #endif - if (!battery->update_time) { + if (!battery->update_time || + old_present != acpi_battery_present(battery)) { result = acpi_battery_get_info(battery); if (result) return result;