From patchwork Tue Oct 16 11:44:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Zhang X-Patchwork-Id: 12276 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 1CBBA214A95 for ; Tue, 16 Oct 2012 11:46:52 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id D3303A18685 for ; Tue, 16 Oct 2012 11:46:51 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so9294192iej.11 for ; Tue, 16 Oct 2012 04:46:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=Otz8VzXMGrebDktJQsR4WfKmm3IkQuLOiqVz4b6OHYE=; b=pb4s6KmVZFMDBduSabr7qJyQG5VoGTQ0HkZQuOdP08emsC/9JY/WGz94isy7IpZXxU ZE3oiP2We9PmXFecMrVXY1y205DVlrD7k2M8STwhx6Z8KLJcSW2bnksuvJ8NYDVoZtt5 Ey7y8eBdU5G1jCZkvI8WT/w7ulQpBDNgSIPsyGnUsLfOPoEstzNpnyD16nWcpuKdYTVP ZqKLNq8rJ1hSATZRlmasij/yte5ut8g2y8WmNth+khaYnhfwSjMLJoC3oMY2hZxkWnAZ EFC8y6rY02gGJqTMQpyIRu177Sn9qJQ9Ksz75294fjad5c+33FCze6vByj0D1kJ+1qo4 BZcA== Received: by 10.50.46.226 with SMTP id y2mr11433328igm.62.1350388011603; Tue, 16 Oct 2012 04:46:51 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp714098igt; Tue, 16 Oct 2012 04:46:51 -0700 (PDT) Received: by 10.66.86.129 with SMTP id p1mr1325407paz.39.1350388010995; Tue, 16 Oct 2012 04:46:50 -0700 (PDT) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by mx.google.com with ESMTPS id c5si26017677paz.157.2012.10.16.04.46.50 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 16 Oct 2012 04:46:50 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.50 is neither permitted nor denied by best guess record for domain of hongbo.zhang@linaro.org) client-ip=209.85.220.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.50 is neither permitted nor denied by best guess record for domain of hongbo.zhang@linaro.org) smtp.mail=hongbo.zhang@linaro.org Received: by mail-pa0-f50.google.com with SMTP id hz11so6474153pad.37 for ; Tue, 16 Oct 2012 04:46:50 -0700 (PDT) Received: by 10.68.132.165 with SMTP id ov5mr45424192pbb.105.1350388010786; Tue, 16 Oct 2012 04:46:50 -0700 (PDT) Received: from stebjsxu0148.bjs.st.com ([124.127.135.94]) by mx.google.com with ESMTPS id pv9sm10667709pbb.67.2012.10.16.04.46.42 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 16 Oct 2012 04:46:50 -0700 (PDT) From: "hongbo.zhang" To: linaro-dev@lists.linaro.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: patches@linaro.org, linaro-kernel@lists.linaro.org, STEricsson_nomadik_linux@list.st.com, kernel@igloocommunity.org, "hongbo.zhang" Subject: [PATCH 4/5] Thermal: make sure cpufreq cooling register after cpufreq driver Date: Tue, 16 Oct 2012 19:44:48 +0800 Message-Id: <1350387889-15324-5-git-send-email-hongbo.zhang@linaro.com> X-Mailer: git-send-email 1.7.11.3 In-Reply-To: <1350387889-15324-1-git-send-email-hongbo.zhang@linaro.com> References: <1350387889-15324-1-git-send-email-hongbo.zhang@linaro.com> X-Gm-Message-State: ALoCoQlg40Nx/ZH1XlcDvxv9ZMVjiZ62TiDUvNWQ/Aux4NIw7EIrnuT9pskGmRLK1kIFQZAuMwIw From: "hongbo.zhang" The cpufreq works as a cooling device, so the cooling layer should check and wait until the cpufreq driver is initialized. Signed-off-by: hongbo.zhang --- drivers/thermal/cpu_cooling.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index d196230..01aba58 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -29,6 +29,7 @@ #include #include #include +#include /** * struct cpufreq_cooling_device @@ -352,9 +353,18 @@ struct thermal_cooling_device *cpufreq_cooling_register( struct cpufreq_cooling_device *cpufreq_dev = NULL; unsigned int cpufreq_dev_count = 0, min = 0, max = 0; char dev_name[THERMAL_NAME_LENGTH]; - int ret = 0, i; + int ret = 0, to = 1000, i; struct cpufreq_policy policy; + /* make sure cpufreq driver is initialized */ + while (!cpufreq_frequency_get_table(0) && --to) + mdelay(10); + + if (!to) { + pr_err("No cpufreq driver act as cooling device.\n"); + return ERR_PTR(-ENOSYS); + } + list_for_each_entry(cpufreq_dev, &cooling_cpufreq_list, node) cpufreq_dev_count++;