From patchwork Wed Aug 1 22:24:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 10553109 X-Patchwork-Delegate: andy.shevchenko@gmail.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BFF0F15E2 for ; Wed, 1 Aug 2018 22:30:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B244B2AC1E for ; Wed, 1 Aug 2018 22:30:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B04332A91B; Wed, 1 Aug 2018 22:30:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2E892A748 for ; Wed, 1 Aug 2018 22:30:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729407AbeHBASB (ORCPT ); Wed, 1 Aug 2018 20:18:01 -0400 Received: from ned.t-8ch.de ([212.47.237.191]:48110 "EHLO ned.t-8ch.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726906AbeHBASB (ORCPT ); Wed, 1 Aug 2018 20:18:01 -0400 X-Greylist: delayed 614 seconds by postgrey-1.27 at vger.kernel.org; Wed, 01 Aug 2018 20:18:00 EDT From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1533162264; bh=fNvLRWOg+weB0Qjje3vOhelzTFYmmQsWfOvOrumD8Rw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t01glO82RJEuiZv4nValjovG8jMjBnYu7NV6jfGnmgUsdp8vKCLU/nG+C78/q+Owo +9a8ZOt8irELC22R+uit14MZW0gUyx5j8bM/Uj06sALIuUrsBJ38Nzl8+MQ3WYocwC SqY+9SFTjlZcVl5GxDkbWsgeHpYSuKLlcDGqeZ30= To: platform-driver-x86@vger.kernel.org, ibm-acpi-devel@lists.sourceforge.net Cc: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , Ognjen Galic Subject: [PATCH v2] platform/x86: thinkpad_acpi: Fix multi-battery bug Date: Thu, 2 Aug 2018 00:24:18 +0200 Message-Id: <20180801222418.21892-1-linux@weissschuh.net> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801114747.qrjclik665ya7oh5@khazad-dum.debian.net> References: <20180801114747.qrjclik665ya7oh5@khazad-dum.debian.net> MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- Changes since v1: * Missing sign-off added drivers/platform/x86/thinkpad_acpi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 3dbff2dda9be..60de1c577ce0 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) { 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 @@ -9616,6 +9618,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));