Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1529514pxb; Thu, 4 Feb 2021 15:52:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJwLnuvwBQCvBV1pAubzIr8SwpWyWbGs501OyNM/QmQf5+fMJMPuclOEff8tUWbyKHnDJ/Ug X-Received: by 2002:a17:906:3f8d:: with SMTP id b13mr1440072ejj.464.1612482720878; Thu, 04 Feb 2021 15:52:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612482720; cv=none; d=google.com; s=arc-20160816; b=CGU/3wOljPq4qursnKIyFK88Q5sKWtDNVMBgkgiIzV6TH6CIPsbAG82R0CETNrRJ/7 XmYlAaqot052vcEpsTYc5e0nboi0tRNaQ3CymCBOkb0Xs00PeM53UqfTfxwJyabtnQLD zhnzwbuisbrd5EHoNbRXtFnwwlhJoXtzxkMXz5Q79TChsa6Vr9qB1I9KqCICq/L3ATEH Y2EmZ9/JijUO3+BhbSc/qk/s/PE4uPZgNYASdFfUccEY5jbEjgTlCH/5Ki4QxgBZ0ws0 lzzymHLLezD8rKon1M2X905s/MEEcfS2RB0gHJnix/3UFV2sIwmK9el6/6LXx3zzQu9l V3vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=GLPiUGe2JfnMJOEbNg5zlg1nIqrKgmzt6+aWsIXvJ60=; b=HXmmYQnuAbudIpkIwOGvkjkiyW3hrXqxWRrtn9PYeFNeK8BSvlDlS471ZlQ6ASe/Fx mSHeL4w+vzSD0t9RDqVUFmsm5DspMQiuTSLyZgFuJT3KTnarh0GMD0fBD1i1eOH+IoBt 7gdic78125Jiwcxyy68BPlTZxGoydyzE+h9E3Jp9Zg2N0VjIWbrVs40CaCfKcmphGUKD 57gBrDeQf4RJkfscjFXvQ99fqiucKSGvF/kY5rzlDEF9dOMVbxxpYn6b+/JvrnyqTPnJ K/gKiZ7bFIJoxJi8d9pGB88XJJeW4GbJW9y5McTWTNViE0aIZ4JyOGr5iNRKSoBr2BlV 4Rng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=INwTIjT4; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y10si3586569ejp.751.2021.02.04.15.51.36; Thu, 04 Feb 2021 15:52:00 -0800 (PST) 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=@linaro.org header.s=google header.b=INwTIjT4; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235575AbhBDLXz (ORCPT + 99 others); Thu, 4 Feb 2021 06:23:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235549AbhBDLXr (ORCPT ); Thu, 4 Feb 2021 06:23:47 -0500 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 448FBC06178A for ; Thu, 4 Feb 2021 03:22:50 -0800 (PST) Received: by mail-pf1-x433.google.com with SMTP id i63so1926659pfg.7 for ; Thu, 04 Feb 2021 03:22:50 -0800 (PST) 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=GLPiUGe2JfnMJOEbNg5zlg1nIqrKgmzt6+aWsIXvJ60=; b=INwTIjT4bjYk+pdg0C5zt7VyXoUWxP1+GjvAIyHgnFZ0TtgKWo+PMoc4TVW9q0rAok Qp4dfx0Bx4EFCseDmINXsM1z0C7kLroY/viwjQIqOAiDK81KHeLvQI5emacNuLQI02Vz /Bt0zrboIoxSy4wtFS8O0Uo8D3ux6YVd9L3lN9AolCJYnnxeEqpwZAsj8NH7Qxh9fWtV eEcZ/xKhfcOqV+vaFIhPEuojiyYJDy95szcDHu6EWjAoOFSdi9TpB8Lf+XZx4EgL++gf opNG7n41Bgdn5vgIB01dM/2af+aitOynX1BlyJAEVlpcYbEthygXR0sq1DHM14CyTdom xEgQ== 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=GLPiUGe2JfnMJOEbNg5zlg1nIqrKgmzt6+aWsIXvJ60=; b=spFr7wSds2c+dNKAHwNKGGe5Z/tW3+Wfxf12OvVucBzR0MBy4KGbBi86iwP/P6e44R PyYu4OioQtJRHJ63Kvai4yBeirsjrvzjSVcTq2PnFAHXk7vMpxaaOAIxcPMBD2DlvPe9 0+jCE96Y1rJNQaptVmBMzSDn9O/ED6GX/gjqr6Zj7yEfxszLt6LYtuX6NMWjHxbZpoYS /T5bsYcQ2ot5+aJMUGcmv5gLZuwwrETBZEW4D5ZpzReuORI32KvI1yJOVa+W4lL5bUJr GfkPS5AtbHuUJ5mqe0DUPBqilfFU2LSaMu8sfTPfAkWFbzpVp8pnGDYgE/57pBnfPXzR lDBw== X-Gm-Message-State: AOAM532TU56eyknuDSNNwQGqUN+kSSRpKrs9EQIlPNLvFN/nXGPTx2GJ OAKKX2CDloRM8Jqa4cFMRYY/YA== X-Received: by 2002:a63:c501:: with SMTP id f1mr8432194pgd.1.1612437769734; Thu, 04 Feb 2021 03:22:49 -0800 (PST) Received: from localhost ([122.172.59.240]) by smtp.gmail.com with ESMTPSA id u3sm6156425pfm.144.2021.02.04.03.22.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Feb 2021 03:22:48 -0800 (PST) Date: Thu, 4 Feb 2021 16:52:46 +0530 From: Viresh Kumar To: Hsin-Yi Wang Cc: Viresh Kumar , linux-pm@vger.kernel.org, Nishanth Menon , Stephen Boyd , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Saravana Kannan Subject: Re: [PATCH v6 3/3] PM / devfreq: Add required OPPs support to passive governor Message-ID: <20210204112246.yewojjxv7sy3bhky@vireshk-i7> References: <20210204081424.2219311-1-hsinyi@chromium.org> <20210204081424.2219311-4-hsinyi@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210204081424.2219311-4-hsinyi@chromium.org> User-Agent: NeoMutt/20180716-391-311a52 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04-02-21, 16:14, Hsin-Yi Wang wrote: > From: Saravana Kannan > > Look at the required OPPs of the "parent" device to determine the OPP that > is required from the slave device managed by the passive governor. This > allows having mappings between a parent device and a slave device even when > they don't have the same number of OPPs. > > Signed-off-by: Saravana Kannan > Acked-by: MyungJoo Ham > Acked-by: Chanwoo Choi > Signed-off-by: Hsin-Yi Wang > --- > drivers/devfreq/governor_passive.c | 25 ++++++++++++++++++------- > 1 file changed, 18 insertions(+), 7 deletions(-) I have made changes to this patch as well, though I didn't wanted to do initially :) diff --git a/drivers/devfreq/governor_passive.c b/drivers/devfreq/governor_passive.c index 8fd51cc9b991..b094132bd20b 100644 --- a/drivers/devfreq/governor_passive.c +++ b/drivers/devfreq/governor_passive.c @@ -19,18 +19,16 @@ static int devfreq_passive_get_target_freq(struct devfreq *devfreq, = (struct devfreq_passive_data *)devfreq->data; struct devfreq *parent_devfreq = (struct devfreq *)p_data->parent; unsigned long child_freq = ULONG_MAX; - struct dev_pm_opp *opp, *p_opp = ERR_PTR(-ENODEV); - int i, count, ret = 0; + struct dev_pm_opp *opp, *p_opp; + int i, count; /* * If the devfreq device with passive governor has the specific method * to determine the next frequency, should use the get_target_freq() * of struct devfreq_passive_data. */ - if (p_data->get_target_freq) { - ret = p_data->get_target_freq(devfreq, freq); - return ret; - } + if (p_data->get_target_freq) + return p_data->get_target_freq(devfreq, freq); /* * If the parent and passive devfreq device uses the OPP table, @@ -56,35 +54,35 @@ static int devfreq_passive_get_target_freq(struct devfreq *devfreq, * list of parent device. Because in this case, *freq is temporary * value which is decided by ondemand governor. */ - p_opp = devfreq_recommended_opp(parent_devfreq->dev.parent, freq, 0); - if (IS_ERR(p_opp)) { - ret = PTR_ERR(p_opp); - return ret; - } - if (devfreq->opp_table && parent_devfreq->opp_table) { + p_opp = devfreq_recommended_opp(parent_devfreq->dev.parent, + freq, 0); + if (IS_ERR(p_opp)) + return PTR_ERR(p_opp); + opp = dev_pm_opp_xlate_required_opp(parent_devfreq->opp_table, devfreq->opp_table, p_opp); - if (!IS_ERR(opp)) { - *freq = dev_pm_opp_get_freq(opp); - dev_pm_opp_put(opp); - } else - ret = PTR_ERR(opp); - goto out; + dev_pm_opp_put(p_opp); + + if (IS_ERR(opp)) + return PTR_ERR(opp); + + *freq = dev_pm_opp_get_freq(opp); + dev_pm_opp_put(opp); + + return 0; } /* - * Get the OPP table's index of decided freqeuncy by governor + * Get the OPP table's index of decided frequency by governor * of parent device. */ for (i = 0; i < parent_devfreq->profile->max_state; i++) if (parent_devfreq->profile->freq_table[i] == *freq) break; - if (i == parent_devfreq->profile->max_state) { - ret = -EINVAL; - goto out; - } + if (i == parent_devfreq->profile->max_state) + return -EINVAL; /* Get the suitable frequency by using index of parent device. */ if (i < devfreq->profile->max_state) { @@ -97,10 +95,7 @@ static int devfreq_passive_get_target_freq(struct devfreq *devfreq, /* Return the suitable frequency for passive device. */ *freq = child_freq; -out: - dev_pm_opp_put(p_opp); - - return ret; + return 0; } static int devfreq_passive_notifier_call(struct notifier_block *nb, -- viresh