aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2018-08-01 18:24:18 -0400
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-08-15 05:55:32 -0400
commitd22296d9c38fd29a96bb5079fb8d17cee278f40e (patch)
treef20feeb17d4fa58bc59fb28a0795bb568b9f6c03
parent6640ee6289b9974334e36d8283fc07f37f3b235d (diff)
platform/x86: thinkpad_acpi: Fix multi-battery bug
The struct containing the supported operations for all batteries is being zeroed on each battery probe. This prevents all other batteries except the lastly probed one from being configured. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index fd49855af110..0a118f462aa4 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -9374,7 +9374,9 @@ static int tpacpi_battery_probe(int battery)
9374{ 9374{
9375 int ret = 0; 9375 int ret = 0;
9376 9376
9377 memset(&battery_info, 0, sizeof(struct tpacpi_battery_driver_data)); 9377 memset(&battery_info.batteries[battery], 0,
9378 sizeof(battery_info.batteries[battery]));
9379
9378 /* 9380 /*
9379 * 1) Get the current start threshold 9381 * 1) Get the current start threshold
9380 * 2) Check for support 9382 * 2) Check for support
@@ -9620,6 +9622,8 @@ static const struct tpacpi_quirk battery_quirk_table[] __initconst = {
9620 9622
9621static int __init tpacpi_battery_init(struct ibm_init_struct *ibm) 9623static int __init tpacpi_battery_init(struct ibm_init_struct *ibm)
9622{ 9624{
9625 memset(&battery_info, 0, sizeof(battery_info));
9626
9623 tp_features.battery_force_primary = tpacpi_check_quirks( 9627 tp_features.battery_force_primary = tpacpi_check_quirks(
9624 battery_quirk_table, 9628 battery_quirk_table,
9625 ARRAY_SIZE(battery_quirk_table)); 9629 ARRAY_SIZE(battery_quirk_table));