Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1621833

Re: [PATCH 05/17] thermal: cpu_cooling: remove cpufreq_cooling_get_level()

Path csiph.com!news.redatomik.org!aioe.org!news.servidellagleba.it!bofh.it!news.nic.it!robomod
From Viresh Kumar <viresh.kumar@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH 05/17] thermal: cpu_cooling: remove cpufreq_cooling_get_level()
Date Wed, 12 Apr 2017 08:30:02 +0200
Message-ID <tvjWW-13J-3@gated-at.bofh.it> (permalink)
References <tlw93-1WG-11@gated-at.bofh.it> <tlwiJ-223-11@gated-at.bofh.it> <tv85r-1G7-7@gated-at.bofh.it>
X-Original-To Eduardo Valentin <edubezval@gmail.com>
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=FmNCb+jEY4JrjnxzEcdapZ0+nlLiBjF4zCWx5of596g=; b=R8MwtFeazDBEV5+dXwhCYAVaQSw7S6pBOSxh1QzR9MxBUGL70XgCGaxlYpY1wMklM3 KtVwCBlUh1URhVQG/q8W/5qb4S2Haz5Py/Q0n0d++KfIC/Jq/fb++q8RMd9ssQn8l8jd fasP766cq5qSoSdiOTaJmCN2EydPuXlyw4osU=
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=FmNCb+jEY4JrjnxzEcdapZ0+nlLiBjF4zCWx5of596g=; b=aUSVPN2e8M9KQD+FxT+MAcjupSLrWS9vmcwB6fOtfTGHCwbPI8ct9AvYQIqYoK6lRx a4WJRmBe7Bkas9dM7VNVdBv0GHUTzcQkcD4PRdNW372QOgmtb+Edc8/M2SMDf3v6kG0+ Ag/K8Y4ai4L0KwDSkEZ5iWT7rnWafol4ETQgjKAX9F0A47JVUVOKppluHS2UWi2c8a2h YgodyoK3V+9YA4ESdCNh4PZtrs+F9AYNeulm30+fE8mLDw3Xw0hggOSEbhhhCj1pJD/L TvIr7jn3pkPJjyDWLQNHEtaHAqGTvSycuo2bt8oEz22zUrt+P7rb9d5DiP2ybEgxqSzH gzXw==
X-Gm-Message-State AFeK/H1yAEOzOztu6DXz61dw++MQG6yWXOMRFrn9vI2kifKGiVQzB5A2iBEj2OxiQDf7v/d7
X-Received by 10.99.189.2 with SMTP id a2mr43324650pgf.85.1491978319487; Tue, 11 Apr 2017 23:25:19 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.24 (2015-08-30)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 76
Organization linux.* mail to news gateway
X-Original-Cc Rafael Wysocki <rjw@rjwysocki.net>, Javi Merino <javi.merino@kernel.org>, Zhang Rui <rui.zhang@intel.com>, Amit Daniel Kachhap <amit.kachhap@gmail.com>, linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Guittot <vincent.guittot@linaro.org>
X-Original-Date Wed, 12 Apr 2017 11:55:16 +0530
X-Original-Message-ID <20170412062516.GC5910@vireshk-i7>
X-Original-References <cover.1489639999.git.viresh.kumar@linaro.org> <707918c88ce650ea11d160e31965482cdebc9a39.1489640000.git.viresh.kumar@linaro.org> <20170411174342.GC5528@localhost.localdomain>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1621833

Show key headers only | View raw


On 11-04-17, 10:43, Eduardo Valentin wrote:
> On Thu, Mar 16, 2017 at 10:59:40AM +0530, Viresh Kumar wrote:
> > There is only one user of cpufreq_cooling_get_level() and that already
> > has pointer to the cpufreq_dev structure. It can directly call
> > get_level() instead and we can get rid of cpufreq_cooling_get_level().
> > 
> > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> > ---
> >  drivers/thermal/cpu_cooling.c | 33 +--------------------------------
> >  include/linux/cpu_cooling.h   |  6 ------
> >  2 files changed, 1 insertion(+), 38 deletions(-)
> > 
> > diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
> > index e2931c20c309..99dc6833de75 100644
> > --- a/drivers/thermal/cpu_cooling.c
> > +++ b/drivers/thermal/cpu_cooling.c
> > @@ -137,37 +137,6 @@ static unsigned long get_level(struct cpufreq_cooling_device *cpufreq_dev,
> >  }
> >  
> >  /**
> > - * cpufreq_cooling_get_level - for a given cpu, return the cooling level.
> > - * @cpu: cpu for which the level is required
> > - * @freq: the frequency of interest
> > - *
> > - * This function will match the cooling level corresponding to the
> > - * requested @freq and return it.
> > - *
> > - * Return: The matched cooling level on success or THERMAL_CSTATE_INVALID
> > - * otherwise.
> > - */
> > -unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq)
> > -{
> > -	struct cpufreq_cooling_device *cpufreq_dev;
> > -
> > -	mutex_lock(&cooling_list_lock);
> > -	list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) {
> > -		if (cpumask_test_cpu(cpu, &cpufreq_dev->allowed_cpus)) {
> > -			unsigned long level = get_level(cpufreq_dev, freq);
> > -
> > -			mutex_unlock(&cooling_list_lock);
> > -			return level;
> > -		}
> > -	}
> > -	mutex_unlock(&cooling_list_lock);
> > -
> > -	pr_err("%s: cpu:%d not part of any cooling device\n", __func__, cpu);
> > -	return THERMAL_CSTATE_INVALID;
> > -}
> > -EXPORT_SYMBOL_GPL(cpufreq_cooling_get_level);
> > -
> > -/**
> >   * cpufreq_thermal_notifier - notifier callback for cpufreq policy change.
> >   * @nb:	struct notifier_block * with callback info.
> >   * @event: value showing cpufreq event for which this function invoked.
> > @@ -698,7 +667,7 @@ static int cpufreq_power2state(struct thermal_cooling_device *cdev,
> >  	normalised_power = (dyn_power * 100) / last_load;
> >  	target_freq = cpu_power_to_freq(cpufreq_dev, normalised_power);
> >  
> > -	*state = cpufreq_cooling_get_level(cpu, target_freq);
> > +	*state = get_level(cpufreq_dev, target_freq);
> 
> Did I miss something or we are loosing semantics here?

I just got rid of an unnecessary wrapper routine. That's it. There shouldn't be
any functional change after this patch.

> I guess the idea at this point is to get the level corresponding to the
> frequency on a specific cpu. Let's have a look on get_level()..
> 
> I guess now we can rely on the freq table held in the
> cpufreq_cooling_device..

I am not sure I understood your concerns here :(

-- 
viresh

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH 05/17] thermal: cpu_cooling: remove  cpufreq_cooling_get_level() Eduardo Valentin <edubezval@gmail.com> - 2017-04-11 19:50 +0200
  Re: [PATCH 05/17] thermal: cpu_cooling: remove  cpufreq_cooling_get_level() Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-12 08:30 +0200

csiph-web