aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Gortmaker <paul.gortmaker@windriver.com>2016-06-17 01:28:33 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-06-22 21:12:32 -0400
commit02c4fae9ea68fc41ebe871c635408daa2ba37d2e (patch)
tree3fe4288906d1545b1397e82df99ddf604cae0f6f
parent4a14e48fa79282df224afdfc716245e854823d5b (diff)
drivers/idle: make intel_idle.c driver more explicitly non-modular
The Kconfig for this driver is currently declared with: config INTEL_IDLE bool "Cpuidle Driver for Intel Processors" ...meaning that it currently is not being built as a module by anyone. This was done in commit 6ce9cd8669fa1195fdc21643370e34523c7ac988 ("intel_idle: disable module support") since "...the module capability is cauing more trouble than it is worth." This was done over 5y ago, and Daniel adds that: ...the modular support has been removed from almost all the cpuidle drivers and the cpuidle framework is no longer assuming driver could be unloaded. Removing the modular dead code in the driver makes sense as this what have been done in the others drivers. So lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only. Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit. At a later date we might want to consider whether subsys_init or another init category seems more appropriate than device_init. We replace module.h with moduleparam.h since the file does declare some module parameters, and leaving them as such is currently the easiest way to remain compatible with existing boot arg use cases. Note that MODULE_DEVICE_TABLE is a no-op for non-modular code. Also note that we can't remove intel_idle_cpuidle_devices_uninit() as that is still used for unwind purposes if the init fails. We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Len Brown <len.brown@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/idle/intel_idle.c41
1 files changed, 8 insertions, 33 deletions
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index b5dd41d13d3d..4c8b23d1a928 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -46,8 +46,6 @@
46 * to avoid complications with the lapic timer workaround. 46 * to avoid complications with the lapic timer workaround.
47 * Have not seen issues with suspend, but may need same workaround here. 47 * Have not seen issues with suspend, but may need same workaround here.
48 * 48 *
49 * There is currently no kernel-based automatic probing/loading mechanism
50 * if the driver is built as a module.
51 */ 49 */
52 50
53/* un-comment DEBUG to enable pr_debug() statements */ 51/* un-comment DEBUG to enable pr_debug() statements */
@@ -60,7 +58,7 @@
60#include <linux/sched.h> 58#include <linux/sched.h>
61#include <linux/notifier.h> 59#include <linux/notifier.h>
62#include <linux/cpu.h> 60#include <linux/cpu.h>
63#include <linux/module.h> 61#include <linux/moduleparam.h>
64#include <asm/cpu_device_id.h> 62#include <asm/cpu_device_id.h>
65#include <asm/intel-family.h> 63#include <asm/intel-family.h>
66#include <asm/mwait.h> 64#include <asm/mwait.h>
@@ -1055,7 +1053,6 @@ static const struct x86_cpu_id intel_idle_ids[] __initconst = {
1055 ICPU(INTEL_FAM6_ATOM_GOLDMONT, idle_cpu_bxt), 1053 ICPU(INTEL_FAM6_ATOM_GOLDMONT, idle_cpu_bxt),
1056 {} 1054 {}
1057}; 1055};
1058MODULE_DEVICE_TABLE(x86cpu, intel_idle_ids);
1059 1056
1060/* 1057/*
1061 * intel_idle_probe() 1058 * intel_idle_probe()
@@ -1416,34 +1413,12 @@ static int __init intel_idle_init(void)
1416 1413
1417 return 0; 1414 return 0;
1418} 1415}
1416device_initcall(intel_idle_init);
1419 1417
1420static void __exit intel_idle_exit(void) 1418/*
1421{ 1419 * We are not really modular, but we used to support that. Meaning we also
1422 struct cpuidle_device *dev; 1420 * support "intel_idle.max_cstate=..." at boot and also a read-only export of
1423 int i; 1421 * it at /sys/module/intel_idle/parameters/max_cstate -- so using module_param
1424 1422 * is the easiest way (currently) to continue doing that.
1425 cpu_notifier_register_begin(); 1423 */
1426
1427 if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE)
1428 on_each_cpu(__setup_broadcast_timer, (void *)false, 1);
1429 __unregister_cpu_notifier(&cpu_hotplug_notifier);
1430
1431 for_each_possible_cpu(i) {
1432 dev = per_cpu_ptr(intel_idle_cpuidle_devices, i);
1433 cpuidle_unregister_device(dev);
1434 }
1435
1436 cpu_notifier_register_done();
1437
1438 cpuidle_unregister_driver(&intel_idle_driver);
1439 free_percpu(intel_idle_cpuidle_devices);
1440}
1441
1442module_init(intel_idle_init);
1443module_exit(intel_idle_exit);
1444
1445module_param(max_cstate, int, 0444); 1424module_param(max_cstate, int, 0444);
1446
1447MODULE_AUTHOR("Len Brown <len.brown@intel.com>");
1448MODULE_DESCRIPTION("Cpuidle driver for Intel Hardware v" INTEL_IDLE_VERSION);
1449MODULE_LICENSE("GPL");