From bcc3104291ea84d142f5c1f903dd93bfdad967d0 Mon Sep 17 00:00:00 2001 From: Sultan Qasim Khan Date: Thu, 7 Apr 2016 16:06:44 -0400 Subject: [PATCH] intelli_plug: remove powersuspend related bits --- arch/arm/hotplug/intelli_plug.c | 221 +------------------------------- drivers/md/dm-crypt.c | 10 -- 2 files changed, 1 insertion(+), 230 deletions(-) diff --git a/arch/arm/hotplug/intelli_plug.c b/arch/arm/hotplug/intelli_plug.c index 0b6eae6f6f05..59c35f1d0928 100644 --- a/arch/arm/hotplug/intelli_plug.c +++ b/arch/arm/hotplug/intelli_plug.c @@ -22,14 +22,6 @@ #include #include -#ifdef CONFIG_POWERSUSPEND -#include -#endif - -#ifdef CONFIG_HAS_EARLYSUSPEND -#include -#endif - //#define DEBUG_INTELLI_PLUG #undef DEBUG_INTELLI_PLUG @@ -340,187 +332,6 @@ static void __ref intelli_plug_work_fn(struct work_struct *work) } } -#if defined(CONFIG_POWERSUSPEND) || defined(CONFIG_HAS_EARLYSUSPEND) -static void screen_off_limit(bool on) -{ - unsigned int cpu; - struct cpufreq_policy *policy; - struct ip_cpu_info *l_ip_info; - - /* not active, so exit */ - if (screen_off_max == UINT_MAX) - return; - - for_each_online_cpu(cpu) { - l_ip_info = &per_cpu(ip_info, cpu); - policy = cpufreq_cpu_get(0); - - if (on) { - /* save current instance */ - l_ip_info->cur_max = policy->max; - policy->max = screen_off_max; - policy->cpuinfo.max_freq = screen_off_max; -#ifdef DEBUG_INTELLI_PLUG - pr_info("cpuinfo max is (on): %u %u\n", - policy->cpuinfo.max_freq, l_ip_info->sys_max); -#endif - } else { - /* restore */ - if (cpu != 0) { - l_ip_info = &per_cpu(ip_info, 0); - } - policy->cpuinfo.max_freq = l_ip_info->sys_max; - policy->max = l_ip_info->cur_max; -#ifdef DEBUG_INTELLI_PLUG - pr_info("cpuinfo max is (off): %u %u\n", - policy->cpuinfo.max_freq, l_ip_info->sys_max); -#endif - } - cpufreq_update_policy(cpu); - } -} - -void __ref intelli_plug_perf_boost(bool on) -{ - unsigned int cpu; - - if (intelli_plug_active) { - flush_workqueue(intelliplug_wq); - if (on) { - for_each_possible_cpu(cpu) { - if (!cpu_online(cpu)) - cpu_up(cpu); - } - } else { - queue_delayed_work_on(0, intelliplug_wq, - &intelli_plug_work, - msecs_to_jiffies(sampling_time)); - } - } -} - -/* sysfs interface for performance boost (BEGIN) */ -static ssize_t intelli_plug_perf_boost_store(struct kobject *kobj, - struct kobj_attribute *attr, const char *buf, - size_t count) -{ - - int boost_req; - - sscanf(buf, "%du", &boost_req); - - switch(boost_req) { - case 0: - intelli_plug_perf_boost(0); - return count; - case 1: - intelli_plug_perf_boost(1); - return count; - default: - return -EINVAL; - } -} - -static struct kobj_attribute intelli_plug_perf_boost_attribute = - __ATTR(perf_boost, 0220, - NULL, - intelli_plug_perf_boost_store); - -static struct attribute *intelli_plug_perf_boost_attrs[] = { - &intelli_plug_perf_boost_attribute.attr, - NULL, -}; - -static struct attribute_group intelli_plug_perf_boost_attr_group = { - .attrs = intelli_plug_perf_boost_attrs, -}; - -static struct kobject *intelli_plug_perf_boost_kobj; -/* sysfs interface for performance boost (END) */ - -#ifdef CONFIG_POWERSUSPEND -static void intelli_plug_suspend(struct power_suspend *handler) -#else -static void intelli_plug_suspend(struct early_suspend *handler) -#endif -{ - if (intelli_plug_active) { - int cpu; - - flush_workqueue(intelliplug_wq); - - mutex_lock(&intelli_plug_mutex); - suspended = true; - screen_off_limit(true); - mutex_unlock(&intelli_plug_mutex); - - // put rest of the cores to sleep unconditionally! - for_each_online_cpu(cpu) { - if (cpu != 0) - cpu_down(cpu); - } - } -} - -static void wakeup_boost(void) -{ - unsigned int cpu; - struct cpufreq_policy *policy; - struct ip_cpu_info *l_ip_info; - - for_each_online_cpu(cpu) { - policy = cpufreq_cpu_get(0); - l_ip_info = &per_cpu(ip_info, 0); - policy->cur = l_ip_info->cur_max; - cpufreq_update_policy(cpu); - } -} - -#ifdef CONFIG_POWERSUSPEND -static void __ref intelli_plug_resume(struct power_suspend *handler) -#else -static void __ref intelli_plug_resume(struct early_suspend *handler) -#endif -{ - - if (intelli_plug_active) { - int cpu; - - mutex_lock(&intelli_plug_mutex); - /* keep cores awake long enough for faster wake up */ - persist_count = BUSY_PERSISTENCE; - suspended = false; - mutex_unlock(&intelli_plug_mutex); - - for_each_possible_cpu(cpu) { - if (cpu == 0) - continue; - cpu_up(cpu); - } - - wakeup_boost(); - screen_off_limit(false); - } - queue_delayed_work_on(0, intelliplug_wq, &intelli_plug_work, - msecs_to_jiffies(10)); -} -#endif - -#ifdef CONFIG_POWERSUSPEND -static struct power_suspend intelli_plug_power_suspend_driver = { - .suspend = intelli_plug_suspend, - .resume = intelli_plug_resume, -}; -#endif /* CONFIG_POWERSUSPEND */ - -#ifdef CONFIG_HAS_EARLYSUSPEND -static struct early_suspend intelli_plug_early_suspend_driver = { - .level = EARLY_SUSPEND_LEVEL_DISABLE_FB + 10, - .suspend = intelli_plug_suspend, - .resume = intelli_plug_resume, -}; -#endif /* CONFIG_HAS_EARLYSUSPEND */ - static void intelli_plug_input_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) { @@ -647,11 +458,6 @@ module_param_cb(intelli_plug_active, ¶m_ops_active, int __init intelli_plug_init(void) { int rc; -#if defined (CONFIG_POWERSUSPEND) || defined(CONFIG_HAS_EARLYSUSPEND) - struct cpufreq_policy *policy; - struct ip_cpu_info *l_ip_info; -#endif - nr_possible_cores = num_possible_cpus(); pr_info("intelli_plug: version %d.%d by faux123\n", @@ -666,20 +472,8 @@ int __init intelli_plug_init(void) nr_run_profile_sel = NR_RUN_ECO_MODE_PROFILE; } -#if defined (CONFIG_POWERSUSPEND) || defined(CONFIG_HAS_EARLYSUSPEND) - l_ip_info = &per_cpu(ip_info, 0); - policy = cpufreq_cpu_get(0); - l_ip_info->sys_max = policy->cpuinfo.max_freq; - l_ip_info->cur_max = policy->max; -#endif - rc = input_register_handler(&intelli_plug_input_handler); -#ifdef CONFIG_POWERSUSPEND - register_power_suspend(&intelli_plug_power_suspend_driver); -#endif -#ifdef CONFIG_HAS_EARLYSUSPEND - register_early_suspend(&intelli_plug_early_suspend_driver); -#endif + intelliplug_wq = alloc_workqueue("intelliplug", WQ_HIGHPRI | WQ_UNBOUND, 1); intelliplug_boost_wq = alloc_workqueue("iplug_boost", @@ -689,19 +483,6 @@ int __init intelli_plug_init(void) queue_delayed_work_on(0, intelliplug_wq, &intelli_plug_work, msecs_to_jiffies(10)); - intelli_plug_perf_boost_kobj - = kobject_create_and_add("intelli_plug", kernel_kobj); - - if (!intelli_plug_perf_boost_kobj) { - return -ENOMEM; - } - - rc = sysfs_create_group(intelli_plug_perf_boost_kobj, - &intelli_plug_perf_boost_attr_group); - - if (rc) - kobject_put(intelli_plug_perf_boost_kobj); - return 0; } diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index a457cfed05c8..bd33a0d65094 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -1010,10 +1010,6 @@ static void kcryptd_io_write(struct dm_crypt_io *io) generic_make_request(clone); } -#ifdef CONFIG_INTELLI_PLUG -extern void intelli_plug_perf_boost(bool); -#endif - static int dmcrypt_write(void *data) { struct crypt_config *cc = data; @@ -1066,9 +1062,6 @@ static int dmcrypt_write(void *data) kcryptd_io_write(io); } while (!RB_EMPTY_ROOT(&write_tree)); blk_finish_plug(&plug); -#ifdef CONFIG_INTELLI_PLUG - intelli_plug_perf_boost(false); -#endif } return 0; } @@ -1685,9 +1678,6 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) ti->error = "Couldn't spawn write thread"; goto bad; } -#ifdef CONFIG_INTELLI_PLUG - intelli_plug_perf_boost(true); -#endif wake_up_process(cc->write_thread); ti->num_flush_bios = 1;