Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2058596pxa; Mon, 24 Aug 2020 04:04:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1slsUY/dtDQ2AgGEy5CwNwfog1JOtvWyJhde5kZcsVqSdVHrLSQGP3hM1Nh0BhGC5OOSG X-Received: by 2002:a05:6402:1708:: with SMTP id y8mr679171edu.236.1598267085315; Mon, 24 Aug 2020 04:04:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598267085; cv=none; d=google.com; s=arc-20160816; b=Roi1VEisTVdc14MQZfz2+HH7w3WjOJ83N9xXM0v1LFLNcUhbrcqjRG/mc4yJOQW3F9 clxS/d+lwtPq4seRWGOVm52q4nABytSNqOaUdDu/p18mKtINMj+2HI4/TYWFQC9aCyfi jfTE6YtqqWgh+MwWoWLcUwMHBwW3qyX8hoNZU8Iy7yDyMWuaDN7Ww08M1NfokW5hDYgj SRL4Ub/OJqDGhTeBdA6+OQ+21zqyVlSgn0FdKucbeX7kCIpVWSwfxNuCZnRIi8LHOP6P XoLSviehoEzdbAcyg25zwKG/mUbjvRQw4d32i4HK8vZ5QKinm0CfVauEzAmCa+AGeEK5 vB9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=cz3Yth4pgA0Y949k3MpGeGexLLNoJQJmlHVKz92kPx0=; b=OUfXDhjgIMKcWpuCM86G/hxHc1V3rBHpAJzM/tPFTU4X6QGrI/7UoiFufseh5dbs03 hO2GnZCC/ZnvDQmsg1+6lElo7ThFg8NCEcltqmh6M8apZerfQvsZWyyqBibJ6hLVm2RF yE6U9QUKYduV9g5XVkXAJBvGtUxL9RZac1KiaoMQklLdEMypXIvVy0YypL83mAus1Og9 W6m7M4miSioPSkNHK2Pcd3XVgC2NcO1imPparKRgw94UIE6TkZcBW92aqMYNQfdeW0jN F3KKc9w+bK6TLZvFB2+63mP+GxaQq3Mo3vtRkCTruByzlduqAg5LAirRAaOs/ggxSkTU g4Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=e23Bob6o; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o25si4202532edq.502.2020.08.24.04.04.21; Mon, 24 Aug 2020 04:04:45 -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=@kernel.org header.s=default header.b=e23Bob6o; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727066AbgHXLB3 (ORCPT + 99 others); Mon, 24 Aug 2020 07:01:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:50674 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726483AbgHXLBU (ORCPT ); Mon, 24 Aug 2020 07:01:20 -0400 Received: from localhost (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 560C2206B5; Mon, 24 Aug 2020 11:01:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598266879; bh=6SZzRMN5GGlyh79co29gSLTZO76H+8JYL5VE28sGF20=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=e23Bob6o6Xo0hBCl442jnXgXQlakT98GnZpvR/3dAMkOWhgYz0m51RsIAvILsTzlg 1qScDMQv4rSd6Go0kH9xUQkOIomoMoFi6WN0w2dPPPhCgmOPc0yvIWeU2vNQ8w2qfJ vRNQJmC6J0WQWl1hlDoM4WBydqnrrehLjrrRhP2Y= Date: Mon, 24 Aug 2020 12:00:45 +0100 From: Mark Brown To: Cristian Ciocaltea 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: <20200824110045.GA4676@sirena.org.uk> References: <8da70f0b19de17fb8edead7ff06461ae2451b0e9.1598043782.git.cristian.ciocaltea@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="2fHTh5uZTiUOsy+g" Content-Disposition: inline In-Reply-To: <8da70f0b19de17fb8edead7ff06461ae2451b0e9.1598043782.git.cristian.ciocaltea@gmail.com> X-Cookie: Weekend, where are you? User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --2fHTh5uZTiUOsy+g Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. > +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. --2fHTh5uZTiUOsy+g Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl9DndwACgkQJNaLcl1U h9CXoAf6AzUFwxgd0S5ClrLwTuv/z8XNl93mNAnQI+Lgte0VWytWqrO+qCtOPcAq sQgGC4jUOMfZR2vcx+UGMuCCoYjDO75ApLLyN4Z79wUeNApY/VVVoSpMCy1/yvtf wneUL9d6TNL0S/Po6/RBm0kII2vbhPcRXdJxGo1JAefjao0cc6OC7ep6OtxsnQF9 sr9aCXfvloI95sl6bc/QVaWqd5/dP7WuPINxzY6Xd20TJ4bL9gVmwv87uBdZXLZZ 8jjoAg+/7ma13fxdt7CuaGJLuXZNW+WusMKy/Bx5CqFwqpDkEPuRpA5zXXPI8/5c axFmXEOlJ7MAB8WZg4fNbeBHCsbekg== =H2HJ -----END PGP SIGNATURE----- --2fHTh5uZTiUOsy+g--