Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3670265imm; Mon, 2 Jul 2018 03:31:21 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK204OC9SL7BFUXzvEL+XOUJKLruXi6BO5jwk/gRXnaJsb/uSxASBZQjG5zr9Poufdc+LAv X-Received: by 2002:a17:902:8604:: with SMTP id f4-v6mr24934982plo.4.1530527481809; Mon, 02 Jul 2018 03:31:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530527481; cv=none; d=google.com; s=arc-20160816; b=RgdNGcexK0SgwtTvccTp+jKRCWf2U6jbOevVkyXq007euIpDBNMchJzIw+MbdkWXq6 Rkjzxhl3C6Up5J3SfL+S/HdnlqSYVNq+s/OJO2oAAuNDBLJUO/tllJIVU4AXCn5FIzvc FPQ7Dz4YsK63FgQR0LWHQVQ8/1g4v6e0sAtOPxyIiFSA0FDoAHZe5iatnW28+9KXUVxG tSlk5FTgOqV+4JGex9L5Q8XXPfJIW8KIxEiGpdAXKY4J++cf0Tz8jd7L8a/bkRBvziu9 H69oyD4sDeawCjqBbaKQNwfZD6zZnBupEtH9SNx8LYZmDE+GtYNQC4Ae0HBFaJB0kGY1 ceAw== 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:arc-authentication-results; bh=ycPjBgTgiAj4oD8+DTIRjumu5DvUjM2BRQiTEdSiUWE=; b=P7rJYPdb2AQk37UKAIxfJ6YiXWlwF+FKMd2GkM1Din/Z+IrB1ScLHNyVIPidI6aYUB Rc4gGPRVnvp4nONB/cEVR+jAqKJpbvEiNx5aoqIxFM8SfPo0th4dGdTIjHRryButyhgn nN2t2Pn+Z9R8QFtpVuua8JHem6AgkDpDUMpWDyZX/pnrIfihF6PLhPHUaStBgA0/eHVJ ZVXCfdA1js4t9uAv6TuCYykHWY+kNxt6mtCGq8YL5w/6aQZmwYWDbfUJibIRGot+QfWK tfgCytCN2fRTywD+wfW2ikysm3FK+Q4BN7EJ1Ns1/FP/km6H+DGjvehmF4DUFnCitJfP 626A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=oK18TwR6; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v65-v6si16079234pfb.324.2018.07.02.03.31.07; Mon, 02 Jul 2018 03:31:21 -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; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=oK18TwR6; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030278AbeGBK3C (ORCPT + 99 others); Mon, 2 Jul 2018 06:29:02 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:45198 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965174AbeGBK26 (ORCPT ); Mon, 2 Jul 2018 06:28:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ycPjBgTgiAj4oD8+DTIRjumu5DvUjM2BRQiTEdSiUWE=; b=oK18TwR6p36UkL0wDGIAYhXJN S3ZSWROEyXHw+sxEbHqMsQkOQvt4r5K2JkqKpIh7Qo8BK4V3biBF4UP5Qr6ibDX2nQDP2Sjq0MWYM dDo/Q6VnmgSLuMJKkuT4tjudmxzJt7tKIRCLsIebmH7gRt5QaKck4BtStkcj+xW8npedc=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fZw4j-00047Y-VD; Mon, 02 Jul 2018 10:28:54 +0000 Received: from broonie by debutante with local (Exim 4.91) (envelope-from ) id 1fZw4j-0007M6-Ez; Mon, 02 Jul 2018 11:28:53 +0100 Date: Mon, 2 Jul 2018 11:28:53 +0100 From: Mark Brown To: David Collins Cc: lgirdwood@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, rnayak@codeaurora.org, sboyd@kernel.org, dianders@chromium.org, mka@chromium.org Subject: Re: [PATCH v8 2/2] regulator: add QCOM RPMh regulator driver Message-ID: <20180702102853.GI18211@sirena.org.uk> References: <35c4ea70cdf5caba560fb6f40e866ee8bc456d93.1529712888.git.collinsd@codeaurora.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="FK65GREB+Evh/hTL" Content-Disposition: inline In-Reply-To: <35c4ea70cdf5caba560fb6f40e866ee8bc456d93.1529712888.git.collinsd@codeaurora.org> X-Cookie: A good memory does not equal pale ink. User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --FK65GREB+Evh/hTL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 22, 2018 at 05:46:14PM -0700, David Collins wrote: > --- /dev/null > +++ b/drivers/regulator/qcom-rpmh-regulator.c > @@ -0,0 +1,746 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* Copyright (c) 2018, The Linux Foundation. All rights reserved. */ > + Please make the entire header block C++ so it looks intentional. > + cmd.data =3D bypassed ? PMIC4_BOB_MODE_PASS : pmic_mode; Please just write normal if statements, the ternery operator isn't really helping legibility. > +static const int pmic_mode_map_pmic4_ldo[REGULATOR_MODE_STANDBY + 1] =3D= { > + [REGULATOR_MODE_INVALID] =3D -EINVAL, > + [REGULATOR_MODE_STANDBY] =3D PMIC4_LDO_MODE_RETENTION, > + [REGULATOR_MODE_IDLE] =3D PMIC4_LDO_MODE_LPM, > + [REGULATOR_MODE_NORMAL] =3D -EINVAL, > + [REGULATOR_MODE_FAST] =3D PMIC4_LDO_MODE_HPM, > +}; This mapping is really weird, I'd expect one of the modes to correspond to the normal operating mode of the regulator. =20 > +static unsigned int rpmh_regulator_pmic4_ldo_of_map_mode(unsigned int mo= de) > +{ > + static const unsigned int of_mode_map[RPMH_REGULATOR_MODE_COUNT] =3D { > + [RPMH_REGULATOR_MODE_RET] =3D REGULATOR_MODE_STANDBY, > + [RPMH_REGULATOR_MODE_LPM] =3D REGULATOR_MODE_IDLE, > + [RPMH_REGULATOR_MODE_AUTO] =3D REGULATOR_MODE_INVALID, > + [RPMH_REGULATOR_MODE_HPM] =3D REGULATOR_MODE_FAST, > + }; Same here, based on that it looks like auto mode is a good map for normal. > + if (mode >=3D RPMH_REGULATOR_MODE_COUNT) > + return -EINVAL; Why not use ARRAY_SIZE? --FK65GREB+Evh/hTL Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAls5/mQACgkQJNaLcl1U h9AsNgf/WigCKmujnVVYbm5ON5iapR9oanwpQCSh0Iq+B/SFfWkiPB/V6a5icJs8 REO1PpgyY08Of0V6BrYSnweEhQCiPYzje6XIPomR6rSEddf6c/ga8+78LNQJxHoq K9yqW8a7pM6KG7gf/C8qUZ4d7JERXX8xlZUmniLpd9wg9Y6izxq9VNda0AvIr5Fl 9qT4hlcbXODcJEnCrWm8Sq09BsZmwK3yF2Gl8zzkSEP10XSiE1V5tzCLZqS0X07R YjwpFaPhg72qqGyXEPqFiywuzOs3vhf6ZAxg5nn9J5n4pKUW792FCRcb+mDdaaCB HTwARsp/0mY3ptkKJcDpxxwDua8YNw== =Bx5z -----END PGP SIGNATURE----- --FK65GREB+Evh/hTL--