/* NOTE: "gov" can be NULL to specify disabled Must be called with cpuidle_lock acquired.  */
int cpuidle_switch_governor(struct cpuidle_governor *gov)
/* NOTE: "gov" can be NULL to specify disabled Must be called with cpuidle_lock acquired.  */
int cpuidle_switch_governor(struct cpuidle_governor *gov)
{
	struct cpuidle_device *dev;
	if (gov == cpuidle_curr_governor)
		return 0;
	cpuidle_uninstall_idle_handler();
	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();
		printk(KERN_INFO "cpuidle: using governor %s\n", gov->name);
	}
	return 0;
}