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=-11.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham 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 78D0EC433DF for ; Tue, 21 Jul 2020 08:21:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 58E9820B1F for ; Tue, 21 Jul 2020 08:21:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="vjv+YZ0x" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727955AbgGUIVT (ORCPT ); Tue, 21 Jul 2020 04:21:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726521AbgGUIVS (ORCPT ); Tue, 21 Jul 2020 04:21:18 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3A55C0619D7 for ; Tue, 21 Jul 2020 01:21:18 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id t15so1290618pjq.5 for ; Tue, 21 Jul 2020 01:21:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=74cnB8WV/DeG8ebhvgbl1gl2LfYmiA9yZ3/crf8NgJ8=; b=vjv+YZ0xo7bDx59HHkmJVxpxxb804vgOrNic7EXsXohB37XDmdDvAkDLDjWUHl1ryq TUR7ZVchoL9gVzggDAnFMJjJr685tDFrRySrReEc8Q2L7dC866AzXuJBLs/d98o5eZDu t+wVyYg3dIBUMtrSO12IznO74pZhxizVfwqPq48P1DIINB9DpCBfzSoxgoBGuoI8ZsPv n68AH2q4cFb+JmNO4pofnMvNzvWmUnUPwY+KmSWxADLcZBalATNrG4XBsY3voIfTQ97p GsQN9wA8nbtnVIVSwkfdVsPGiUbdbTQHZxuSDwLMQj1+CK862YkrgsnQB55LZZgw6Ipd 4pCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=74cnB8WV/DeG8ebhvgbl1gl2LfYmiA9yZ3/crf8NgJ8=; b=s5o3DmKa9U2zPAdNiFdncLceDNGvR3VFvitVdJOFyrGFWMxy42n7eXB3rsSu2s7WxF 5IIO1I8yhZmaYqNC1qAKRrwIqHcXtklz0srqF9UQIL40FWKNpqAPtt9dMihc25RzcUG9 pAbYsu0kp5Qje8keyE4zt4VpYyXjGVjSJ56m+5Mf3zekGbsybhrlZmf00wp7AuJp8tED LshyrYWd+Sn1CkpTHMiekTFhV9EsFvy0ITaMLWEu7BRMGEm3gfx7dbvv8HHtGMsoCb+a JtUlCxeD/QHvZsS6dAJwm7ucgiKO0M6pFYMjSm+SFS86A2kWUR4nrRCkdQ53LsHFbjGf 7Fjw== X-Gm-Message-State: AOAM533x99EDm9zCzZzL6ErgNmbyE0CZMq5ny+Yi1+DyT7gcl1ZVEMWW OAs4GgpfQSX7A0lT0uqgbT0mXQ== X-Google-Smtp-Source: ABdhPJw2z2+N0MEss1NXQOPpFBPqV/i3Scy9lXQPLEKMgs7UGAIGKsx3pG54CUXrYnzgC56bil3DTg== X-Received: by 2002:a17:90a:fa02:: with SMTP id cm2mr3812131pjb.52.1595319678241; Tue, 21 Jul 2020 01:21:18 -0700 (PDT) Received: from localhost ([223.179.133.67]) by smtp.gmail.com with ESMTPSA id n18sm20123125pfd.99.2020.07.21.01.21.17 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Jul 2020 01:21:17 -0700 (PDT) Date: Tue, 21 Jul 2020 13:51:11 +0530 From: Viresh Kumar To: Stephen Boyd Cc: "Andrew-sh.Cheng" , Matthias Brugger , Nishanth Menon , Viresh Kumar , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-pm@vger.kernel.org, srv_heupstream@mediatek.com Subject: Re: opp: Modify opp API, dev_pm_opp_get_freq(), find freq in opp, even it is disabled Message-ID: <20200721082111.les32oe7hrfikeew@vireshk-mac-ubuntu> References: <1595235326-6333-1-git-send-email-andrew-sh.cheng@mediatek.com> <159531934722.3847286.14813407062714740461@swboyd.mtv.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <159531934722.3847286.14813407062714740461@swboyd.mtv.corp.google.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21-07-20, 01:15, Stephen Boyd wrote: > Quoting Andrew-sh.Cheng (2020-07-20 01:55:26) > > From: "Andrew-sh.Cheng" > > > > Modify dev_pm_opp_get_freq() to return freqeuncy > > even this opp item is not available. > > So that we can get the information of disable opp items. > > > > Signed-off-by: Andrew-sh.Cheng > > --- > > drivers/opp/core.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/opp/core.c b/drivers/opp/core.c > > index eed42d6b2e6b..5213e0462382 100644 > > --- a/drivers/opp/core.c > > +++ b/drivers/opp/core.c > > @@ -118,7 +118,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_voltage); > > */ > > unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp) > > { > > - if (IS_ERR_OR_NULL(opp) || !opp->available) { > > + if (IS_ERR_OR_NULL(opp)) { > > I wonder why we even have this check. Seems like the caller deserves an > oops in this case instead of a small pr_err(). I think the reason is same as to why multiple subsystems do similar checks. While many of them don't do anything if they get a NULL pointer and simply return, which is fine to support cases where NULL is passed. But I do agree that maybe we may want to make sure opp-table or opp pointers passed are all valid all the time and so just remove these checks and let them crash. -- viresh