Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3468863ybt; Tue, 30 Jun 2020 03:40:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxm7+Pgblkd6Q4/S4JGIErIz87LfMJBmoNYP2c+pSyxdAHJoHoeHSwR8ISLgshmNIm0M9oJ X-Received: by 2002:a05:6402:b79:: with SMTP id cb25mr2836770edb.154.1593513608292; Tue, 30 Jun 2020 03:40:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593513608; cv=none; d=google.com; s=arc-20160816; b=YiytYd2O5i6I60bn51wDWJH0qTtmMLCHAIG9/8TXaRHj4RWVnNcyLeydoahTfLbWaH kRTHtA+PUq13QarOi0tFw+RNQInMy6uiwLHaF9cmbmlqPvVPsZodrbcKOM8iTy4/SY86 I6YpjglPwRgOvfdJhNzP4jBy7g5O/RLlz/scWrrZabzI7ISwzQoymXLxXpclx6/+RXlt lQXb5ztgt7X+s4voamKxGncEPCi7gUcX0uhnZA9QEfs0ZHgz6cdmtKa3WLWmTV3eOk1b sZKhdc6TDByGvY0Stt8SNZgfatypV5J5qxpVcw75gmbHOKjDrMFIlwNoY/kr7TslU6lY Jhuw== 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=e0TSCPZOv4QRyNHqa+/+ok2/7w5IKTzQz5BKYKd9WCo=; b=Jrh3K9BxLiRnl4z9H+c0oXFfrQlrxEauRmgfcaUTofutHZHPwu4oX0mm0lEt1pUUMZ Yfp3Npr2Dkc8GI7+IKxAkAgtT1fVdNYSdSaAsUnDVwWHQwjTAsm6A8Ym1b5u8l8gq6Pk EfT1Z/cOPIwQsS4t6sK1CtdiKidnWDBzPp0tDGYy3HHEFj5+mb8Sq6EI6lW0/qKOtPDI uaTBBU1p8iW69dsFt9sNbZwyPECywsJSXzT77VFoFRW9BHZckd+SoMpN3BavQDwC0Uwk E8z1nHhilme/ZtUBJ35s2sjIJ4nI4pb9JIdvk8vApPgsayGQ6mI/psK4UnMVkaFfgYpE k6VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gTRvgLn3; 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 dt4si1750150ejc.34.2020.06.30.03.39.45; Tue, 30 Jun 2020 03:40:08 -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=gTRvgLn3; 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 S1732536AbgF3Kii (ORCPT + 99 others); Tue, 30 Jun 2020 06:38:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:54756 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732238AbgF3Kih (ORCPT ); Tue, 30 Jun 2020 06:38:37 -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 6FEF220780; Tue, 30 Jun 2020 10:38:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593513517; bh=sWaT5wPlCVsv4sYdI+rs+JPWv5UbHcVTbh4ff8ENRtk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gTRvgLn3AmW/Hwb+XzbdricsNdY/flLuaw+gfiwC6UhXH13Q7P1JRpfjplQ25rXmc CwwL7n5ZTqY4ZKww2QsjGQNBQ0z8gYSFV4N1rzpS3HvuXK3vIJFIO+gJ3Z/NbSlDA3 F+lVpx+BmEA8d83inTWYYUNdfkW75NvcFh+ftm1Y= Date: Tue, 30 Jun 2020 11:38:34 +0100 From: Mark Brown To: Anand K Mistry Cc: linux-mediatek@lists.infradead.org, drinkcat@chromium.org, hsin-hsiung.wang@mediatek.com, Liam Girdwood , Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] regulator: mt6397: Implement of_map_mode regulator_desc function Message-ID: <20200630103834.GC5272@sirena.org.uk> References: <20200630111047.1.I05d781ac794389337a4adc2f6402f673117e2937@changeid> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="oJ71EGRlYNjSvfq7" Content-Disposition: inline In-Reply-To: <20200630111047.1.I05d781ac794389337a4adc2f6402f673117e2937@changeid> X-Cookie: Walk softly and carry a megawatt laser. 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 --oJ71EGRlYNjSvfq7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jun 30, 2020 at 11:10:51AM +1000, Anand K Mistry wrote: > Without a of_map_mode implementation, the regulator-allowed-modes > devicetree field is skipped, and attempting to change the regulator mode > results in an error: > [ 1.439165] vpca15: mode operation not allowed The modes aren't documented in the binding document, any new device tree property needs to be added to the binding document. > +static unsigned int mt6397_map_mode(unsigned int mode) > +{ > + return mode == MT6397_BUCK_MODE_AUTO ? > + REGULATOR_MODE_NORMAL : REGULATOR_MODE_FAST; > +} > + Please write normal conditional statements to improve legibility, the ternery operator has uses but they're pretty specialist. --oJ71EGRlYNjSvfq7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl77FikACgkQJNaLcl1U h9Ax/wf+IVPdecbkSUG4tbn+t4jejFDFIdL/5bQ6kkAjjxdv0pUGsaqzGjzb39hF lJRPbQqM9XhCfRalxlLtmF+YHlxQ8LwzhfrpKi9eL+5PXRW+fUWS3EluvZ6/UPWh bqne9EAunUUadAoM0Ra7rmSpDIQ7il/jm/ThdO/9EDIisUZGX8S3vUKSjlX9cafa Gz5A5k3pdQtQGhFh0QkzxVLXO5CNi6rzWxkBvfmRsSYeoUmgwrbjEdnLC51aPkbN IjgjTjohlzrU0V5zsC9OUOAneWZFqw5VJnCVC1Liczn/aYywJrcdTMoKzKMLsFJn IKQneeidUfec36uzhtIqKaBbS6EVrw== =kQiW -----END PGP SIGNATURE----- --oJ71EGRlYNjSvfq7--