lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 16 Oct 2012 19:44:48 +0800
From:	"hongbo.zhang" <hongbo.zhang@...aro.org>
To:	linaro-dev@...ts.linaro.org, linux-kernel@...r.kernel.org,
	linux-pm@...r.kernel.org
Cc:	patches@...aro.org, linaro-kernel@...ts.linaro.org,
	STEricsson_nomadik_linux@...t.st.com, kernel@...oocommunity.org,
	"hongbo.zhang" <hongbo.zhang@...aro.com>
Subject: [PATCH 4/5] Thermal: make sure cpufreq cooling register after cpufreq driver

From: "hongbo.zhang" <hongbo.zhang@...aro.com>

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 <hongbo.zhang@...aro.com>
---
 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 <linux/slab.h>
 #include <linux/cpu.h>
 #include <linux/cpu_cooling.h>
+#include <linux/delay.h>
 
 /**
  * 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++;
 
-- 
1.7.11.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ