summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--acpi-update-battery-information-on-notification-0x81.patch49
-rw-r--r--kernel.spec2
2 files changed, 35 insertions, 16 deletions
diff --git a/acpi-update-battery-information-on-notification-0x81.patch b/acpi-update-battery-information-on-notification-0x81.patch
index 3704b054d..4eef6f931 100644
--- a/acpi-update-battery-information-on-notification-0x81.patch
+++ b/acpi-update-battery-information-on-notification-0x81.patch
@@ -12,14 +12,33 @@ and recreate the battery in order to populate the fields correctly.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
---
- drivers/acpi/battery.c | 20 +++++++++++++++-----
- 1 files changed, 15 insertions(+), 5 deletions(-)
+
+ drivers/acpi/battery.c | 24 +++++++++++++++++-------
+ 1 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
-index 95649d3..2a774a8 100644
+index 9fb9d5a..8da9c88 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
-@@ -605,9 +605,10 @@ static void acpi_battery_quirks2(struct acpi_battery *battery)
+@@ -130,7 +130,7 @@ struct acpi_battery {
+ unsigned long flags;
+ };
+
+-static int acpi_battery_update(struct acpi_battery *battery);
++static int acpi_battery_update(struct acpi_battery *battery, bool get_info);
+
+ #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);
+
+@@ -186,7 +186,7 @@ static int acpi_battery_get_property(struct power_supply *psy,
+ int ret = 0;
+ struct acpi_battery *battery = to_acpi_battery(psy);
+
+- if (acpi_battery_update(battery))
++ if (acpi_battery_update(battery, false))
+ return -ENODEV;
+
+ if (acpi_battery_present(battery)) {
+@@ -610,9 +610,11 @@ static void acpi_battery_quirks2(struct acpi_battery *battery)
}
}
@@ -28,13 +47,14 @@ index 95649d3..2a774a8 100644
{
int result, old_present = acpi_battery_present(battery);
+ int old_power_unit = battery->power_unit;
++
result = acpi_battery_get_status(battery);
if (result)
return result;
-@@ -628,6 +629,14 @@ static int acpi_battery_update(struct acpi_battery *battery)
+@@ -631,6 +633,14 @@ static int acpi_battery_update(struct acpi_battery *battery)
+ }
+ if (!battery->bat.dev)
sysfs_add_battery(battery);
- result = acpi_battery_get_state(battery);
- acpi_battery_quirks2(battery);
+ if (get_info) {
+ acpi_battery_get_info(battery);
+ if (old_power_unit != battery->power_unit) {
@@ -43,10 +63,10 @@ index 95649d3..2a774a8 100644
+ sysfs_add_battery(battery);
+ }
+ }
+ result = acpi_battery_get_state(battery);
+ acpi_battery_quirks2(battery);
return result;
- }
-
-@@ -803,7 +812,7 @@ static print_func acpi_print_funcs[ACPI_BATTERY_NUMFILES] = {
+@@ -808,7 +818,7 @@ static print_func acpi_print_funcs[ACPI_BATTERY_NUMFILES] = {
static int acpi_battery_read(int fid, struct seq_file *seq)
{
struct acpi_battery *battery = seq->private;
@@ -55,17 +75,16 @@ index 95649d3..2a774a8 100644
return acpi_print_funcs[fid](seq, result);
}
-@@ -914,7 +923,8 @@ static void acpi_battery_notify(struct acpi_device *device, u32 event)
+@@ -919,7 +929,7 @@ static void acpi_battery_notify(struct acpi_device *device, u32 event)
if (!battery)
return;
old = battery->bat.dev;
- acpi_battery_update(battery);
-+ acpi_battery_update(battery, (event == ACPI_BATTERY_NOTIFY_INFO ? true
-+ : false));
++ acpi_battery_update(battery, (event == ACPI_BATTERY_NOTIFY_INFO));
acpi_bus_generate_proc_event(device, event,
acpi_battery_present(battery));
acpi_bus_generate_netlink_event(device->pnp.device_class,
-@@ -943,7 +953,7 @@ static int acpi_battery_add(struct acpi_device *device)
+@@ -948,7 +958,7 @@ static int acpi_battery_add(struct acpi_device *device)
if (ACPI_SUCCESS(acpi_get_handle(battery->device->handle,
"_BIX", &handle)))
set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags);
@@ -74,7 +93,7 @@ index 95649d3..2a774a8 100644
#ifdef CONFIG_ACPI_PROCFS_POWER
result = acpi_battery_add_fs(device);
#endif
-@@ -984,7 +994,7 @@ static int acpi_battery_resume(struct acpi_device *device)
+@@ -989,7 +999,7 @@ static int acpi_battery_resume(struct acpi_device *device)
return -EINVAL;
battery = acpi_driver_data(device);
battery->update_time = 0;
diff --git a/kernel.spec b/kernel.spec
index 93fdd9c38..62d248fc5 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -1178,7 +1178,7 @@ ApplyPatch linux-2.6-defaults-acpi-video.patch
ApplyPatch linux-2.6-acpi-video-dos.patch
ApplyPatch acpi-ec-add-delay-before-write.patch
ApplyPatch linux-2.6-acpi-debug-infinite-loop.patch
-#NEEDSFIX#ApplyPatch acpi-update-battery-information-on-notification-0x81.patch
+ApplyPatch acpi-update-battery-information-on-notification-0x81.patch
# Various low-impact patches to aid debugging.
ApplyPatch linux-2.6-debug-sizeof-structs.patch