public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexey Starikovskiy <astarikovskiy@suse.de>
To: LenBrown <lenb@kernel.org>
Cc: Linux-acpi@vger.kernel.org
Subject: [PATCH] ACPI: Battery: Update info for inserted battery
Date: Thu, 15 May 2008 13:26:33 +0400	[thread overview]
Message-ID: <20080515092633.1640.49831.stgit@thinkpad> (raw)
In-Reply-To: <200805141918.50286.neitzke@ias.edu>

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Acked-by: Andy Neitzke <neitzke@ias.edu>

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
---

 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 b1c723f..e5ca3a0 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -472,7 +472,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;
@@ -483,7 +483,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;


      reply	other threads:[~2008-05-15  9:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-14 15:05 /proc/acpi/battery/BAT0/info stale when battery changed on Thinkpad X60t Andy Neitzke
2008-05-14 17:10 ` Alexey Starikovskiy
2008-05-14 23:18   ` Andy Neitzke
2008-05-15  9:26     ` Alexey Starikovskiy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080515092633.1640.49831.stgit@thinkpad \
    --to=astarikovskiy@suse.de \
    --cc=Linux-acpi@vger.kernel.org \
    --cc=lenb@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox