Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754263AbbGWRGo (ORCPT ); Thu, 23 Jul 2015 13:06:44 -0400 Received: from smtprelay0200.hostedemail.com ([216.40.44.200]:44303 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753780AbbGWRGj (ORCPT ); Thu, 23 Jul 2015 13:06:39 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::,RULES_HIT:41:355:379:541:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2551:2553:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3868:3871:4321:5007:6261:10004:10400:10848:11026:11232:11473:11658:11914:12043:12050:12438:12517:12519:12555:12740:13069:13311:13357:13894:14096:14097:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: wren30_1c5fe947b2b21 X-Filterd-Recvd-Size: 2648 Message-ID: <1437671193.26573.10.camel@perches.com> Subject: Re: [PATCH 8/8] power: bq27xxx_battery: Cleanup health checking From: Joe Perches To: Pali =?ISO-8859-1?Q?Roh=E1r?= Cc: "Andrew F. Davis" , Sebastian Reichel , Dmitry Eremin-Solenikov , David Woodhouse , Dan Murphy , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 23 Jul 2015 10:06:33 -0700 In-Reply-To: <20150723162212.GI29125@pali> References: <1437601920-13045-1-git-send-email-afd@ti.com> <1437601920-13045-9-git-send-email-afd@ti.com> <20150723162212.GI29125@pali> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1780 Lines: 53 On Thu, 2015-07-23 at 18:22 +0200, Pali Roh?r wrote: > On Wednesday 22 July 2015 16:52:00 Andrew F. Davis wrote: > > Reorganize the logic checking battery health and under temperature > > condition checking. [] > > diff --git a/drivers/power/bq27xxx_battery.c b/drivers/power/bq27xxx_battery.c [] > > @@ -624,10 +626,34 @@ static int bq27xxx_battery_read_pwr_avg(struct bq27xxx_device_info *di) > > */ > > static int bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags) > > { > > - if (di->chip == BQ27500 || di->chip == BQ27541) > > + if (di->chip == BQ27500 || di->chip == BQ27541 || di->chip == BQ27545) > > return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD); > > + if (di->chip == BQ27530 || di->chip == BQ27421) > > + return flags & BQ27XXX_FLAG_OT; > > + > > + return false; Maybe this int function should be bool or return 0 instead of false. > > +static int bq27xxx_battery_undertemp(struct bq27xxx_device_info *di, u16 flags) > > +{ > > + if (di->chip == BQ27530 || di->chip == BQ27421) > > + return flags & BQ27XXX_FLAG_UT; > > + > > + return false; > > +} Here too > > + > > +/* > > + * Returns true if a low state of charge condition is detected > > + */ > > +static int bq27xxx_battery_dead(struct bq27xxx_device_info *di, u16 flags) > > +{ > > + if (di->chip == BQ27000 || di->chip == BQ27010) > > + return flags & (BQ27000_FLAG_EDV1 | BQ27000_FLAG_EDVF); > > else > > - return flags & BQ27XXX_FLAG_OTC; > > + return flags & (BQ27XXX_FLAG_SOC1 | BQ27XXX_FLAG_SOCF); > > } and here -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/