lkml.org 
[lkml]   [2007]   [Nov]   [2]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateFri, 02 Nov 2007 12:29:16 +0300
FromAlexey Starikovskiy <>
SubjectRe: [2.6.24-rc1][BUG] Oops on battery removal
Rolf Eike Beer wrote:
> Rolf Eike Beer wrote:
>> Hi,
>>
>> this happened while I removed my battery on bootup. Complete dmesg is
>> attached. Kernel is 2.6.24-rc1-git of yesterday (last commit was
>> d919fd433b5823d1cf9d0688eb2eec183de9b74c).
> 
> Ok, I found out that it has nothing to do with the actual removal as it seems. 
> When I start the laptop with battery already detached I get the same error.
> 
> Eike
Please check if this patch helps.

Thanks,
Alex.
ACPI: Battery: remove cycle from battery removal.

From:  <>

get_property() should not call battery_update() on absent battery to
avoid cycle and oops.

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
---
 drivers/acpi/battery.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index c2ce0ad..50cdf6f 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -140,10 +140,11 @@ static int acpi_battery_get_property(struct power_supply *psy,
 {
 	struct acpi_battery *battery = to_acpi_battery(psy);
 
-	if ((!acpi_battery_present(battery)) &&
-	     psp != POWER_SUPPLY_PROP_PRESENT)
+	if (acpi_battery_present(battery)) {
+		/* run battery update only if it is present */
+		acpi_battery_update(battery);
+	} else if (psp != POWER_SUPPLY_PROP_PRESENT)
 		return -ENODEV;
-	acpi_battery_update(battery);
 	switch (psp) {
 	case POWER_SUPPLY_PROP_STATUS:
 		if (battery->state & 0x01)
\
 
 \ /
  Last update: 2007-11-02 10:33    [from the cache]
©2003-2008