Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

platform/x86: thinkpad_acpi: Fix errors reading battery thresholds

Check whether the battery supports the relevant charge threshold before
reading the value to silence these errors:

thinkpad_acpi: acpi_evalf(BCTG, dd, ...) failed: AE_NOT_FOUND
ACPI: \_SB_.PCI0.LPC_.EC__.HKEY: BCTG: evaluate failed
thinkpad_acpi: acpi_evalf(BCSG, dd, ...) failed: AE_NOT_FOUND
ACPI: \_SB_.PCI0.LPC_.EC__.HKEY: BCSG: evaluate failed

when reading the charge thresholds via sysfs on platforms that do not
support them such as the ThinkPad T400.

Fixes: 2801b9683f74 ("thinkpad_acpi: Add support for battery thresholds")
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=202619
Signed-off-by: Jonathan Teh <jonathan.teh@outlook.com>
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Link: https://patch.msgid.link/MI0P293MB01967B206E1CA6F337EBFB12926CA@MI0P293MB0196.ITAP293.PROD.OUTLOOK.COM
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

authored by

Jonathan Teh and committed by
Ilpo Järvinen
53e977b1 13fa3aaf

+4 -2
+4 -2
drivers/platform/x86/lenovo/thinkpad_acpi.c
··· 9525 9525 { 9526 9526 switch (what) { 9527 9527 case THRESHOLD_START: 9528 - if ACPI_FAILURE(tpacpi_battery_acpi_eval(GET_START, ret, battery)) 9528 + if (!battery_info.batteries[battery].start_support || 9529 + ACPI_FAILURE(tpacpi_battery_acpi_eval(GET_START, ret, battery))) 9529 9530 return -ENODEV; 9530 9531 9531 9532 /* The value is in the low 8 bits of the response */ 9532 9533 *ret = *ret & 0xFF; 9533 9534 return 0; 9534 9535 case THRESHOLD_STOP: 9535 - if ACPI_FAILURE(tpacpi_battery_acpi_eval(GET_STOP, ret, battery)) 9536 + if (!battery_info.batteries[battery].stop_support || 9537 + ACPI_FAILURE(tpacpi_battery_acpi_eval(GET_STOP, ret, battery))) 9536 9538 return -ENODEV; 9537 9539 /* Value is in lower 8 bits */ 9538 9540 *ret = *ret & 0xFF;