Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1064801ybh; Wed, 11 Mar 2020 16:52:31 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtddonNWrqfO0ddjCZ/wP/GKY4Jn9WFVnHhmr/btOeXmBipl/D65KSdWa+hacwgS/UqV7mW X-Received: by 2002:a9d:64cd:: with SMTP id n13mr4324482otl.274.1583970750944; Wed, 11 Mar 2020 16:52:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583970750; cv=none; d=google.com; s=arc-20160816; b=eE+YNxkf/tnx+vig7edp4KNmjS0+s1fWHcVvS8F8h7f+gEP5UXddjg8RYIMkYaHsBq odA0KlFENndOFua+Hd+Xudg8IJ810eq813N7FTapKo0rZIs1hvbR3ZSOlY3/+5tmqbRb mXqHMBfVknQJR2P3oAgZmtt1oECYu3a7t2jApRx8lp3YNgBu5hBXz28lpOuPfIpCdqlf aRVx4017TVPkUoYITaVb8XIPRhizR11IjkGzGQ0ryWa8mNkRegw44DTR8gjznKL6yO3H EMDx7MKsVdnrRf4XRavs7480//qB7PHnOw9kUIbK2Azcq9UCRz8v0XMopWHEOelGtE8b ByLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:date:message-id:from :references:cc:to:subject; bh=srF3DO6gTxLDXAjLdF+Elsn6qdNJxeKVLOzHNZXGYEc=; b=uQdUmL4iZp6RumnH03L73DWTf8DCZKCsmt1IKPnYYMoBxOgzfv00u2mk/CkYgiw75n rRhcGYwLi9ldVWq8+xvAm77TJFcnrpiEqfC6Rc8q0qYjcC2wa1ZK109ZHD4vNzSv23+l 68D1o5O/85mdHsT58ZZjiA9dk2JwwJvZUT6VxAR9b82RfOKJXxwsohxTO2G4sFSYZ5Ze aXgY84VHHcMi+uJ10lj8bHGh0EFKufQY4jgmYSPTU30UONpyL6QYhEDRr3UnV/FppEyM /cngVKVsckBwcPOLUW0sjV6e99atP5BqshI8q3WKs/jhRfkO9NK8c0chHhqUSUoJ7e97 RHLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u135si1856092oif.248.2020.03.11.16.52.16; Wed, 11 Mar 2020 16:52:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731465AbgCKXu2 (ORCPT + 99 others); Wed, 11 Mar 2020 19:50:28 -0400 Received: from mail.manjaro.org ([176.9.38.148]:32976 "EHLO mail.manjaro.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731399AbgCKXu2 (ORCPT ); Wed, 11 Mar 2020 19:50:28 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.manjaro.org (Postfix) with ESMTP id 2A34437024CE; Thu, 12 Mar 2020 00:50:26 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at manjaro.org Received: from mail.manjaro.org ([127.0.0.1]) by localhost (manjaro.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BuEVeWZmGOFA; Thu, 12 Mar 2020 00:50:23 +0100 (CET) Subject: Re: [PATCH v3 3/3] power: supply: add CellWise cw2015 fuel gauge driver To: Andy Shevchenko , Tobias Schramm Cc: Sebastian Reichel , Rob Herring , Mark Rutland , Maxime Ripard , Sam Ravnborg , Heiko Stuebner , Stephan Gerhold , Mark Brown , Mauro Carvalho Chehab , "David S. Miller" , Greg Kroah-Hartman , Jonathan Cameron , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200311093043.3636807-1-t.schramm@manjaro.org> <20200311093043.3636807-4-t.schramm@manjaro.org> <20200311101830.GE1922688@smile.fi.intel.com> From: Tobias Schramm Message-ID: Date: Thu, 12 Mar 2020 00:51:28 +0100 MIME-Version: 1.0 In-Reply-To: <20200311101830.GE1922688@smile.fi.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US-large Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, thanks for reviewing again. >> + /* wait for gauge to become ready */ >> + for (i = 0; i < CW2015_READ_TRIES; i++) { >> + ret = regmap_read(cw_bat->regmap, CW2015_REG_SOC, ®_val); >> + if (ret) >> + return ret; >> + /* SoC must not be more than 100% */ >> + else if (reg_val <= 100) >> + break; >> + >> + msleep(100); >> + } > > Have you considered to use regmap_read_poll_timeout()? Neat! That is a much cleaner solution. Will use that in v4. > >> + >> + if (i >= CW2015_READ_TRIES) { >> + reg_val = CW2015_MODE_SLEEP; >> + regmap_write(cw_bat->regmap, CW2015_REG_MODE, reg_val); >> + dev_err(cw_bat->dev, >> + "Gauge did not become ready after profile upload"); >> + return -ETIMEDOUT; >> + } > > ... > >> + if (memcmp(bat_info, cw_bat->bat_profile, >> + CW2015_SIZE_BATINFO)) { > > I think it's pretty much okay to have this on one line, disregard 80 limit > (it's only 1 extra). Ok, will probably do that in a few places. Best Regards, Tobias