Skip to content

Commit d22296d

Browse files
t-8chandy-shev
authored andcommitted
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>
1 parent 6640ee6 commit d22296d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎drivers/platform/x86/thinkpad_acpi.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9374,7 +9374,9 @@ static int tpacpi_battery_probe(int battery)
93749374
{
93759375
int ret = 0;
93769376

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+
93789380
/*
93799381
* 1) Get the current start threshold
93809382
* 2) Check for support
@@ -9620,6 +9622,8 @@ static const struct tpacpi_quirk battery_quirk_table[] __initconst = {
96209622

96219623
static int __init tpacpi_battery_init(struct ibm_init_struct *ibm)
96229624
{
9625+
memset(&battery_info, 0, sizeof(battery_info));
9626+
96239627
tp_features.battery_force_primary = tpacpi_check_quirks(
96249628
battery_quirk_table,
96259629
ARRAY_SIZE(battery_quirk_table));

0 commit comments

Comments
 (0)