thermal/drivers/core: Use governor table to initialize
[linux-2.6-microblaze.git] / drivers / thermal / thermal_core.c
index 46cfb7d..6bab66e 100644 (file)
@@ -243,36 +243,42 @@ int thermal_build_list_of_policies(char *buf)
        return count;
 }
 
-static int __init thermal_register_governors(void)
+static void __init thermal_unregister_governors(void)
 {
-       int result;
+       struct thermal_governor **governor;
 
-       result = thermal_gov_step_wise_register();
-       if (result)
-               return result;
+       for_each_governor_table(governor)
+               thermal_unregister_governor(*governor);
+}
 
-       result = thermal_gov_fair_share_register();
-       if (result)
-               return result;
+static int __init thermal_register_governors(void)
+{
+       int ret = 0;
+       struct thermal_governor **governor;
 
-       result = thermal_gov_bang_bang_register();
-       if (result)
-               return result;
+       for_each_governor_table(governor) {
+               ret = thermal_register_governor(*governor);
+               if (ret) {
+                       pr_err("Failed to register governor: '%s'",
+                              (*governor)->name);
+                       break;
+               }
 
-       result = thermal_gov_user_space_register();
-       if (result)
-               return result;
+               pr_info("Registered thermal governor '%s'",
+                       (*governor)->name);
+       }
 
-       return thermal_gov_power_allocator_register();
-}
+       if (ret) {
+               struct thermal_governor **gov;
 
-static void __init thermal_unregister_governors(void)
-{
-       thermal_gov_step_wise_unregister();
-       thermal_gov_fair_share_unregister();
-       thermal_gov_bang_bang_unregister();
-       thermal_gov_user_space_unregister();
-       thermal_gov_power_allocator_unregister();
+               for_each_governor_table(gov) {
+                       if (gov == governor)
+                               break;
+                       thermal_unregister_governor(*gov);
+               }
+       }
+
+       return ret;
 }
 
 /*