Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 230948
b: refs/heads/master
c: da8aeb9
h: refs/heads/master
v: v3
  • Loading branch information
Rafael J. Wysocki authored and Len Brown committed Jan 12, 2011
1 parent 8fe159a commit 6101be1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d57d09a480e1db38eeee7629c81289b00f338a15
refs/heads/master: da8aeb92d4853f37e281f11fddf61f9c7d84c3cd
14 changes: 14 additions & 0 deletions trunk/drivers/acpi/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,17 @@ static int acpi_battery_update(struct acpi_battery *battery)
return result;
}

static void acpi_battery_refresh(struct acpi_battery *battery)
{
if (!battery->bat.dev)
return;

acpi_battery_get_info(battery);
/* The battery may have changed its reporting units. */
sysfs_remove_battery(battery);
sysfs_add_battery(battery);
}

/* --------------------------------------------------------------------------
FS Interface (/proc)
-------------------------------------------------------------------------- */
Expand Down Expand Up @@ -916,6 +927,8 @@ static void acpi_battery_notify(struct acpi_device *device, u32 event)
if (!battery)
return;
old = battery->bat.dev;
if (event == ACPI_BATTERY_NOTIFY_INFO)
acpi_battery_refresh(battery);
acpi_battery_update(battery);
acpi_bus_generate_proc_event(device, event,
acpi_battery_present(battery));
Expand Down Expand Up @@ -985,6 +998,7 @@ static int acpi_battery_resume(struct acpi_device *device)
if (!device)
return -EINVAL;
battery = acpi_driver_data(device);
acpi_battery_refresh(battery);
battery->update_time = 0;
acpi_battery_update(battery);
return 0;
Expand Down

0 comments on commit 6101be1

Please sign in to comment.