Previously the struct containing the supported operations for all
batteries was zeroed every time a battery was probed.
This prevented all batteries except the lastly probed one from being
configured.

Signed-off-by: Thomas Weißschuh <li...@weissschuh.net>
---
 drivers/platform/x86/thinkpad_acpi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/thinkpad_acpi.c 
b/drivers/platform/x86/thinkpad_acpi.c
index cae9b0595692..1fc6a667dbd4 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -9365,7 +9365,9 @@ static int tpacpi_battery_probe(int battery)
 {
        int ret = 0;
 
-       memset(&battery_info, 0, sizeof(struct tpacpi_battery_driver_data));
+       memset(&battery_info.batteries[battery], 0,
+                       sizeof(battery_info.batteries[battery]));
+
        /*
         * 1) Get the current start threshold
         * 2) Check for support
@@ -9598,6 +9600,7 @@ static struct acpi_battery_hook battery_hook = {
 
 static int __init tpacpi_battery_init(struct ibm_init_struct *ibm)
 {
+       memset(&battery_info, 0, sizeof(battery_info));
        battery_hook_register(&battery_hook);
        return 0;
 }
-- 
2.17.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
ibm-acpi-devel mailing list
ibm-acpi-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel

Reply via email to