From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32EF6C41604 for ; Tue, 6 Oct 2020 10:57:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CB44D2083B for ; Tue, 6 Oct 2020 10:57:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601981862; bh=60zeaRU1xit+wfcrdW2n7n9Bnz/m2UEBztYIili/YWI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=WX153Fu4PopBTwIpJ5+a4H1PoDBl7tdXNy0zYHlK8jH3gYYRRQsYi5xl6o2Y0HaYC ECD4xtplet9ysn1inphMwfIYXdsqYMMy5tgo6Jr9p3kMBza4d+ssEEoi1MBezJBFL0 9QDMrMAbskuj1yKCNdUECamstI8bYmRRHkHHclto= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726057AbgJFK5Z (ORCPT ); Tue, 6 Oct 2020 06:57:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:57524 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725891AbgJFK5Y (ORCPT ); Tue, 6 Oct 2020 06:57:24 -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 F291A2078E; Tue, 6 Oct 2020 10:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601981860; bh=60zeaRU1xit+wfcrdW2n7n9Bnz/m2UEBztYIili/YWI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eYgtM85Xh4loYAUINwZRp0Dm+EX59Z63wDtLYbNg9sJqfcn5aEZW8MQvukrFVbza+ cAIlw9dMARhK0fj3b3yyj3J6XDUpPXzN2S8OuF5RRWV6fXqZWmreMCcrPuqFLxmd1c wr+qHeIO8A6vTrMMDvjnLzpvzrdIdg6sh1WZ7pRg= Date: Tue, 6 Oct 2020 11:56:37 +0100 From: Mark Brown To: Cristian Marussi Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, sudeep.holla@arm.com, lukasz.luba@arm.com, james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, robh@kernel.org, satyakim@qti.qualcomm.com, etienne.carriere@linaro.org Subject: Re: [PATCH 3/4] regulator: add SCMI driver Message-ID: <20201006105637.GB5259@sirena.org.uk> References: <20201005222623.1123-1-cristian.marussi@arm.com> <20201005222623.1123-4-cristian.marussi@arm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="jq0ap7NbKX2Kqbes" Content-Disposition: inline In-Reply-To: <20201005222623.1123-4-cristian.marussi@arm.com> X-Cookie: Will it improve my CASH FLOW? User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --jq0ap7NbKX2Kqbes Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Oct 05, 2020 at 11:26:22PM +0100, Cristian Marussi wrote: > - .get_voltage / .set_voltage: routed via SCMI Voltage Domain Protocol > - .get_voltage_sel/.set_voltage_sel: using regulator framework helpers You should not be implementing both of these interfaces, pick one. It looks like the direct voltage operations are the redundant ones here, while the protocol uses actual voltages to communicate with the firmware which makes the direct voltage operations a better fit it seems like the expectation is that only a limited set of voltages is supported (as is normal for the underlying physical regulators) so you want selectors. > + sreg->name = devm_kasprintf(dev, GFP_KERNEL, "%s", vinfo->name); > + sreg->desc.name = devm_kasprintf(dev, GFP_KERNEL, > + "Vscmi.%s", sreg->name); > + if (!sreg->name || !sreg->desc.name) > + return -ENOMEM; Why are we using different names here? > + num_doms = handle->voltage_ops->num_domains_get(handle); > + if (num_doms <= 0) { > + dev_err(&sdev->dev, "number of voltage domains invalid\n"); > + return num_doms ?: -EINVAL; Please write normal conditional statements to improve legibility. --jq0ap7NbKX2Kqbes Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl98TWQACgkQJNaLcl1U h9D+0wf/Ubh37zBd01Ip/uAlyqHQxeRSTr8vkFYb/cvjhQDqfkBRpeSLyJqEEnQB RWd3mf3UN05rIxmZ54qpwCLc7uNJNJ+jx57FmDYFI6GgAbNHt5c3A6ZoiTIT9Obs KLMDKtz5/ncww8bIcKDkt/Y0FPYnU7mtkji8JQZ/IqLAL4W0Af6W7329I7kOYelg MxQq+8JuU8itRYYcx8EJ5BaTGdz8YTcXpgxDQc1Uvj2CtivibdqrSfY0GbMtCjRL 09WPrusKFYLAHlvnaPV8nmFM0PKFesPblyRv/QKHF7cm6DyszDm9HE9gzB059vbO goUYheBD4knkWzJQRp98E4PprszmzQ== =gIit -----END PGP SIGNATURE----- --jq0ap7NbKX2Kqbes-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95530C4363D for ; Tue, 6 Oct 2020 10:59:31 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D54B206F7 for ; Tue, 6 Oct 2020 10:59:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="lyNaJWPq"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="eYgtM85X" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D54B206F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=C0JAblEv7hkiSAUsLpv0faH0z21nsg4umF/r5ffXZg0=; b=lyNaJWPqwscT3IyQWRpT2FOpZ MV5ZqZ5ILbih/e9rMXEvNyE0lN0fYEDZIZCazNl4RoBDj2ueP6YPKa9O8xJb+un+faVCmFCUMY2KV 0HmNbY1S0uZcw4mDChVWeNURa1JHffemL6XgRTK6Ibce2dIa2SVvEMW5gVWY9elcSMdYMBzZJQs89 jV++UcmFrjFZ5nOcQitIKhcn+E6Guzvk+WNDskK6Kp1Pptypxt10SIMcK7CnEUtgUhfbMbvnc3Gyu vw8fK1sGCHis587TVOaYDbu+PorryjmP4ibemoIV+DloeEL1i7rOLQ4+jKc5wJKe6UblemlYdn7nV ZB8N4DtWQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kPkfB-0000le-4Y; Tue, 06 Oct 2020 10:57:45 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kPkf7-0000l9-Pn for linux-arm-kernel@lists.infradead.org; Tue, 06 Oct 2020 10:57:43 +0000 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 F291A2078E; Tue, 6 Oct 2020 10:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601981860; bh=60zeaRU1xit+wfcrdW2n7n9Bnz/m2UEBztYIili/YWI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eYgtM85Xh4loYAUINwZRp0Dm+EX59Z63wDtLYbNg9sJqfcn5aEZW8MQvukrFVbza+ cAIlw9dMARhK0fj3b3yyj3J6XDUpPXzN2S8OuF5RRWV6fXqZWmreMCcrPuqFLxmd1c wr+qHeIO8A6vTrMMDvjnLzpvzrdIdg6sh1WZ7pRg= Date: Tue, 6 Oct 2020 11:56:37 +0100 From: Mark Brown To: Cristian Marussi Subject: Re: [PATCH 3/4] regulator: add SCMI driver Message-ID: <20201006105637.GB5259@sirena.org.uk> References: <20201005222623.1123-1-cristian.marussi@arm.com> <20201005222623.1123-4-cristian.marussi@arm.com> MIME-Version: 1.0 In-Reply-To: <20201005222623.1123-4-cristian.marussi@arm.com> X-Cookie: Will it improve my CASH FLOW? User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201006_065742_022549_BBC8EF30 X-CRM114-Status: GOOD ( 15.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robh@kernel.org, satyakim@qti.qualcomm.com, sudeep.holla@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, etienne.carriere@linaro.org, lukasz.luba@arm.com Content-Type: multipart/mixed; boundary="===============2654140143374701108==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============2654140143374701108== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="jq0ap7NbKX2Kqbes" Content-Disposition: inline --jq0ap7NbKX2Kqbes Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Oct 05, 2020 at 11:26:22PM +0100, Cristian Marussi wrote: > - .get_voltage / .set_voltage: routed via SCMI Voltage Domain Protocol > - .get_voltage_sel/.set_voltage_sel: using regulator framework helpers You should not be implementing both of these interfaces, pick one. It looks like the direct voltage operations are the redundant ones here, while the protocol uses actual voltages to communicate with the firmware which makes the direct voltage operations a better fit it seems like the expectation is that only a limited set of voltages is supported (as is normal for the underlying physical regulators) so you want selectors. > + sreg->name = devm_kasprintf(dev, GFP_KERNEL, "%s", vinfo->name); > + sreg->desc.name = devm_kasprintf(dev, GFP_KERNEL, > + "Vscmi.%s", sreg->name); > + if (!sreg->name || !sreg->desc.name) > + return -ENOMEM; Why are we using different names here? > + num_doms = handle->voltage_ops->num_domains_get(handle); > + if (num_doms <= 0) { > + dev_err(&sdev->dev, "number of voltage domains invalid\n"); > + return num_doms ?: -EINVAL; Please write normal conditional statements to improve legibility. --jq0ap7NbKX2Kqbes Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl98TWQACgkQJNaLcl1U h9D+0wf/Ubh37zBd01Ip/uAlyqHQxeRSTr8vkFYb/cvjhQDqfkBRpeSLyJqEEnQB RWd3mf3UN05rIxmZ54qpwCLc7uNJNJ+jx57FmDYFI6GgAbNHt5c3A6ZoiTIT9Obs KLMDKtz5/ncww8bIcKDkt/Y0FPYnU7mtkji8JQZ/IqLAL4W0Af6W7329I7kOYelg MxQq+8JuU8itRYYcx8EJ5BaTGdz8YTcXpgxDQc1Uvj2CtivibdqrSfY0GbMtCjRL 09WPrusKFYLAHlvnaPV8nmFM0PKFesPblyRv/QKHF7cm6DyszDm9HE9gzB059vbO goUYheBD4knkWzJQRp98E4PprszmzQ== =gIit -----END PGP SIGNATURE----- --jq0ap7NbKX2Kqbes-- --===============2654140143374701108== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============2654140143374701108==--