The WMI method to set the charge threshold does not provide a way to specific a battery, so we assume it is the first/primary battery (by checking if the name is BAT0). On some newer ASUS laptops (Zenbook UM431DA) though, the primary/first battery isn't named BAT0 but BATT, so we need to support that case.
Signed-off-by: Kristian Klausen kristian@klausen.dk Cc: stable@vger.kernel.org --- I'm not sure if this is candidate for -stable, it fix a real bug (charge threshold doesn't work on newer ASUS laptops) which has been reported by a user[1], but is that enough? I had a quick look at[2], can this be considered a "something critical"? It "bothers people"[1]. My point: I'm not sure..
I'm unsure if there is a bettery way to fix this. Maybe a counter would be better (+1 for every new battery)? It would probably need to be atomic to prevent race condition (I'm not sure how this code is run), but this "fix" is way simpler.
Please do not accept this patch just yet, I'm waiting for the tester to either confirm or deny credit[3].
[1] https://gist.github.com/klausenbusk/643f15320ae8997427155c38be13e445#gistcom... [2] https://www.kernel.org/doc/html/v5.5/process/stable-kernel-rules.html [3] https://gist.github.com/klausenbusk/643f15320ae8997427155c38be13e445#gistcom...
drivers/platform/x86/asus-wmi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 612ef5526226..4c690cebdd55 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -426,8 +426,11 @@ static int asus_wmi_battery_add(struct power_supply *battery) { /* The WMI method does not provide a way to specific a battery, so we * just assume it is the first battery. + * Note: On some newer ASUS laptops (Zenbook UM431DA), the primary/first + * battery is named BATT. */ - if (strcmp(battery->desc->name, "BAT0") != 0) + if (strcmp(battery->desc->name, "BAT0") != 0 + && (strcmp(battery->desc->name, "BATT") != 0)) return -ENODEV;
if (device_create_file(&battery->dev,
On 23.02.2020 18.54, Kristian Klausen wrote:
The WMI method to set the charge threshold does not provide a way to specific a battery, so we assume it is the first/primary battery (by checking if the name is BAT0). On some newer ASUS laptops (Zenbook UM431DA) though, the primary/first battery isn't named BAT0 but BATT, so we need to support that case.
Signed-off-by: Kristian Klausen kristian@klausen.dk Cc: stable@vger.kernel.org
The patch has been superseded by a new patch with a mirror style change.
I'm not sure if this is candidate for -stable, it fix a real bug (charge threshold doesn't work on newer ASUS laptops) which has been reported by a user[1], but is that enough? I had a quick look at[2], can this be considered a "something critical"? It "bothers people"[1]. My point: I'm not sure..
I'm unsure if there is a bettery way to fix this. Maybe a counter would be better (+1 for every new battery)? It would probably need to be atomic to prevent race condition (I'm not sure how this code is run), but this "fix" is way simpler.
Please do not accept this patch just yet, I'm waiting for the tester to either confirm or deny credit[3].
[1] https://gist.github.com/klausenbusk/643f15320ae8997427155c38be13e445#gistcom... [2] https://www.kernel.org/doc/html/v5.5/process/stable-kernel-rules.html [3] https://gist.github.com/klausenbusk/643f15320ae8997427155c38be13e445#gistcom...
drivers/platform/x86/asus-wmi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 612ef5526226..4c690cebdd55 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -426,8 +426,11 @@ static int asus_wmi_battery_add(struct power_supply *battery) { /* The WMI method does not provide a way to specific a battery, so we * just assume it is the first battery.
* Note: On some newer ASUS laptops (Zenbook UM431DA), the primary/first
*/* battery is named BATT.
- if (strcmp(battery->desc->name, "BAT0") != 0)
- if (strcmp(battery->desc->name, "BAT0") != 0
- && (strcmp(battery->desc->name, "BATT") != 0)) return -ENODEV;
if (device_create_file(&battery->dev,
Hi,
[This is an automated email]
This commit has been processed because it contains a -stable tag. The stable tag indicates that it's relevant for the following trees: all
The bot has tested the following trees: v5.5.5, v5.4.21, v4.19.105, v4.14.171, v4.9.214, v4.4.214.
v5.5.5: Build OK! v5.4.21: Build OK! v4.19.105: Failed to apply! Possible dependencies: 11e87702be65 ("PCI: pciehp: Differentiate between surprise and safe removal") 125450f81441 ("PCI: hotplug: Embed hotplug_slot") 5790a9c78e78 ("PCI: pciehp: Unify controller and slot structs") 7973353e92ee ("platform/x86: asus-wmi: Refactor charge threshold to use the battery hooking API") 80696f991424 ("PCI: pciehp: Tolerate Presence Detect hardwired to zero") 81c4b5bf30de ("PCI: hotplug: Constify hotplug_slot_ops") a7da21613c4e ("PCI: hotplug: Drop hotplug_slot_info") b096f626a682 ("platform/x86: asus-wmi: Switch fan boost mode") eee6e273843d ("PCI: pciehp: Drop hotplug_slot_ops wrappers")
v4.14.171: Failed to apply! Possible dependencies: 125450f81441 ("PCI: hotplug: Embed hotplug_slot") 4aed1cd6fb95 ("PCI: pciehp: Document struct slot and struct controller") 51bbf9bee34f ("PCI: hotplug: Demidlayer registration with the core") 5790a9c78e78 ("PCI: pciehp: Unify controller and slot structs") 7973353e92ee ("platform/x86: asus-wmi: Refactor charge threshold to use the battery hooking API") 81c4b5bf30de ("PCI: hotplug: Constify hotplug_slot_ops") 97c6f25d5828 ("PCI/hotplug: ppc: correct a php_slot usage after free") a7da21613c4e ("PCI: hotplug: Drop hotplug_slot_info") b096f626a682 ("platform/x86: asus-wmi: Switch fan boost mode") c7abb2352c29 ("PCI: Remove unnecessary messages for memory allocation failures") dbb3d78f61ba ("platform/x86: asus-wmi: Call led hw_changed API on kbd brightness change") ed99d29b2b15 ("platform/x86: asus-wmi: Add keyboard backlight toggle support")
v4.9.214: Failed to apply! Possible dependencies: 125450f81441 ("PCI: hotplug: Embed hotplug_slot") 4aed1cd6fb95 ("PCI: pciehp: Document struct slot and struct controller") 51bbf9bee34f ("PCI: hotplug: Demidlayer registration with the core") 5790a9c78e78 ("PCI: pciehp: Unify controller and slot structs") 7973353e92ee ("platform/x86: asus-wmi: Refactor charge threshold to use the battery hooking API") 81c4b5bf30de ("PCI: hotplug: Constify hotplug_slot_ops") 97c6f25d5828 ("PCI/hotplug: ppc: correct a php_slot usage after free") a7da21613c4e ("PCI: hotplug: Drop hotplug_slot_info") b096f626a682 ("platform/x86: asus-wmi: Switch fan boost mode") c7abb2352c29 ("PCI: Remove unnecessary messages for memory allocation failures") dbb3d78f61ba ("platform/x86: asus-wmi: Call led hw_changed API on kbd brightness change") ed99d29b2b15 ("platform/x86: asus-wmi: Add keyboard backlight toggle support")
v4.4.214: Failed to apply! Possible dependencies: 125450f81441 ("PCI: hotplug: Embed hotplug_slot") 2ac83cccabbc ("PCI: hotplug: Use list_for_each_entry() to simplify code") 51bbf9bee34f ("PCI: hotplug: Demidlayer registration with the core") 66725152fb9f ("PCI/hotplug: PowerPC PowerNV PCI hotplug driver") 7973353e92ee ("platform/x86: asus-wmi: Refactor charge threshold to use the battery hooking API") 89379f165a1b ("PCI/hotplug: pnv_php: export symbols and move struct types needed by cxl") 97c6f25d5828 ("PCI/hotplug: ppc: correct a php_slot usage after free") a7da21613c4e ("PCI: hotplug: Drop hotplug_slot_info") b096f626a682 ("platform/x86: asus-wmi: Switch fan boost mode") dbb3d78f61ba ("platform/x86: asus-wmi: Call led hw_changed API on kbd brightness change") ed99d29b2b15 ("platform/x86: asus-wmi: Add keyboard backlight toggle support") ef69b03dfd32 ("MAINTAINERS: Add powerpc drivers to the powerpc section") ff3ce480e8b5 ("PCI: Fix all whitespace issues")
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
linux-stable-mirror@lists.linaro.org