linux/drivers/acpi
Hans de Goede 05b147599f ACPI / battery: Deal better with neither design nor full capacity not being reported
commit ff3154d1d8 upstream.

Commit b41901a2cf ("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_capacity and
full_charge_capacity.

Since the device that commit was written as a fix for is not reporting any
form of "full" capacity we cannot calculate the value for the
POWER_SUPPLY_PROP_CAPACITY, this is worked around by using an alternative
array of available properties which does not contain this property.

This is necessary because userspace (upower) treats us returning -ENODEV
as 0 and then typically will trigger an emergency shutdown because of that.
Userspace does not do this if the capacity sysfs attribute is not present
at all.

There are two potential problems with that commit:
 1) It assumes that both full_charge- and design-capacity are broken at the
    same time and only checks if full_charge- is broken.
 2) It assumes that this only ever happens for devices which report energy
    units rather then charge units.

This commit fixes both issues by only using the alternative
array of available properties if both full_charge- and design-capacity are
broken and by also adding an alternative array of available properties for
devices using mA units.

Fixes: b41901a2cf ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-11 04:35:20 -08:00
..
acpica ACPI updates for 5.4-rc1 2019-09-17 19:31:36 -07:00
apei ACPI / APEI: Release resources if gen_pool_add() fails 2019-08-20 23:52:11 +02:00
arm64 ACPI/IORT: Rename arm_smmu_v3_set_proximity() 'node' local variable 2019-08-05 11:06:34 +01:00
dptf
hmat ACPI: HMAT: ACPI_HMAT_MEMORY_PD_VALID is deprecated since ACPI-6.3 2019-10-03 10:15:57 +02:00
nfit ACPI: NFIT: Fix unlock on error in scrub_show() 2019-10-22 11:37:13 +02:00
pmic
x86 x86/intel: Aggregate big core mobile naming 2019-08-28 11:29:31 +02:00
Kconfig ia64: remove support for machvecs 2019-08-16 14:32:26 -07:00
Makefile
ac.c
acpi_adxl.c
acpi_amba.c
acpi_apd.c i2c: imx: ACPI support for NXP i2c controller 2019-09-13 15:12:38 +01:00
acpi_cmos_rtc.c
acpi_configfs.c
acpi_dbg.c
acpi_extlog.c
acpi_ipmi.c
acpi_lpat.c
acpi_lpit.c
acpi_lpss.c ACPI: LPSS: Add dmi quirk for skipping _DEP check for some device-links 2019-12-17 19:56:32 +01:00
acpi_memhotplug.c mm/memory_hotplug: rename walk_memory_range() and pass start+size instead of pfns 2019-07-18 17:08:06 -07:00
acpi_pad.c
acpi_platform.c ACPI: platform: Unregister stale platform devices 2020-01-26 10:01:04 +01:00
acpi_pnp.c
acpi_processor.c ACPI / processor: don't print errors for processorIDs == 0xff 2019-08-09 10:48:34 +02:00
acpi_tad.c
acpi_video.c ACPI: video: Add new hw_changes_brightness quirk, set it on PB Easynote MZ35 2019-07-16 17:30:09 +02:00
acpi_watchdog.c
battery.c ACPI / battery: Deal better with neither design nor full capacity not being reported 2020-02-11 04:35:20 -08:00
bgrt.c
blacklist.c ACPI: blacklist: fix clang warning for unused DMI table 2019-07-11 22:45:00 +02:00
bus.c ACPI: bus: Fix NULL pointer check in acpi_bus_get_private_data() 2019-12-17 19:56:34 +01:00
button.c ACPI: button: Add DMI quirk for Medion Akoya E2215T 2019-12-31 16:44:26 +01:00
cm_sbs.c
container.c
cppc_acpi.c ACPI: CPPC: Set pcc_data[pcc_ss_id] to NULL in acpi_cppc_processor_exit() 2019-10-18 10:36:37 +02:00
custom_method.c Merge branch 'next-lockdown' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security 2019-09-28 08:14:15 -07:00
debugfs.c
device_pm.c ACPI: PM: Avoid attaching ACPI PM domain to certain devices 2019-12-17 19:56:35 +01:00
device_sysfs.c
dock.c
ec.c ACPI: EC: Rework flushing of pending work 2019-12-17 19:56:34 +01:00
ec_sys.c
event.c
evged.c
fan.c
glue.c
hed.c
internal.h ACPI: EC: PM: Consolidate some code depending on PM_SLEEP 2019-08-08 11:25:43 +02:00
ioapic.c
irq.c
numa.c
nvs.c
osi.c
osl.c ACPI: OSL: only free map once in osl.c 2019-12-17 19:56:33 +01:00
pci_irq.c ACPI / PCI: fix acpi_pci_irq_enable() memory leak 2019-09-03 09:41:25 +02:00
pci_link.c ACPI/PCI: Remove surplus parentheses from a return statement 2019-08-21 00:05:20 +02:00
pci_mcfg.c
pci_root.c PCI: Move ASPM declarations to linux/pci.h 2019-08-28 08:28:39 -05:00
pci_slot.c
power.c
pptt.c ACPI/PPTT: Add support for ACPI 6.3 thread flag 2019-08-12 12:59:15 +01:00
proc.c
processor_core.c
processor_driver.c cpufreq: Use per-policy frequency QoS 2019-10-21 02:05:21 +02:00
processor_idle.c
processor_pdc.c
processor_perflib.c ACPI: processor: Add QoS requests for all CPUs 2019-10-25 11:33:48 +02:00
processor_thermal.c ACPI: processor: Add QoS requests for all CPUs 2019-10-25 11:33:48 +02:00
processor_throttling.c
property.c Char/Misc driver patches for 5.4-rc1 2019-09-18 11:14:31 -07:00
reboot.c
resource.c
sbs.c
sbshc.c
sbshc.h ACPI: SBS: remove unused const variable 'SMBUS_PEC' 2019-08-23 12:55:09 +02:00
scan.c ACPI: platform: Unregister stale platform devices 2020-01-26 10:01:04 +01:00
sleep.c ACPI: PM: Drop Dell XPS13 9360 from LPS0 Idle _DSM blacklist 2019-10-10 10:50:20 +02:00
sleep.h
spcr.c
sysfs.c ACPI: sysfs: Change ACPI_MASKABLE_GPE_MAX to 0x100 2020-01-09 10:20:02 +01:00
tables.c Merge branch 'next-lockdown' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security 2019-09-28 08:14:15 -07:00
thermal.c ACPI: thermal: Remove redundant acpi_has_method() calls 2019-09-02 22:52:50 +02:00
utils.c
video_detect.c ACPI: video: Do not export a non working backlight interface on MSI MS-7721 boards 2020-02-11 04:35:19 -08:00
wakeup.c