Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp6362293pxu; Wed, 23 Dec 2020 23:35:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJzPFcqLk0zXyhRuaDcwTfyXV/3nqN6bMtpKK9TjWfnf2tzqg5P5vs4RWbZCNQuxB98+6Kmg X-Received: by 2002:a50:b586:: with SMTP id a6mr27737516ede.206.1608795339704; Wed, 23 Dec 2020 23:35:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608795339; cv=none; d=google.com; s=arc-20160816; b=gROWPBsiIMQMQue3TIhULWqeqJ4h0vHg7TMo/7hA8S4XOJww5zCLd8y5aVzeKjYdKm XH2qUm4sU5cqIvlgWrXfQJ3ujCZNYSijNltstLM+shuMQS4cZ+2dSoAdsKhcayMnt2VK E8ZGp41EGZGjvwXPpuVSfNWFGemr8eo0wfsNgGlAN2x8o0uLEBoToienmH8aeHEbYa1s 3mdcaBIHprtcta8N5vkMwyoeBLwHwpiNyFP5aybXebeIbsfr3Xbh/3SraKU2j7VmQ6/e d4OfgxeXlwXZ3Lygk5EpVbysu0ftaWBVHBdzvN/npzorKmLkuz6jXlQsvUVGAlEuY+78 RqWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=irTCI/vF0NkdBwIJVYrdKY08hhMbdCGPb63kIfO2o2A=; b=mp1ySZjaEtTL4FN90lktFZ2nSS7I14ddxa/0JQ497QIno+2NImFXXiZG/Fw0zb7SfN GS775vCN6DYJw3XMxCdh9rIf94RsFFKVyKBxaj5x90HLOjaiYm3GZm4edNoSnQ65m49D cPNf4YlXuB5qpuljfw+TkVYJdi+FePjlPMUolbGHfoGzB5YeEorjvwsyiIapQxmCFsTS fJ4iROvPWg98YFO1xMYU/jSh008vhLkObON9/R94wkm9l6xjUkscsy7xzlVAicP3B+2P OsG+7wZfpoWMarMW+iL4BuXWjKCErfMizyg7s5whHbvztkpHVVZdyt35Yz0s3mVWC+ul RgyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R6zumxj5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p1si13268709ejw.42.2020.12.23.23.35.17; Wed, 23 Dec 2020 23:35:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R6zumxj5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726658AbgLXHfL (ORCPT + 99 others); Thu, 24 Dec 2020 02:35:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726611AbgLXHfK (ORCPT ); Thu, 24 Dec 2020 02:35:10 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AE63C0617A6 for ; Wed, 23 Dec 2020 23:34:30 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id c5so1368699wrp.6 for ; Wed, 23 Dec 2020 23:34:30 -0800 (PST) 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=irTCI/vF0NkdBwIJVYrdKY08hhMbdCGPb63kIfO2o2A=; b=R6zumxj5qvPbaQ4pMr1SUXVtsq99ZJmEEj4kGrQD/PJTM/EI2nIJySlp+8DHxbGSya dSpv6/MBDLhv81xFenGB6ic+QB3FjIj4tUE2lU7mYqU8Md1NBpF3BHgIYeE+jodyoWuX 9cpCSF1GzKG3k/0wOLa00LPV/08zivvnLjhHEmx2/me+VVXK6fl9Tv6bh0MtiI8/ZEOd KfWVgbw93zXAs3vCR6jSpwYaHCVbGmEONWCY0ngPDPZBbKQoCx+3oKVXuY0p+Px6e2sU 5DoOBYdfZISQMaaxxIm151sRu/O1XJInWx4OIVra3M6smOXrifJLA8oJjYme9O+FDTZ1 4lNw== 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=irTCI/vF0NkdBwIJVYrdKY08hhMbdCGPb63kIfO2o2A=; b=NEkvc5KrSJMdnlilRPJun+3BkDbgV0CZI92zRsxHiOyc/fZZJ3RK4COrT/a61S6mW9 Np/divnHdE29C/ZlNIbrerpCPo289cHhq/+xqYWLOzojZN3ayCnATPIv+XtawdZBIaUe c0HjHHDXA+/DtdeHDJPd7UkAv+ivK46dAwRn4tb3iDPuofMB1JKbmdgratc+qjB98crX z/2mJYRGU09X1gHVvWfCi2QbzjkCCkCDpkIXy5IF3d7196jt2enLzAsgIXgjxeUgG5hr iQUgMjr0HSC8jplT04l9kfxacL9CrCa8/dfP2GNZt/xMH7+zSSolwV163Gh2neVGlkKF KX9g== X-Gm-Message-State: AOAM53037Gb18M4y7qD2JjHGniEHdH1HHN8uuqDLWz9EYZj/SIGpmwFN h4zEjJRcVsMaEc5lGnyX8klFcQ== X-Received: by 2002:adf:b1ca:: with SMTP id r10mr33037021wra.252.1608795269049; Wed, 23 Dec 2020 23:34:29 -0800 (PST) Received: from dell ([91.110.221.181]) by smtp.gmail.com with ESMTPSA id w18sm39857432wrn.2.2020.12.23.23.34.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 23:34:28 -0800 (PST) Date: Thu, 24 Dec 2020 07:34:26 +0000 From: Lee Jones To: Yoshihiro Shimoda Cc: "marek.vasut+renesas@gmail.com" , "matti.vaittinen@fi.rohmeurope.com" , "lgirdwood@gmail.com" , "broonie@kernel.org" , "linus.walleij@linaro.org" , "bgolaszewski@baylibre.com" , Khiem Nguyen , "linux-power@fi.rohmeurope.com" , "linux-gpio@vger.kernel.org" , "linux-renesas-soc@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v6 11/12] mfd: bd9571mwv: Make the driver more generic Message-ID: <20201224073426.GD681741@dell> References: <1608718963-21818-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> <1608718963-21818-12-git-send-email-yoshihiro.shimoda.uh@renesas.com> <20201223153928.GA681741@dell> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 24 Dec 2020, Yoshihiro Shimoda wrote: > Hi Lee, > > > From: Lee Jones, Sent: Thursday, December 24, 2020 12:39 AM > > On Wed, 23 Dec 2020, Yoshihiro Shimoda wrote: > > > From: Khiem Nguyen > > > > > > Since the driver supports BD9571MWV PMIC only, this patch makes > > > the functions and data structure become more generic so that > > > it can support other PMIC variants as well. Also remove printing > > > part name which Lee Jones suggested. > > > > > > Signed-off-by: Khiem Nguyen > > > Co-developed-by: Yoshihiro Shimoda > > > Signed-off-by: Yoshihiro Shimoda > > > Reviewed-by: Matti Vaittinen > > > --- > > > drivers/mfd/bd9571mwv.c | 89 +++++++++++++++++++++++++------------------ > > > include/linux/mfd/bd9571mwv.h | 18 +-------- > > > 2 files changed, 54 insertions(+), 53 deletions(-) > > > > Couple of small points. > > > > Remainder looks good. > > Thank you for your review! > > > > diff --git a/drivers/mfd/bd9571mwv.c b/drivers/mfd/bd9571mwv.c > > > index 49e968e..c905ab4 100644 > > > --- a/drivers/mfd/bd9571mwv.c > > > +++ b/drivers/mfd/bd9571mwv.c > > > @@ -3,6 +3,7 @@ > > > * ROHM BD9571MWV-M MFD driver > > > * > > > * Copyright (C) 2017 Marek Vasut > > > + * Copyright (C) 2020 Renesas Electronics Corporation > > > * > > > * Based on the TPS65086 driver > > > */ > > > @@ -14,6 +15,14 @@ > > > > > > #include > > > > > > +/* Driver data to distinguish bd957x variants */ > > > +struct bd957x_ddata { > > > + const struct regmap_config *regmap_config; > > > + const struct regmap_irq_chip *irq_chip; > > > > > + const struct mfd_cell *cells; > > > + int num_cells; > > > > Are you using these post-probe? > > > > If not, they're not ddata. > > I'm not using all these members post-probe. > So, I'll remove ddata. > > > > > static int bd9571mwv_probe(struct i2c_client *client, > > > - const struct i2c_device_id *ids) > > > + const struct i2c_device_id *ids) > > > { > > > - struct bd9571mwv *bd; > > > - int ret; > > > - > > > - bd = devm_kzalloc(&client->dev, sizeof(*bd), GFP_KERNEL); > > > - if (!bd) > > > - return -ENOMEM; > > > - > > > - i2c_set_clientdata(client, bd); > > > - bd->dev = &client->dev; > > > - bd->irq = client->irq; > > > + const struct bd957x_ddata *ddata; > > > + struct device *dev = &client->dev; > > > + struct regmap *regmap; > > > + struct regmap_irq_chip_data *irq_data; > > > + int ret, irq = client->irq; > > > + > > > + /* Read the PMIC product code */ > > > + ret = i2c_smbus_read_byte_data(client, BD9571MWV_PRODUCT_CODE); > > > + if (ret < 0) { > > > + dev_err(dev, "Failed to read product code\n"); > > > + return ret; > > > + } > > > > Nit: '\n' here. > > I got it. I'll add a blank line here. > > > > + switch (ret) { > > > + case BD9571MWV_PRODUCT_CODE_BD9571MWV: > > > + ddata = &bd9571mwv_ddata; > > > > Simply declare 'const struct mfd_cell *cells' locally in probe and > > assign it here instead. > > I got it. I'll also add "const struct regmap_config *regmap_config;" > and "const struct regmap_irq_chip *irq_chip;" locally in probe. If you only use them there, then yes, that's correct. -- Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog