ARM: vexpress: Make cpuidle check for presence of SPC driver
authorJon Medhurst <tixy@linaro.org>
Wed, 25 Jul 2012 14:13:46 +0000 (15:13 +0100)
committerJon Medhurst <tixy@linaro.org>
Mon, 1 Jul 2013 10:05:12 +0000 (11:05 +0100)
The cpuidle code requires SPC hardware, so check for its presence
before initialising. This enables the cpuidle code to safely exist
in kernels run on hardware without SPC support.

Signed-off-by: Jon Medhurst <tixy@linaro.org>
arch/arm/mach-vexpress/cpuidle-tc2.c

index de66243a7ef377aa6351fb7a01fcb5c367b1e06e..3b73d4a5dc5f83897c3818b7585d7fd4508a2d51 100644 (file)
@@ -221,6 +221,11 @@ int __init tc2_idle_init(void)
        struct dentry *idle_debug, *file_debug;
        struct cpuidle_driver *drv = &tc2_idle_driver;
 
+       if (!vexpress_spc_check_loaded()) {
+               pr_info("TC2 CPUidle not registered because no SPC found\n");
+               return -ENODEV;
+       }
+
        drv->state_count = (sizeof(tc2_cpuidle_set) /
                                       sizeof(struct cpuidle_state));