]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ACPI / battery: Do not export energy_full[_design] on devices without full_charge_cap...
authorHans de Goede <hdegoede@redhat.com>
Tue, 7 Aug 2018 07:36:30 +0000 (09:36 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 9 Aug 2018 08:49:35 +0000 (10:49 +0200)
commitb41901a2cf06f33c030be96c075872201089d47a
tree0f2f21d7c1a052bed2a68dc2221e689c85284cfb
parent2754435d4c820875412785da9bfa017a74fe51a7
ACPI / battery: Do not export energy_full[_design] on devices without full_charge_capacity

On some devices (with a buggy _BIX implementation) full_charge_capacity
always reports as 0. This means that our energy_full sysfs attribute will
also always be 0, which is not useful to export.

Worse we calculate our reported capacity on full_charge_capacity and if it
is 0 we always report 0. This causes userspace to immediately shutdown or
hibernate the laptop since it assumes that the battery is critically low.

This commit makes us not report energy_full[_design] or capacity on such
broken devices, avoiding the immediate shutdown / hibernate from userspace.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=83941
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/battery.c