From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39C08C2D0E8 for ; Fri, 27 Mar 2020 10:21:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1083520705 for ; Fri, 27 Mar 2020 10:21:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="lwFfgP7q" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727322AbgC0KVe (ORCPT ); Fri, 27 Mar 2020 06:21:34 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:50906 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726454AbgC0KVe (ORCPT ); Fri, 27 Mar 2020 06:21:34 -0400 Received: by mail-wm1-f67.google.com with SMTP id d198so10860852wmd.0 for ; Fri, 27 Mar 2020 03:21:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=mxz8+ilE2NjB6kYVNyYap8z20EWNc89Zq7z80dHig9g=; b=lwFfgP7q0u5LzYu5IHEQz+moTPm67eiVbNP8jvxisTOsI5Ma9EXK0h13/GmZJTgMnl +Onr6bFvSPfXY+9YSNs3mbaMYQKyYOx/Nun1R1AIDyUetdtqqChqnXG7/1EIZeZJwG+h AoYjZMrLCixc4B2+nEQHEZhYmkVUgGuEFxsGPd1u8CQiLy2L6AQ8e4C5sS5mdW24AHni L423xnfJL3YVYLmXGSdDIk0Rk/t8gmiLBSeHvfIrZebXL+l1ni5cFPFsMcSjyofPyV6m rZrGDRGPqN0mT60S1tgbFGUZi4IjDSYnD6UJGS6q6bGnrTlVviriUNh9zl3/vfCBifys 8g/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=mxz8+ilE2NjB6kYVNyYap8z20EWNc89Zq7z80dHig9g=; b=KRYv6ZB2yZMDXFkMpUphmIi46dz1lZmro4m9g2/U4ADSIFvSFsnjKGJNW2qEvICBle GlObyh8GkHEsk9lpRhBDXjPiSUOl0F7fqzEVWWcppvbSEDG3Ae/NAlSIr/mO1afWFXOP jutapZD4Hwyrj26DwOWdOQq+LsbUmrPqa7brFk3l12ydF7F0Lxdg7bBVHZ53Dquzcboo tz75niZ9RPZBkhajtz2jrSAfVBE8DjV/PR35gbVRHJf8PskYnROhGLLbgjGiE9KNGWNV q5JQIqc3Yh3MPgqm521QkP5jvIrkKg3qMa15SzBRn+W3Dr1eIEuKO9kfGT4lPlXsFZLg Gxig== X-Gm-Message-State: ANhLgQ3Jm+nXg8cBh5FLiccHLMZfZG/aMfckLjAm472AiNsiZ6p/Q6FC m6Rw5A2LLLU1oJM+fcrJvBKmqA== X-Google-Smtp-Source: ADFU+vv/J6W+8sMVirHWEM1E3vhMlYyC18B4Hdl1cCEW5yYGJgHZTGUu0teFlFTlPWijkILtA2tP2g== X-Received: by 2002:a1c:b4c6:: with SMTP id d189mr4433247wmf.132.1585304491231; Fri, 27 Mar 2020 03:21:31 -0700 (PDT) Received: from dell ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id n9sm7646671wru.50.2020.03.27.03.21.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2020 03:21:30 -0700 (PDT) Date: Fri, 27 Mar 2020 10:22:21 +0000 From: Lee Jones To: saravanan sekar Cc: robh+dt@kernel.org, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, sre@kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-pm@vger.kernel.org Subject: Re: [PATCH v4 2/5] mfd: mp2629: Add support for mps battery charger Message-ID: <20200327102221.GA3383@dell> References: <20200322224626.13160-1-sravanhome@gmail.com> <20200322224626.13160-3-sravanhome@gmail.com> <20200327075541.GF603801@dell> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Saravanan, Jonathan, On Fri, 27 Mar 2020, saravanan sekar wrote: > On 27/03/20 8:55 am, Lee Jones wrote: > > On Sun, 22 Mar 2020, Saravanan Sekar wrote: > > > > > mp2629 is a highly-integrated switching-mode battery charge management > > > device for single-cell Li-ion or Li-polymer battery. > > > > > > Add MFD core enables chip access for ADC driver for battery readings, > > > and a power supply battery-charger driver > > > > > > Signed-off-by: Saravanan Sekar > > > --- > > > drivers/mfd/Kconfig | 9 +++ > > > drivers/mfd/Makefile | 2 + > > > drivers/mfd/mp2629.c | 116 +++++++++++++++++++++++++++++++++++++ > > > include/linux/mfd/mp2629.h | 22 +++++++ > > > 4 files changed, 149 insertions(+) > > > create mode 100644 drivers/mfd/mp2629.c > > > create mode 100644 include/linux/mfd/mp2629.h [...] > > > +static int mp2629_probe(struct i2c_client *client) > > > +{ > > > + struct mp2629_info *info; > > Call this ddata instead of info. > Not sure the reason, I will do. Because this is device data. Info is too loose of a definition. > > > + struct resource *resources; > > > + int ret; > > > + int i; > > > + > > > + info = devm_kzalloc(&client->dev, sizeof(*info), GFP_KERNEL); > > > + if (!info) > > > + return -ENOMEM; > > > + > > > + info->dev = &client->dev; > > > + i2c_set_clientdata(client, info); > > > + > > > + info->regmap = devm_regmap_init_i2c(client, &mp2629_regmap_config); > > > + if (IS_ERR(info->regmap)) { > > > + dev_err(info->dev, "Failed to allocate regmap!\n"); > > > + return PTR_ERR(info->regmap); > > > + } > > > + > > > + for (i = 0; i < MP2629_MFD_MAX; i++) { > > > + mp2629mfd[i].platform_data = &info->regmap; > > > + mp2629mfd[i].pdata_size = sizeof(info->regmap); > > You don't need to store this in platform data as well. > > > > You already have it in device data (ddata [currently 'info']). > > "The IIO parts seems fine (minor comments inline) but I'm not keep on > directly accessing the internals of the mfd device info structure. > To my mind that should be opaque to the child drivers so as to provide > clear structure to any such accesses. > > This mess in layering with the children directly using the parents > regmap is a little concerning. It means that the 3 drivers > really aren't very well separated and can't really be reviewed > independently (not a good thing)." > > This is the review comments form Jonathan on V2, not to access parent data > structure directly. > Am I misunderstood his review comments? please suggest the better option to > follow as like in V2 > or V2 + some improvements or V4 + improvements? I will take this up with Jonathan separately if necessary. For your FYI (and Jonathan if he's Cc'ed), it's very common for a child of an MFD to acquire resources from their parent. That is the point of a lot of MFDs, to obtain and register shared resources and pass them onto their offspring. There are 10's of examples of this. Things like Regmaps aren't platform data, they are device/driver data, which is usually passed though platform_set_drvdata(). [...] > > > + */ > > > + > > > +#ifndef __MP2629_H__ > > > +#define __MP2629_H__ > > > + > > > +#include > > > + > > > +struct device; > > > +struct regmap; > > Why not just add the includes? > Some more shared enum added in ADC driver Sorry? > > > +struct mp2629_info { > > > + struct device *dev; > > > + struct regmap *regmap; > > > +}; > > > + > > > +#endif -- Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog