From mboxrd@z Thu Jan 1 00:00:00 1970 From: Viresh Kumar Subject: Re: [PATCH] cpufreq-dt: register cooling device after validating cpufreq table Date: Tue, 25 Nov 2014 16:27:44 +0530 Message-ID: References: <20141124181049.GB1449@developer> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from mail-ob0-f171.google.com ([209.85.214.171]:48482 "EHLO mail-ob0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754705AbaKYK5p (ORCPT ); Tue, 25 Nov 2014 05:57:45 -0500 Received: by mail-ob0-f171.google.com with SMTP id uz6so233456obc.2 for ; Tue, 25 Nov 2014 02:57:45 -0800 (PST) In-Reply-To: <20141124181049.GB1449@developer> Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: Eduardo Valentin Cc: Rafael Wysocki , Lists linaro-kernel , "linux-pm@vger.kernel.org" , Lukasz Majewski On 24 November 2014 at 23:40, Eduardo Valentin wrote: > Is it possible to have this registration only when we have a > cpufreq driver up and running? The reasoning is that only after we have > a way to control cpu frequencies, it makes sense to have the cpu_cooling > device. > > I am planing to have the following check in the cpu cooling code: > if (!cpufreq_get_current_driver()) { > dev_dbg(bgp->dev, "no cpufreq driver yet\n"); > return -EPROBE_DEFER; > } > > that is the way I think of checking if the cpufreq layer is ready to > have a cpu cooling on top of it. Currently, thermal drivers check this > before calling cpu cooling registration. But instead of having this > check in every driver, I would like to move it to cpu cooling. > > However, for cpufreq-dt, the registration currently happens in the > init phase, not in probe, so cpufreq driver is not registered, and thus > the check won't work. This is how the phases are present in cpufreq drivers: -> platform_init -> probe() ->cpufreq_driver->init() And the cooling device is registered in cpufreq_driver->init() and by the time ->init() is called, cpufreq_driver is valid.