cpufreq: Import {stats,time} from redbull

Change-Id: I3892fe257d4bfbc138b4fd40d3406894f38f9c5e
diff --git a/drivers/cpufreq/cpufreq_times.c b/drivers/cpufreq/cpufreq_times.c
index da6e236..3431327 100644
--- a/drivers/cpufreq/cpufreq_times.c
+++ b/drivers/cpufreq/cpufreq_times.c
@@ -15,9 +15,9 @@
 
 #include <linux/cpufreq.h>
 #include <linux/cpufreq_times.h>
-#include <linux/cputime.h>
 #include <linux/hashtable.h>
 #include <linux/init.h>
+#include <linux/jiffies.h>
 #include <linux/proc_fs.h>
 #include <linux/sched.h>
 #include <linux/seq_file.h>
@@ -157,7 +157,7 @@ static int single_uid_time_in_state_show(struct seq_file *m, void *ptr)
 	}
 
 	for (i = 0; i < uid_entry->max_state; ++i) {
-		u64 time = cputime_to_clock_t(uid_entry->time_in_state[i]);
+		u64 time = nsec_to_clock_t(uid_entry->time_in_state[i]);
 		seq_write(m, &time, sizeof(time));
 	}
 
@@ -217,8 +217,7 @@ static int uid_time_in_state_seq_show(struct seq_file *m, void *v)
 			seq_putc(m, ':');
 		}
 		for (i = 0; i < uid_entry->max_state; ++i) {
-			u64 time =
-				cputime_to_clock_t(uid_entry->time_in_state[i]);
+			u64 time = nsec_to_clock_t(uid_entry->time_in_state[i]);
 			seq_put_decimal_ull(m, " ", time);
 		}
 		if (uid_entry->max_state)
@@ -244,7 +243,7 @@ static int concurrent_time_seq_show(struct seq_file *m, void *v,
 		seq_putc(m, ':');
 
 		for (i = 0; i < num_possible_cpus; ++i) {
-			u64 time = cputime_to_clock_t(atomic64_read(&times[i]));
+			u64 time = nsec_to_clock_t(atomic64_read(&times[i]));
 
 			seq_put_decimal_ull(m, " ", time);
 		}
@@ -371,7 +370,7 @@ int proc_time_in_state_show(struct seq_file *m, struct pid_namespace *ns,
 	struct pid *pid, struct task_struct *p)
 {
 	unsigned int cpu, i;
-	cputime_t cputime;
+	u64 cputime;
 	unsigned long flags;
 	struct cpu_freqs *freqs;
 	struct cpu_freqs *last_freqs = NULL;
@@ -390,14 +389,14 @@ int proc_time_in_state_show(struct seq_file *m, struct pid_namespace *ns,
 			    p->time_in_state)
 				cputime = p->time_in_state[freqs->offset + i];
 			seq_printf(m, "%u %lu\n", freqs->freq_table[i],
-				   (unsigned long)cputime_to_clock_t(cputime));
+				   (unsigned long)nsec_to_clock_t(cputime));
 		}
 	}
 	spin_unlock_irqrestore(&task_time_in_state_lock, flags);
 	return 0;
 }
 
-void cpufreq_acct_update_power(struct task_struct *p, cputime_t cputime)
+void cpufreq_acct_update_power(struct task_struct *p, u64 cputime)
 {
 	unsigned long flags;
 	unsigned int state;
diff --git a/include/linux/cpufreq_times.h b/include/linux/cpufreq_times.h
index 3b12e17..93c0dbd 100644
--- a/include/linux/cpufreq_times.h
+++ b/include/linux/cpufreq_times.h
@@ -26,7 +26,7 @@ void cpufreq_task_times_alloc(struct task_struct *p);
 void cpufreq_task_times_exit(struct task_struct *p);
 int proc_time_in_state_show(struct seq_file *m, struct pid_namespace *ns,
 			    struct pid *pid, struct task_struct *p);
-void cpufreq_acct_update_power(struct task_struct *p, cputime_t cputime);
+void cpufreq_acct_update_power(struct task_struct *p, u64 cputime);
 void cpufreq_times_create_policy(struct cpufreq_policy *policy);
 void cpufreq_times_record_transition(struct cpufreq_policy *policy,
                                      unsigned int new_freq);