Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1248754ybl; Fri, 16 Aug 2019 11:23:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9h+kTUOmfF8JjiV//NXSkJJKw46WxQJP7v6w40RUCgYNoFkBGADFAtnyCyDKhS8ROAfei X-Received: by 2002:a63:de43:: with SMTP id y3mr8998269pgi.211.1565979829158; Fri, 16 Aug 2019 11:23:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565979829; cv=none; d=google.com; s=arc-20160816; b=B6VTNcvbL5fwZMq5NZTdsAPzXLZFAHEHfgKRv2ABCOtcDLKzqlYPhumU3+ktRTBgtp /W8p5HaIxpRZY/Io7AnHZx2BFjNONNWUinbchRtmhe/HUq3bwZcDhH7UhzTbZ9MMVg3K Mvu0nXRmPWlIDtdZ/KZXpaDFYP4IATAxIG7rO5JpaEP5+1RiGIpwGZnmJ95xDfaMpkuO YpIf76LFy4lKRExomRTCwG4fhi06ghFYEetTySNVG8Xux1gSo9FtQNxnHWUSrSKWNqAj Po2pV2Mlj8x9kx/qRINq800QvY6z7HZH7jxHQB55i4FGI4PfGVWgyET5F1TCcQEwOsxt A2RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:user-agent:to:cc:from :subject:references:in-reply-to:content-transfer-encoding :mime-version:dkim-signature; bh=U0WiZycLeOug7k7mG5MZAKa2EODhri2+MEwp2T4IrQg=; b=NdSlx29QHHh3QuA/o/uIDLi0gf9Jzb+2oMVKhy3nJLkKu0Pvm68S/L1vH+Vsg3Llys KGS9kz5KAy0EQ2x/JSTgr3WcItMsMhFqUQ/GfdLFeU6WeP4ci6r8bJIWdrajlSuuWO1h q+vMVIPk0zadYxtRWzx7GDCzkdVZTDb/ku8SMZvBkApp+kLsmSg96ds+IlgoxxUjoRwP VlaxwUHjqCXZSXvKl+FCMPYziyoth05ODivdruZv1oar+YMgeSGKoeLmkKPKvvWq6HSz tvFBzb1Hbr9cunmRfTy8kQuxYe5KBVSbOzCQWuW5xXaLLSvKmi4+F/Gxym9RXd3qdCVf H/8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Adjba4Se; 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=pass (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 y22si3444322plp.59.2019.08.16.11.23.33; Fri, 16 Aug 2019 11:23:49 -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=pass header.i=@kernel.org header.s=default header.b=Adjba4Se; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727605AbfHPSXB (ORCPT + 99 others); Fri, 16 Aug 2019 14:23:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:46108 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727500AbfHPSXA (ORCPT ); Fri, 16 Aug 2019 14:23:00 -0400 Received: from kernel.org (unknown [104.132.0.74]) (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 538532077C; Fri, 16 Aug 2019 18:22:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565979779; bh=Os7RmwFmk/bvYTsc+erxUvNygEZaIVYpIKLZnm5tJQ8=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=Adjba4SejZEIRO+Ov9Lzdodd3sqIArS0Iry4f3BQyWM2DQroF9Z+U11Pbs1d/Aru1 qPxAzwjzPc5OUdkL2N6Mn5Fz4HTfMF0fh0d/R0QFfLjrWELMYOfgbsCcOieyJkPtIs IaRzYp/utbr1y9t+DUUcp8A1vEpDgVyuhnbdWEg0= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20190807223111.230846-4-saravanak@google.com> References: <20190807223111.230846-1-saravanak@google.com> <20190807223111.230846-4-saravanak@google.com> Subject: Re: [PATCH v5 3/3] OPP: Add helper function for bandwidth OPP tables From: Stephen Boyd Cc: Saravana Kannan , Georgi Djakov , vincent.guittot@linaro.org, seansw@qti.qualcomm.com, daidavid1@codeaurora.org, adharmap@codeaurora.org, Rajendra Nayak , sibis@codeaurora.org, bjorn.andersson@linaro.org, evgreen@chromium.org, kernel-team@android.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org To: "Rafael J. Wysocki" , Mark Rutland , Nishanth Menon , Rob Herring , Saravana Kannan , Viresh Kumar User-Agent: alot/0.8.1 Date: Fri, 16 Aug 2019 11:22:58 -0700 Message-Id: <20190816182259.538532077C@mail.kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Saravana Kannan (2019-08-07 15:31:11) > diff --git a/drivers/opp/core.c b/drivers/opp/core.c > index 3b7ffd0234e9..22dcf22f908f 100644 > --- a/drivers/opp/core.c > +++ b/drivers/opp/core.c > @@ -127,6 +127,29 @@ unsigned long dev_pm_opp_get_freq(struct dev_pm_opp = *opp) > } > EXPORT_SYMBOL_GPL(dev_pm_opp_get_freq); > =20 > +/** > + * dev_pm_opp_get_bw() - Gets the bandwidth corresponding to an availabl= e opp > + * @opp: opp for which frequency has to be returned for s/frequency/bandwidth/ ? > + * @avg_bw: Pointer where the corresponding average bandwidth is stor= ed. > + * Can be NULL. > + * > + * Return: Peak bandwidth in kBps corresponding to the opp, else > + * return 0 > + */ > +unsigned long dev_pm_opp_get_bw(struct dev_pm_opp *opp, unsigned long *a= vg_bw) > +{ > + if (IS_ERR_OR_NULL(opp) || !opp->available) { > + pr_err("%s: Invalid parameters\n", __func__); > + return 0; > + } > + > + if (avg_bw) > + *avg_bw =3D opp->avg_bw; > + > + return opp->rate; It deserves a comment if it stays named 'rate'. At a glance it looks like a bug. > +} > +EXPORT_SYMBOL_GPL(dev_pm_opp_get_bw); > + > /** > * dev_pm_opp_get_level() - Gets the level corresponding to an available= opp > * @opp: opp for which level value has to be returned for > @@ -299,6 +322,34 @@ unsigned long dev_pm_opp_get_suspend_opp_freq(struct= device *dev) > } > EXPORT_SYMBOL_GPL(dev_pm_opp_get_suspend_opp_freq); > =20 > +/** > + * dev_pm_opp_get_suspend_opp_bw() - Get peak bandwidth of suspend opp i= n kBps > + * @dev: device for which we do this operation > + * @avg_bw: Pointer where the corresponding average bandwidth is stor= ed. > + * Can be NULL. > + * > + * Return: This function returns the peak bandwidth of the OPP marked as > + * suspend_opp if one is available, else returns 0; Why a semicolon instead a full stop?