X86 platform drivers
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <linux-9XfqOkM5JgxKQ7RDE2T8Pw@public.gmane.org>
To: platform-driver-x86-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	ibm-acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Cc: "Thomas Weißschuh"
	<linux-9XfqOkM5JgxKQ7RDE2T8Pw@public.gmane.org>,
	"Ognjen Galic" <smclt30p-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCH v2] platform/x86: thinkpad_acpi: Fix multi-battery bug
Date: Thu,  2 Aug 2018 00:24:18 +0200	[thread overview]
Message-ID: <20180801222418.21892-1-linux@weissschuh.net> (raw)
In-Reply-To: <20180801114747.qrjclik665ya7oh5-ZGHd14iZgfaRjzvQDGKj+xxZW9W5cXbT@public.gmane.org>

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>
---

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));
-- 
2.18.0


------------------------------------------------------------------------------
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

  parent reply	other threads:[~2018-08-01 22:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180616093954.8435-1-linux@weissschuh.net>
     [not found] ` <00b72055-929d-4bda-bff3-3a9249568b73@t-8ch.de>
     [not found]   ` <00b72055-929d-4bda-bff3-3a9249568b73-khTSGRnkC0s@public.gmane.org>
2018-08-01 11:47     ` [PATCH] thinkpad_acpi: don't overwrite supported battery operations Henrique de Moraes Holschuh
     [not found]       ` <20180801114747.qrjclik665ya7oh5-ZGHd14iZgfaRjzvQDGKj+xxZW9W5cXbT@public.gmane.org>
2018-08-01 22:19         ` [PATCH] platform/x86: thinkpad_acpi: Fix multi-battery bug Thomas Weißschuh
2018-08-01 22:24         ` Thomas Weißschuh [this message]
     [not found]           ` <20180801222418.21892-1-linux-9XfqOkM5JgxKQ7RDE2T8Pw@public.gmane.org>
2018-08-06 13:24             ` [PATCH v2] " Andy Shevchenko
     [not found]               ` <CAHp75VeprNMVniQ_KrQRU9v3kt4kxEnHYO+ds5pOYokvv=0YdQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-09-07 11:41                 ` Yves-Alexis Perez
     [not found]                   ` <6c62d06dee6572f7d03280ed9e9f6d7b7d9babf1.camel-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>
2018-09-07 17:59                     ` Thomas Weißschuh
     [not found]                       ` <4e387ece-dbf1-434b-8dde-18f0fa513d99-khTSGRnkC0s@public.gmane.org>
2018-09-07 21:25                         ` Yves-Alexis Perez
     [not found]                           ` <d91099a3353c6eb11ea9eaa5fa8409dc86f7f7ed.camel-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>
2018-09-07 21:37                             ` Henrique de Moraes Holschuh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180801222418.21892-1-linux@weissschuh.net \
    --to=linux-9xfqokm5jgxkq7rde2t8pw@public.gmane.org \
    --cc=ibm-acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=platform-driver-x86-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=smclt30p-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox