diff options
author | Hans de Goede <hdegoede@redhat.com> | 2019-12-10 12:57:50 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2019-12-16 13:16:57 +0300 |
commit | cc99f0ad52467028cb1251160f23ad4bb65baf20 (patch) | |
tree | 243934099c1899fdd95cdc03343918cad8dfda67 /crypto/chacha20poly1305.c | |
parent | d1eef1c619749b2a57e514a3fa67d9a516ffa919 (diff) | |
download | linux-cc99f0ad52467028cb1251160f23ad4bb65baf20.tar.xz |
ACPI / battery: Deal with design or full capacity being reported as -1
Commit b41901a2cf06 ("ACPI / battery: Do not export energy_full[_design]
on devices without full_charge_capacity") added support for some (broken)
devices which always report 0 for both design- and full_charge-capacity.
This assumes that if the capacity is not being reported it is 0. The
ThunderSoft TS178 tablet's _BIX implementation falsifies this assumption.
It reports ACPI_BATTERY_VALUE_UNKNOWN (-1) as full_charge_capacity, which
we treat as a valid value which causes several problems.
This commit fixes this by adding a new ACPI_BATTERY_CAPACITY_VALID() helper
which checks that the value is not 0 and not -1; and using this whenever we
need to test if either design_capacity or full_charge_capacity is valid.
Fixes: b41901a2cf06 ("ACPI / battery: Do not export energy_full[_design] on devices without full_charge_capacity")
Cc: 4.19+ <stable@vger.kernel.org> # 4.19+
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'crypto/chacha20poly1305.c')
0 files changed, 0 insertions, 0 deletions