Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1478755ybh; Sun, 15 Mar 2020 04:01:09 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtsFNKCTZVfpcckWDZKHC+LHvSqKPSWtfs3zpI7/ZmWwikcL3YFlofYEZsoM5cXcWx4tj8e X-Received: by 2002:a9d:2aca:: with SMTP id e68mr18738483otb.324.1584270068918; Sun, 15 Mar 2020 04:01:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584270068; cv=none; d=google.com; s=arc-20160816; b=BjOErkoGeD5BlupN+4rsfrMCtuws+Oy40sQYFTuRwUGu6Fi0nf4nZWiY8PaZdiWBDM M5wlCd5hP6Baij71TR2XOYWUZsR5+S9T/X3r3YOUIpVETDZCiwKghrgVVQFBF1ZXI89V AzCARAOi9EDSjSPivY9hV6bRlP+nJGK1tzBnnVscrV5BupCDRp+PMeBix61Ou2Yeeuqd VJCBDwniF/fBfbFgFVEih2oPJJGLoyOjxDNSGegVdoHt7VW02kL2D1jep5oJF+C0Za8t KJEHwYkLIGLeHlpcXUW+0LgyQPGsjelbhhL+xc7j79TvVQhlgguQwZL+ioOfSFLGw7cK Ur6g== 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:autocrypt :from:references:cc:to:subject; bh=A+TgLUGW8nPAAHVRkE5Moq1klhmvwul1kAzFysYZmwk=; b=IVhcGBrUgN+rqj2FQ7UmtKPSZwFCui0bZRXSgutCV5zcKtIAqWxlOUPWfzNrU51Klj WrXcz4oEJ02K5B1yyx44NFDOvpiH0P0bZZP7LH1T5zDSWWo5s9oKGXZJkmrEABHH29to Rg0wL3gjv490RtP9RfLsLEixcyS+nWZ7JyOEo7LVt508ShnAmNPypVD+VM390Ge0dYdA IrjWbJ/VHkqyffWmULjm4JK3Y/Q8e01YA5svGP194cBshyc+1QCbZOGb6fROXqh4yCEg Z/k7V/uy3gKsvKuxfb58f1YIFBKMw8ugyYHUogAE1XsW5H6FSZ/sygHKXffdUw6w31+T uIeg== 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 j65si7478739otc.308.2020.03.15.04.00.56; Sun, 15 Mar 2020 04:01:08 -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 S1728333AbgCOLAl (ORCPT + 99 others); Sun, 15 Mar 2020 07:00:41 -0400 Received: from mail.manjaro.org ([176.9.38.148]:41978 "EHLO mail.manjaro.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728234AbgCOLAk (ORCPT ); Sun, 15 Mar 2020 07:00:40 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.manjaro.org (Postfix) with ESMTP id 98C0837827DA; Sun, 15 Mar 2020 12:00:38 +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 vEPWKCNnrgeS; Sun, 15 Mar 2020 12:00:36 +0100 (CET) Subject: Re: [PATCH v4 3/3] power: supply: add CellWise cw2015 fuel gauge driver To: Andy Shevchenko , Tobias Schramm Cc: Sebastian Reichel , Rob Herring , Mark Rutland , Daniel Thompson , 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: <20200312222448.25097-1-t.schramm@manjaro.org> <20200312222448.25097-4-t.schramm@manjaro.org> <20200313091124.GP1922688@smile.fi.intel.com> From: Tobias Schramm Autocrypt: addr=tobias@t-sys.eu; prefer-encrypt=mutual; keydata= mQINBFgH1OABEADhAn5NXjwGDViVaWhOre/SrGOFbt13AcXXhmnfHoQ32X92vKvkH6CW7iPC IZQWNhx56ADSgp29Xho/IgN0nlv+ViB0l6Y44TUy2Q1lVOnojQPCorCxQKBzQwkvgWocpChI GAUBg86B7q5kX8jWC87mpZvonGtovzLAdcUt6vKbH3q4Je++l2a1g8w5MmGKcKA/I3bhjNeP L5hTcKvsCfXCUulSUD0murqLck74oWT1nUEhqp62TJ//CtBDg2d1gY1CPJuG4iwtiWNwdmTb 090NN9Dgk0FYDBYE07joWORBvUhQhNDj+C/dTegJmwlZRcxf2m1M9hGja7wBI+wFkciDu3fi zynCFf/KZo/uztTOxsMwSXF0BkauXq/C/IJUpIHup4jnPRULA0BtlVVTi9FVyRmSFD4/EZSD Bfer2khndcxKaRMj0K1+Xc8SAsw0HfyN1e3lh2h/5RhhKCv8xSsUytf3O6TZ6c93KuzcQxhv 0aASBie3ukKOAE8GfpZGzji7ceCAcONjWXE4NCgeOHZRKKuMYJP9GujhjapoogcRebkoHvLc jriy16Elx+Quul7Yz0S8+cyWvPuiQ0oC9rUOpoMHcPmX6bwb8umEEOxHQ0sbqxE0HFlKgKvt Tt8uLNSPKprzX0KHNqqxEd19zmPGB8FE+h91ZypbUhlTvlGnRwARAQABtCBUb2JpYXMgU2No cmFtbSA8dG9iaWFzQHQtc3lzLmV1PokCNwQTAQgAIQUCWAfbSAIbAwULCQgHAgYVCAkKCwIE FgIDAQIeAQIXgAAKCRBwh07mc7oVEiDuEACJCscUdfS1GnUhss0ee+wSdMXQiTOvRzU7V8tJ cpyVr9ycmmaGh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.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US-large Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, thanks for your feedback. Please find my comments inline. > >> + dev_err(cw_bat->dev, >> + "Failed to upload battery info\n"); > > Indentation of the second line. > I've seen quite a few different indentation styles used in kernel source. Personally I'd indent like this: dev_warn(cw_bat->dev, "some long error message"); However coding-style.rst specifies that spaces are never to be used for indentation. May I assume they are ok for alignment though? > And I'm thinking that we may refactor this function. So, > > length = ..._count_u8(...); > if (length < 0) { > dev_warn(...); > } else if (length != ...) { > dev_err(...); > ... > } else { > ... > } > > > >> + if (length != CW2015_SIZE_BATINFO) { >> + dev_err(cw_bat->dev, "battery-profile must be %d bytes", >> + CW2015_SIZE_BATINFO); >> + return -EINVAL; >> + } >> + >> + cw_bat->bat_profile = devm_kzalloc(dev, length, GFP_KERNEL); >> + if (!cw_bat->bat_profile) { >> + dev_err(cw_bat->dev, >> + "Failed to allocate memory for battery config info"); >> + return -ENOMEM; >> + } >> + >> + ret = device_property_read_u8_array(dev, >> + "cellwise,battery-profile", >> + cw_bat->bat_profile, >> + length); >> + if (ret) >> + return ret; >> + } else { >> + dev_warn(cw_bat->dev, >> + "No battery-profile found, rolling with current flash contents"); >> + } >> + > > ...and here... > >> + cw_bat->poll_interval_ms = CW2015_DEFAULT_POLL_INTERVAL_MS; >> + ret = device_property_read_u32(dev, "cellwise,monitor-interval-ms", &value); >> + if (ret >= 0) { >> + dev_dbg(cw_bat->dev, "Overriding default monitor-interval with %u ms", >> + value); >> + cw_bat->poll_interval_ms = value; >> + } > > ret = device_property_read_u32(dev, "cellwise,monitor-interval-ms", &cw_bat->poll_interval_ms); > if (ret) { > dev_dbg(cw_bat->dev, "Use default\n"); > cw_bat->poll_interval_ms = CW2015_DEFAULT_POLL_INTERVAL_MS; > } > > What do you think? > Looks good to me. I'll use it just like that. > >> + int ret; >> + struct cw_battery *cw_bat; > >> + struct power_supply_config psy_cfg = { }; > > Don't you need 0 here? > Yeah, that would be better. Think empty initializers are a GNU extension. Best Regards, Tobias