Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2499377pxa; Mon, 24 Aug 2020 16:24:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1gU1m3Xx6hRQpzW8XRaWSq8g2o5UAhW5Y6rRYKUfPHa82zFiEwuLoj4tgrNJU6HyEHWcJ X-Received: by 2002:a17:906:2e43:: with SMTP id r3mr7624337eji.232.1598311467511; Mon, 24 Aug 2020 16:24:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598311467; cv=none; d=google.com; s=arc-20160816; b=YD+GSCCN1zGfdSQlZglcxvsQWm0Y+m8XSXdMK03r5iNcf6RBIR5My4z88GMlXU2uuS irf1I7xzZEvAjvd9WhkV4kj+FHm9A0Yfx38uQfWb+C9IzvpUo7x5aJKS/U4679GaA508 ix2r0ey1XBNk6E0D7gciIElD4O4FfnyN+J6CJhL77Dsyb4GUs45+i7woGGqvYcc08vj4 0xgJTgnvPCkgdjxvhRjamusgQj7VnIjUg7reGa+HI/JL4cLtxJM+xLGouM6psnxeva6J 9s/6DPTWs6dQaKnTjQNnBaCm2ajxkxmyZLafb0qzVRF0HovoZv1vs9Hhk1kC7X2UQ0eb iqUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=IMKGdqUT+Wm0EM2slFZGgokEf7SVcwurGsjspfBC4Vw=; b=KDUdWZ29ZEmn9VtTBemzz3AnYKFzEYWIFD+wojGLm/LJp2+a6ZVBM7AOHfiWmmPmtf k8jzD750PKwHDb/lTa0upgdgC3RbLVHJ+lfRF7weLt15Kx3VCRQrofFOJ1w1jcIshWW8 PAG57Wsqy7j7hix8nHr8jZ0P3842l7uKLOZCKpnmH89nCwg49Q3i1nqId4+SNe9aHSfR vh0UcKKCzA6fJuWxmVoX0Ukovbqm8EdbgWxLLXIShymR2UWxp9UidAWVQ8UKUo8xOXAh LtAgEhXAI1pdjzcLbcKKNUF/pEITovnfm8kfTUMIV0hQ6e6lVQS4lbBvXzpQiGbA3En2 LdRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rD8Vonqj; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qk25si7829802ejb.404.2020.08.24.16.24.04; Mon, 24 Aug 2020 16:24:27 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=rD8Vonqj; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728213AbgHXXXQ (ORCPT + 99 others); Mon, 24 Aug 2020 19:23:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726090AbgHXXXP (ORCPT ); Mon, 24 Aug 2020 19:23:15 -0400 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27FA8C061574; Mon, 24 Aug 2020 16:23:15 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id l63so6548263edl.9; Mon, 24 Aug 2020 16:23:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=IMKGdqUT+Wm0EM2slFZGgokEf7SVcwurGsjspfBC4Vw=; b=rD8Vonqj5fif4pBYbR9r7Vi70mcoVG/5u1oM018c4xJ2uhNW3MvdLEerdf0N/naDEZ E1j/y+v02nbdqyN2pY5wd1o6wcGWzIeH7pgJ70Rbdc6P4LBXrzv5iT00Pf7bBkmTN4RC qe/bZzHGf/UATzFlwIpqJpcKCHUKKobTQoLT5s4jWqw4I5S4s51HXn0EY/oBaMsVjl5n VgBKf9y1b86K4TlY/K3cGAqsEy+Yx1ZETfLYtASnEEqMf9xmm9hR0cHIqi5tHlbujfll ISZicku4izGO/b/Sii+ttgpCCXKkj7wQ9uDQ/QydAk8qPN9dMcVcFMqTY5Ql8zrMsxlX LGQg== 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:in-reply-to; bh=IMKGdqUT+Wm0EM2slFZGgokEf7SVcwurGsjspfBC4Vw=; b=pH71E5I4OtGVRSAR3dmRnsT4T2s5l9UAvL7KCVbG+ENInnxhoXS2kjXcC7B6XdnxGM zcdkEGwoc7nZzItqgOjZhIP5PSn0HujvPZPtgm0lYhSnIkZMOJ1ndBYOHdUbumihCSe3 PMYabwK8rruLE/jH8ZC2xzR/0qYAb/RDIcmdyZggdptyWqqCB7s2oJb37K4wexeyNs8u xYUhOOpTuGsEEfQtD8amHXiNXfDTffJkW7Oyyb57qoGfPQKXVSz7oN+CAZXtgVf3MqB4 +w0HYDSGGT9RvxjPDpKMKBpq7P4CA/Tfc1M3+OpBBPvbhOcijvBjNYY1MgEEOt2A5GYz EuiQ== X-Gm-Message-State: AOAM530bdXoswRb8/oa87pHcKWKxxiory/1fyb1vmmzWGim0fyLD7WVi H0EittbjEeFZg3uMvHtxDMw= X-Received: by 2002:a50:c38b:: with SMTP id h11mr7783148edf.308.1598311393688; Mon, 24 Aug 2020 16:23:13 -0700 (PDT) Received: from BV030612LT ([188.24.159.61]) by smtp.gmail.com with ESMTPSA id j3sm11691701eje.75.2020.08.24.16.23.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2020 16:23:13 -0700 (PDT) Date: Tue, 25 Aug 2020 02:23:10 +0300 From: Cristian Ciocaltea To: Mark Brown Cc: Lee Jones , Rob Herring , Dmitry Torokhov , Sebastian Reichel , Liam Girdwood , Manivannan Sadhasivam , Andreas =?iso-8859-1?Q?F=E4rber?= , linux-actions@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-pm@vger.kernel.org Subject: Re: [PATCH v2 3/6] regulator: Add regulator driver for ATC260x PMICs Message-ID: <20200824232310.GA2301286@BV030612LT> References: <8da70f0b19de17fb8edead7ff06461ae2451b0e9.1598043782.git.cristian.ciocaltea@gmail.com> <20200824110045.GA4676@sirena.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200824110045.GA4676@sirena.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mark, Thanks for reviewing! On Mon, Aug 24, 2020 at 12:00:45PM +0100, Mark Brown wrote: > On Sat, Aug 22, 2020 at 01:19:49AM +0300, Cristian Ciocaltea wrote: > > > +static int atc260x_set_voltage_time_sel(struct regulator_dev *rdev, > > + unsigned int old_selector, > > + unsigned int new_selector) > > +{ > > + struct atc260x_regulator_data *data = rdev_get_drvdata(rdev); > > + int id = rdev_get_id(rdev); > > + > > + if (new_selector > old_selector) > > + return id > data->last_dcdc_reg_id ? data->voltage_time_ldo > > + : data->voltage_time_dcdc; > > Please write normal conditional statements to make things easier to > read. It also looks like this would be more robustly written by just > having separate ops for DCDCs and LDOs, this could easily break if > another device is supported in the driver. Sure, I can provide separate ops, but in this case we duplicate almost all of them. If this is not acceptable, then I will just rewrite the conditional statement. > > +static const struct of_device_id atc260x_regulator_of_match[] = { > > + { .compatible = "actions,atc2603c-regulator" }, > > + { .compatible = "actions,atc2609a-regulator" }, > > + { /* sentinel */ } > > +}; > > +MODULE_DEVICE_TABLE(of, atc260x_regulator_of_match); > > We don't need compatibles here, this is just reflecting the current > Linux device model into the OS neutral DT bindings. Another OS may > choose to split regulators up differently. We should just instantiate > the regulator device from the MFD based on identifying the chip overall. I have actually seen this in some MFD drivers I had been studying before starting this work. I wasn't sure what is the rationale behind, I assumed they have just an informative purpose. So, if I understand correctly, this approach is deprecated now and I should remove the compatibles from both the function driver and the corresponding mfd_cell in the core implementation. And not only for regulators, but for all the other functions of the MFD device. Regards, Cristi