Skip to content

Commit

Permalink
platform/x86: thinkpad_acpi: Fix multi-battery bug
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Weißschuh authored and Andy Shevchenko committed Aug 15, 2018
1 parent 6640ee6 commit d22296d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/platform/x86/thinkpad_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -9374,7 +9374,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
Expand Down Expand Up @@ -9620,6 +9622,8 @@ static const struct tpacpi_quirk battery_quirk_table[] __initconst = {

static int __init tpacpi_battery_init(struct ibm_init_struct *ibm)
{
memset(&battery_info, 0, sizeof(battery_info));

tp_features.battery_force_primary = tpacpi_check_quirks(
battery_quirk_table,
ARRAY_SIZE(battery_quirk_table));
Expand Down

0 comments on commit d22296d

Please sign in to comment.