Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752067AbdFAPov (ORCPT ); Thu, 1 Jun 2017 11:44:51 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:33379 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752023AbdFAPos (ORCPT ); Thu, 1 Jun 2017 11:44:48 -0400 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Thomas Elste" , "Sebastian Reichel" Date: Thu, 01 Jun 2017 16:43:15 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 061/212] power: bq24190_charger: Change first_time flag reset condition In-Reply-To: X-SA-Exim-Connect-IP: 82.70.136.246 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1502 Lines: 44 3.16.44-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Elste commit cd054ee16580690830297dbda0abe9c184276d6a upstream. The initial register reset of BQ24190 generates a charger status change whose propagation via power_supply_changed is prevented using a flag. This flag gets never reset so all following events are ignored as well leading for example to userspace not detecting charger connects/disconnects. Therefor change the reset condition of first_time flag, so only the propagation of the first charger status change is prevented. Signed-off-by: Thomas Elste Signed-off-by: Sebastian Reichel [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- drivers/power/bq24190_charger.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/drivers/power/bq24190_charger.c +++ b/drivers/power/bq24190_charger.c @@ -1268,10 +1268,13 @@ static irqreturn_t bq24190_irq_handler_t * register reset so we should ignore that one (the very first * interrupt received). */ - if (alert_userspace && !bdi->first_time) { - power_supply_changed(&bdi->charger); - power_supply_changed(&bdi->battery); - bdi->first_time = false; + if (alert_userspace) { + if (!bdi->first_time) { + power_supply_changed(&bdi->charger); + power_supply_changed(&bdi->battery); + } else { + bdi->first_time = false; + } } out: