diff --git a/arch/arm/mach-msm/msm_rq_stats.c b/arch/arm/mach-msm/msm_rq_stats.c index d1538dd0e558..15896235ebb7 100644 --- a/arch/arm/mach-msm/msm_rq_stats.c +++ b/arch/arm/mach-msm/msm_rq_stats.c @@ -31,6 +31,7 @@ #include #include #include "acpuclock.h" +#include #define MAX_LONG_SIZE 24 #define DEFAULT_RQ_POLL_JIFFIES 1 @@ -206,6 +207,34 @@ static int cpu_hotplug_handler(struct notifier_block *nb, return NOTIFY_OK; } +static int system_suspend_handler(struct notifier_block *nb, + unsigned long val, void *data) +{ + switch (val) { + case PM_POST_HIBERNATION: + case PM_POST_SUSPEND: + rq_info.hotplug_disabled = 0; + case PM_HIBERNATION_PREPARE: + case PM_SUSPEND_PREPARE: + rq_info.hotplug_disabled = 1; + break; + default: + return NOTIFY_DONE; + } + return NOTIFY_OK; +} + + +static ssize_t hotplug_disable_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + unsigned int val = 0; + val = rq_info.hotplug_disabled; + return snprintf(buf, MAX_LONG_SIZE, "%d\n", val); +} + +static struct kobj_attribute hotplug_disabled_attr = __ATTR_RO(hotplug_disable); + static void def_work_fn(struct work_struct *work) { int64_t diff; @@ -310,6 +339,7 @@ static struct attribute *rq_attrs[] = { &def_timer_ms_attr.attr, &run_queue_avg_attr.attr, &run_queue_poll_ms_attr.attr, + &hotplug_disabled_attr.attr, NULL, }; @@ -358,6 +388,7 @@ static int __init msm_rq_stats_init(void) rq_info.def_timer_jiffies = DEFAULT_DEF_TIMER_JIFFIES; rq_info.rq_poll_last_jiffy = 0; rq_info.def_timer_last_jiffy = 0; + rq_info.hotplug_disabled = 0; ret = init_rq_attribs(); rq_info.init = 1; @@ -380,3 +411,16 @@ static int __init msm_rq_stats_init(void) return ret; } late_initcall(msm_rq_stats_init); + +static int __init msm_rq_stats_early_init(void) +{ + /* Bail out if this is not an SMP Target */ + if (!is_smp()) { + rq_info.init = 0; + return -ENOSYS; + } + + pm_notifier(system_suspend_handler, 0); + return 0; +} +core_initcall(msm_rq_stats_early_init); diff --git a/include/linux/rq_stats.h b/include/linux/rq_stats.h index 65d8e8fc8378..0accf3889a63 100644 --- a/include/linux/rq_stats.h +++ b/include/linux/rq_stats.h @@ -19,6 +19,7 @@ struct rq_data { unsigned long rq_poll_total_jiffies; unsigned long def_timer_last_jiffy; unsigned int def_interval; + unsigned int hotplug_disabled; int64_t def_start_time; struct attribute_group *attr_group; struct kobject *kobj;