cpuidle: governors: Remove remaining old module code
authorDaniel Lezcano <daniel.lezcano@linaro.org>
Wed, 5 Oct 2016 07:33:12 +0000 (09:33 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 21 Oct 2016 12:49:51 +0000 (14:49 +0200)
The governor's code use try_module_get() and put_module() to refcount
the governor's module. But the governors are not compiled as module.

The refcount does not prevent to switch the governor or unload
a module as they aren't compiled as modules. The code is pointless,
so remove it.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpuidle/governor.c
drivers/cpuidle/governors/ladder.c
drivers/cpuidle/governors/menu.c
include/linux/cpuidle.h

index fb9f511cca23724b4da463714bd49a8e53fba588..4e78263e34a476c2280b5c317cd054bc5d3e6c86 100644 (file)
@@ -9,7 +9,6 @@
  */
 
 #include <linux/mutex.h>
-#include <linux/module.h>
 #include <linux/cpuidle.h>
 
 #include "cpuidle.h"
@@ -53,14 +52,11 @@ int cpuidle_switch_governor(struct cpuidle_governor *gov)
        if (cpuidle_curr_governor) {
                list_for_each_entry(dev, &cpuidle_detected_devices, device_list)
                        cpuidle_disable_device(dev);
-               module_put(cpuidle_curr_governor->owner);
        }
 
        cpuidle_curr_governor = gov;
 
        if (gov) {
-               if (!try_module_get(cpuidle_curr_governor->owner))
-                       return -EINVAL;
                list_for_each_entry(dev, &cpuidle_detected_devices, device_list)
                        cpuidle_enable_device(dev);
                cpuidle_install_idle_handler();
index 63bd5a403e22f1a5e30cb633998368c60a1b384c..fe8f08948fcb1d0343024df86268b86893616252 100644 (file)
@@ -15,7 +15,6 @@
 #include <linux/kernel.h>
 #include <linux/cpuidle.h>
 #include <linux/pm_qos.h>
-#include <linux/module.h>
 #include <linux/jiffies.h>
 #include <linux/tick.h>
 
@@ -177,7 +176,6 @@ static struct cpuidle_governor ladder_governor = {
        .enable =       ladder_enable_device,
        .select =       ladder_select_state,
        .reflect =      ladder_reflect,
-       .owner =        THIS_MODULE,
 };
 
 /**
index 03d38c291de62d7f6503f13855142fb5948b64a0..d9b5b9398a0f67938c7173fa8d4d757c0d67a3ff 100644 (file)
@@ -19,7 +19,6 @@
 #include <linux/tick.h>
 #include <linux/sched.h>
 #include <linux/math64.h>
-#include <linux/module.h>
 
 /*
  * Please note when changing the tuning values:
@@ -484,7 +483,6 @@ static struct cpuidle_governor menu_governor = {
        .enable =       menu_enable_device,
        .select =       menu_select,
        .reflect =      menu_reflect,
-       .owner =        THIS_MODULE,
 };
 
 /**
index bb31373c3478bdb0ed97dcf8856d1b81ccdc76e3..15deea449edc4b24111aa4f9388cabe50e8e9f28 100644 (file)
@@ -235,8 +235,6 @@ struct cpuidle_governor {
        int  (*select)          (struct cpuidle_driver *drv,
                                        struct cpuidle_device *dev);
        void (*reflect)         (struct cpuidle_device *dev, int index);
-
-       struct module           *owner;
 };
 
 #ifdef CONFIG_CPU_IDLE