aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/cpufreq.c82
-rw-r--r--drivers/cpufreq/cpufreq_conservative.c133
-rw-r--r--drivers/cpufreq/cpufreq_ondemand.c4
3 files changed, 183 insertions, 36 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index af93a8175c5e..67bc2ece7b4b 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -41,7 +41,7 @@ static struct cpufreq_driver *cpufreq_driver;
41static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data); 41static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data);
42#ifdef CONFIG_HOTPLUG_CPU 42#ifdef CONFIG_HOTPLUG_CPU
43/* This one keeps track of the previously set governor of a removed CPU */ 43/* This one keeps track of the previously set governor of a removed CPU */
44static DEFINE_PER_CPU(struct cpufreq_governor *, cpufreq_cpu_governor); 44static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN], cpufreq_cpu_governor);
45#endif 45#endif
46static DEFINE_SPINLOCK(cpufreq_driver_lock); 46static DEFINE_SPINLOCK(cpufreq_driver_lock);
47 47
@@ -647,6 +647,21 @@ static ssize_t show_scaling_setspeed(struct cpufreq_policy *policy, char *buf)
647 return policy->governor->show_setspeed(policy, buf); 647 return policy->governor->show_setspeed(policy, buf);
648} 648}
649 649
650/**
651 * show_scaling_driver - show the current cpufreq HW/BIOS limitation
652 */
653static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf)
654{
655 unsigned int limit;
656 int ret;
657 if (cpufreq_driver->bios_limit) {
658 ret = cpufreq_driver->bios_limit(policy->cpu, &limit);
659 if (!ret)
660 return sprintf(buf, "%u\n", limit);
661 }
662 return sprintf(buf, "%u\n", policy->cpuinfo.max_freq);
663}
664
650#define define_one_ro(_name) \ 665#define define_one_ro(_name) \
651static struct freq_attr _name = \ 666static struct freq_attr _name = \
652__ATTR(_name, 0444, show_##_name, NULL) 667__ATTR(_name, 0444, show_##_name, NULL)
@@ -666,6 +681,7 @@ define_one_ro(cpuinfo_transition_latency);
666define_one_ro(scaling_available_governors); 681define_one_ro(scaling_available_governors);
667define_one_ro(scaling_driver); 682define_one_ro(scaling_driver);
668define_one_ro(scaling_cur_freq); 683define_one_ro(scaling_cur_freq);
684define_one_ro(bios_limit);
669define_one_ro(related_cpus); 685define_one_ro(related_cpus);
670define_one_ro(affected_cpus); 686define_one_ro(affected_cpus);
671define_one_rw(scaling_min_freq); 687define_one_rw(scaling_min_freq);
@@ -767,17 +783,20 @@ static struct kobj_type ktype_cpufreq = {
767 * 0: Success 783 * 0: Success
768 * Positive: When we have a managed CPU and the sysfs got symlinked 784 * Positive: When we have a managed CPU and the sysfs got symlinked
769 */ 785 */
770int cpufreq_add_dev_policy(unsigned int cpu, struct cpufreq_policy *policy, 786static int cpufreq_add_dev_policy(unsigned int cpu,
771 struct sys_device *sys_dev) 787 struct cpufreq_policy *policy,
788 struct sys_device *sys_dev)
772{ 789{
773 int ret = 0; 790 int ret = 0;
774#ifdef CONFIG_SMP 791#ifdef CONFIG_SMP
775 unsigned long flags; 792 unsigned long flags;
776 unsigned int j; 793 unsigned int j;
777
778#ifdef CONFIG_HOTPLUG_CPU 794#ifdef CONFIG_HOTPLUG_CPU
779 if (per_cpu(cpufreq_cpu_governor, cpu)) { 795 struct cpufreq_governor *gov;
780 policy->governor = per_cpu(cpufreq_cpu_governor, cpu); 796
797 gov = __find_governor(per_cpu(cpufreq_cpu_governor, cpu));
798 if (gov) {
799 policy->governor = gov;
781 dprintk("Restoring governor %s for cpu %d\n", 800 dprintk("Restoring governor %s for cpu %d\n",
782 policy->governor->name, cpu); 801 policy->governor->name, cpu);
783 } 802 }
@@ -840,7 +859,8 @@ int cpufreq_add_dev_policy(unsigned int cpu, struct cpufreq_policy *policy,
840 859
841 860
842/* symlink affected CPUs */ 861/* symlink affected CPUs */
843int cpufreq_add_dev_symlink(unsigned int cpu, struct cpufreq_policy *policy) 862static int cpufreq_add_dev_symlink(unsigned int cpu,
863 struct cpufreq_policy *policy)
844{ 864{
845 unsigned int j; 865 unsigned int j;
846 int ret = 0; 866 int ret = 0;
@@ -867,8 +887,9 @@ int cpufreq_add_dev_symlink(unsigned int cpu, struct cpufreq_policy *policy)
867 return ret; 887 return ret;
868} 888}
869 889
870int cpufreq_add_dev_interface(unsigned int cpu, struct cpufreq_policy *policy, 890static int cpufreq_add_dev_interface(unsigned int cpu,
871 struct sys_device *sys_dev) 891 struct cpufreq_policy *policy,
892 struct sys_device *sys_dev)
872{ 893{
873 struct cpufreq_policy new_policy; 894 struct cpufreq_policy new_policy;
874 struct freq_attr **drv_attr; 895 struct freq_attr **drv_attr;
@@ -900,6 +921,11 @@ int cpufreq_add_dev_interface(unsigned int cpu, struct cpufreq_policy *policy,
900 if (ret) 921 if (ret)
901 goto err_out_kobj_put; 922 goto err_out_kobj_put;
902 } 923 }
924 if (cpufreq_driver->bios_limit) {
925 ret = sysfs_create_file(&policy->kobj, &bios_limit.attr);
926 if (ret)
927 goto err_out_kobj_put;
928 }
903 929
904 spin_lock_irqsave(&cpufreq_driver_lock, flags); 930 spin_lock_irqsave(&cpufreq_driver_lock, flags);
905 for_each_cpu(j, policy->cpus) { 931 for_each_cpu(j, policy->cpus) {
@@ -949,10 +975,13 @@ err_out_kobj_put:
949static int cpufreq_add_dev(struct sys_device *sys_dev) 975static int cpufreq_add_dev(struct sys_device *sys_dev)
950{ 976{
951 unsigned int cpu = sys_dev->id; 977 unsigned int cpu = sys_dev->id;
952 int ret = 0; 978 int ret = 0, found = 0;
953 struct cpufreq_policy *policy; 979 struct cpufreq_policy *policy;
954 unsigned long flags; 980 unsigned long flags;
955 unsigned int j; 981 unsigned int j;
982#ifdef CONFIG_HOTPLUG_CPU
983 int sibling;
984#endif
956 985
957 if (cpu_is_offline(cpu)) 986 if (cpu_is_offline(cpu))
958 return 0; 987 return 0;
@@ -999,7 +1028,19 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
999 INIT_WORK(&policy->update, handle_update); 1028 INIT_WORK(&policy->update, handle_update);
1000 1029
1001 /* Set governor before ->init, so that driver could check it */ 1030 /* Set governor before ->init, so that driver could check it */
1002 policy->governor = CPUFREQ_DEFAULT_GOVERNOR; 1031#ifdef CONFIG_HOTPLUG_CPU
1032 for_each_online_cpu(sibling) {
1033 struct cpufreq_policy *cp = per_cpu(cpufreq_cpu_data, sibling);
1034 if (cp && cp->governor &&
1035 (cpumask_test_cpu(cpu, cp->related_cpus))) {
1036 policy->governor = cp->governor;
1037 found = 1;
1038 break;
1039 }
1040 }
1041#endif
1042 if (!found)
1043 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
1003 /* call driver. From then on the cpufreq must be able 1044 /* call driver. From then on the cpufreq must be able
1004 * to accept all calls to ->verify and ->setpolicy for this CPU 1045 * to accept all calls to ->verify and ->setpolicy for this CPU
1005 */ 1046 */
@@ -1111,7 +1152,8 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1111#ifdef CONFIG_SMP 1152#ifdef CONFIG_SMP
1112 1153
1113#ifdef CONFIG_HOTPLUG_CPU 1154#ifdef CONFIG_HOTPLUG_CPU
1114 per_cpu(cpufreq_cpu_governor, cpu) = data->governor; 1155 strncpy(per_cpu(cpufreq_cpu_governor, cpu), data->governor->name,
1156 CPUFREQ_NAME_LEN);
1115#endif 1157#endif
1116 1158
1117 /* if we have other CPUs still registered, we need to unlink them, 1159 /* if we have other CPUs still registered, we need to unlink them,
@@ -1135,7 +1177,8 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1135 continue; 1177 continue;
1136 dprintk("removing link for cpu %u\n", j); 1178 dprintk("removing link for cpu %u\n", j);
1137#ifdef CONFIG_HOTPLUG_CPU 1179#ifdef CONFIG_HOTPLUG_CPU
1138 per_cpu(cpufreq_cpu_governor, j) = data->governor; 1180 strncpy(per_cpu(cpufreq_cpu_governor, j),
1181 data->governor->name, CPUFREQ_NAME_LEN);
1139#endif 1182#endif
1140 cpu_sys_dev = get_cpu_sysdev(j); 1183 cpu_sys_dev = get_cpu_sysdev(j);
1141 sysfs_remove_link(&cpu_sys_dev->kobj, "cpufreq"); 1184 sysfs_remove_link(&cpu_sys_dev->kobj, "cpufreq");
@@ -1606,9 +1649,22 @@ EXPORT_SYMBOL_GPL(cpufreq_register_governor);
1606 1649
1607void cpufreq_unregister_governor(struct cpufreq_governor *governor) 1650void cpufreq_unregister_governor(struct cpufreq_governor *governor)
1608{ 1651{
1652#ifdef CONFIG_HOTPLUG_CPU
1653 int cpu;
1654#endif
1655
1609 if (!governor) 1656 if (!governor)
1610 return; 1657 return;
1611 1658
1659#ifdef CONFIG_HOTPLUG_CPU
1660 for_each_present_cpu(cpu) {
1661 if (cpu_online(cpu))
1662 continue;
1663 if (!strcmp(per_cpu(cpufreq_cpu_governor, cpu), governor->name))
1664 strcpy(per_cpu(cpufreq_cpu_governor, cpu), "\0");
1665 }
1666#endif
1667
1612 mutex_lock(&cpufreq_governor_mutex); 1668 mutex_lock(&cpufreq_governor_mutex);
1613 list_del(&governor->governor_list); 1669 list_del(&governor->governor_list);
1614 mutex_unlock(&cpufreq_governor_mutex); 1670 mutex_unlock(&cpufreq_governor_mutex);
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index bc33ddc9c97c..599a40b25cb0 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -116,9 +116,9 @@ static inline cputime64_t get_cpu_idle_time_jiffy(unsigned int cpu,
116 116
117 idle_time = cputime64_sub(cur_wall_time, busy_time); 117 idle_time = cputime64_sub(cur_wall_time, busy_time);
118 if (wall) 118 if (wall)
119 *wall = cur_wall_time; 119 *wall = (cputime64_t)jiffies_to_usecs(cur_wall_time);
120 120
121 return idle_time; 121 return (cputime64_t)jiffies_to_usecs(idle_time);;
122} 122}
123 123
124static inline cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall) 124static inline cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall)
@@ -164,20 +164,22 @@ static struct notifier_block dbs_cpufreq_notifier_block = {
164}; 164};
165 165
166/************************** sysfs interface ************************/ 166/************************** sysfs interface ************************/
167static ssize_t show_sampling_rate_max(struct cpufreq_policy *policy, char *buf) 167static ssize_t show_sampling_rate_max(struct kobject *kobj,
168 struct attribute *attr, char *buf)
168{ 169{
169 printk_once(KERN_INFO "CPUFREQ: conservative sampling_rate_max " 170 printk_once(KERN_INFO "CPUFREQ: conservative sampling_rate_max "
170 "sysfs file is deprecated - used by: %s\n", current->comm); 171 "sysfs file is deprecated - used by: %s\n", current->comm);
171 return sprintf(buf, "%u\n", -1U); 172 return sprintf(buf, "%u\n", -1U);
172} 173}
173 174
174static ssize_t show_sampling_rate_min(struct cpufreq_policy *policy, char *buf) 175static ssize_t show_sampling_rate_min(struct kobject *kobj,
176 struct attribute *attr, char *buf)
175{ 177{
176 return sprintf(buf, "%u\n", min_sampling_rate); 178 return sprintf(buf, "%u\n", min_sampling_rate);
177} 179}
178 180
179#define define_one_ro(_name) \ 181#define define_one_ro(_name) \
180static struct freq_attr _name = \ 182static struct global_attr _name = \
181__ATTR(_name, 0444, show_##_name, NULL) 183__ATTR(_name, 0444, show_##_name, NULL)
182 184
183define_one_ro(sampling_rate_max); 185define_one_ro(sampling_rate_max);
@@ -186,7 +188,7 @@ define_one_ro(sampling_rate_min);
186/* cpufreq_conservative Governor Tunables */ 188/* cpufreq_conservative Governor Tunables */
187#define show_one(file_name, object) \ 189#define show_one(file_name, object) \
188static ssize_t show_##file_name \ 190static ssize_t show_##file_name \
189(struct cpufreq_policy *unused, char *buf) \ 191(struct kobject *kobj, struct attribute *attr, char *buf) \
190{ \ 192{ \
191 return sprintf(buf, "%u\n", dbs_tuners_ins.object); \ 193 return sprintf(buf, "%u\n", dbs_tuners_ins.object); \
192} 194}
@@ -197,8 +199,40 @@ show_one(down_threshold, down_threshold);
197show_one(ignore_nice_load, ignore_nice); 199show_one(ignore_nice_load, ignore_nice);
198show_one(freq_step, freq_step); 200show_one(freq_step, freq_step);
199 201
200static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, 202/*** delete after deprecation time ***/
201 const char *buf, size_t count) 203#define DEPRECATION_MSG(file_name) \
204 printk_once(KERN_INFO "CPUFREQ: Per core conservative sysfs " \
205 "interface is deprecated - " #file_name "\n");
206
207#define show_one_old(file_name) \
208static ssize_t show_##file_name##_old \
209(struct cpufreq_policy *unused, char *buf) \
210{ \
211 printk_once(KERN_INFO "CPUFREQ: Per core conservative sysfs " \
212 "interface is deprecated - " #file_name "\n"); \
213 return show_##file_name(NULL, NULL, buf); \
214}
215show_one_old(sampling_rate);
216show_one_old(sampling_down_factor);
217show_one_old(up_threshold);
218show_one_old(down_threshold);
219show_one_old(ignore_nice_load);
220show_one_old(freq_step);
221show_one_old(sampling_rate_min);
222show_one_old(sampling_rate_max);
223
224#define define_one_ro_old(object, _name) \
225static struct freq_attr object = \
226__ATTR(_name, 0444, show_##_name##_old, NULL)
227
228define_one_ro_old(sampling_rate_min_old, sampling_rate_min);
229define_one_ro_old(sampling_rate_max_old, sampling_rate_max);
230
231/*** delete after deprecation time ***/
232
233static ssize_t store_sampling_down_factor(struct kobject *a,
234 struct attribute *b,
235 const char *buf, size_t count)
202{ 236{
203 unsigned int input; 237 unsigned int input;
204 int ret; 238 int ret;
@@ -214,8 +248,8 @@ static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused,
214 return count; 248 return count;
215} 249}
216 250
217static ssize_t store_sampling_rate(struct cpufreq_policy *unused, 251static ssize_t store_sampling_rate(struct kobject *a, struct attribute *b,
218 const char *buf, size_t count) 252 const char *buf, size_t count)
219{ 253{
220 unsigned int input; 254 unsigned int input;
221 int ret; 255 int ret;
@@ -231,8 +265,8 @@ static ssize_t store_sampling_rate(struct cpufreq_policy *unused,
231 return count; 265 return count;
232} 266}
233 267
234static ssize_t store_up_threshold(struct cpufreq_policy *unused, 268static ssize_t store_up_threshold(struct kobject *a, struct attribute *b,
235 const char *buf, size_t count) 269 const char *buf, size_t count)
236{ 270{
237 unsigned int input; 271 unsigned int input;
238 int ret; 272 int ret;
@@ -251,8 +285,8 @@ static ssize_t store_up_threshold(struct cpufreq_policy *unused,
251 return count; 285 return count;
252} 286}
253 287
254static ssize_t store_down_threshold(struct cpufreq_policy *unused, 288static ssize_t store_down_threshold(struct kobject *a, struct attribute *b,
255 const char *buf, size_t count) 289 const char *buf, size_t count)
256{ 290{
257 unsigned int input; 291 unsigned int input;
258 int ret; 292 int ret;
@@ -272,8 +306,8 @@ static ssize_t store_down_threshold(struct cpufreq_policy *unused,
272 return count; 306 return count;
273} 307}
274 308
275static ssize_t store_ignore_nice_load(struct cpufreq_policy *policy, 309static ssize_t store_ignore_nice_load(struct kobject *a, struct attribute *b,
276 const char *buf, size_t count) 310 const char *buf, size_t count)
277{ 311{
278 unsigned int input; 312 unsigned int input;
279 int ret; 313 int ret;
@@ -308,8 +342,8 @@ static ssize_t store_ignore_nice_load(struct cpufreq_policy *policy,
308 return count; 342 return count;
309} 343}
310 344
311static ssize_t store_freq_step(struct cpufreq_policy *policy, 345static ssize_t store_freq_step(struct kobject *a, struct attribute *b,
312 const char *buf, size_t count) 346 const char *buf, size_t count)
313{ 347{
314 unsigned int input; 348 unsigned int input;
315 int ret; 349 int ret;
@@ -331,7 +365,7 @@ static ssize_t store_freq_step(struct cpufreq_policy *policy,
331} 365}
332 366
333#define define_one_rw(_name) \ 367#define define_one_rw(_name) \
334static struct freq_attr _name = \ 368static struct global_attr _name = \
335__ATTR(_name, 0644, show_##_name, store_##_name) 369__ATTR(_name, 0644, show_##_name, store_##_name)
336 370
337define_one_rw(sampling_rate); 371define_one_rw(sampling_rate);
@@ -358,6 +392,53 @@ static struct attribute_group dbs_attr_group = {
358 .name = "conservative", 392 .name = "conservative",
359}; 393};
360 394
395/*** delete after deprecation time ***/
396
397#define write_one_old(file_name) \
398static ssize_t store_##file_name##_old \
399(struct cpufreq_policy *unused, const char *buf, size_t count) \
400{ \
401 printk_once(KERN_INFO "CPUFREQ: Per core conservative sysfs " \
402 "interface is deprecated - " #file_name "\n"); \
403 return store_##file_name(NULL, NULL, buf, count); \
404}
405write_one_old(sampling_rate);
406write_one_old(sampling_down_factor);
407write_one_old(up_threshold);
408write_one_old(down_threshold);
409write_one_old(ignore_nice_load);
410write_one_old(freq_step);
411
412#define define_one_rw_old(object, _name) \
413static struct freq_attr object = \
414__ATTR(_name, 0644, show_##_name##_old, store_##_name##_old)
415
416define_one_rw_old(sampling_rate_old, sampling_rate);
417define_one_rw_old(sampling_down_factor_old, sampling_down_factor);
418define_one_rw_old(up_threshold_old, up_threshold);
419define_one_rw_old(down_threshold_old, down_threshold);
420define_one_rw_old(ignore_nice_load_old, ignore_nice_load);
421define_one_rw_old(freq_step_old, freq_step);
422
423static struct attribute *dbs_attributes_old[] = {
424 &sampling_rate_max_old.attr,
425 &sampling_rate_min_old.attr,
426 &sampling_rate_old.attr,
427 &sampling_down_factor_old.attr,
428 &up_threshold_old.attr,
429 &down_threshold_old.attr,
430 &ignore_nice_load_old.attr,
431 &freq_step_old.attr,
432 NULL
433};
434
435static struct attribute_group dbs_attr_group_old = {
436 .attrs = dbs_attributes_old,
437 .name = "conservative",
438};
439
440/*** delete after deprecation time ***/
441
361/************************** sysfs end ************************/ 442/************************** sysfs end ************************/
362 443
363static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) 444static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
@@ -530,7 +611,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
530 611
531 mutex_lock(&dbs_mutex); 612 mutex_lock(&dbs_mutex);
532 613
533 rc = sysfs_create_group(&policy->kobj, &dbs_attr_group); 614 rc = sysfs_create_group(&policy->kobj, &dbs_attr_group_old);
534 if (rc) { 615 if (rc) {
535 mutex_unlock(&dbs_mutex); 616 mutex_unlock(&dbs_mutex);
536 return rc; 617 return rc;
@@ -564,6 +645,13 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
564 if (latency == 0) 645 if (latency == 0)
565 latency = 1; 646 latency = 1;
566 647
648 rc = sysfs_create_group(cpufreq_global_kobject,
649 &dbs_attr_group);
650 if (rc) {
651 mutex_unlock(&dbs_mutex);
652 return rc;
653 }
654
567 /* 655 /*
568 * conservative does not implement micro like ondemand 656 * conservative does not implement micro like ondemand
569 * governor, thus we are bound to jiffes/HZ 657 * governor, thus we are bound to jiffes/HZ
@@ -591,7 +679,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
591 dbs_timer_exit(this_dbs_info); 679 dbs_timer_exit(this_dbs_info);
592 680
593 mutex_lock(&dbs_mutex); 681 mutex_lock(&dbs_mutex);
594 sysfs_remove_group(&policy->kobj, &dbs_attr_group); 682 sysfs_remove_group(&policy->kobj, &dbs_attr_group_old);
595 dbs_enable--; 683 dbs_enable--;
596 mutex_destroy(&this_dbs_info->timer_mutex); 684 mutex_destroy(&this_dbs_info->timer_mutex);
597 685
@@ -605,6 +693,9 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
605 CPUFREQ_TRANSITION_NOTIFIER); 693 CPUFREQ_TRANSITION_NOTIFIER);
606 694
607 mutex_unlock(&dbs_mutex); 695 mutex_unlock(&dbs_mutex);
696 if (!dbs_enable)
697 sysfs_remove_group(cpufreq_global_kobject,
698 &dbs_attr_group);
608 699
609 break; 700 break;
610 701
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 071699de50ee..4b34ade2332b 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -133,9 +133,9 @@ static inline cputime64_t get_cpu_idle_time_jiffy(unsigned int cpu,
133 133
134 idle_time = cputime64_sub(cur_wall_time, busy_time); 134 idle_time = cputime64_sub(cur_wall_time, busy_time);
135 if (wall) 135 if (wall)
136 *wall = cur_wall_time; 136 *wall = (cputime64_t)jiffies_to_usecs(cur_wall_time);
137 137
138 return idle_time; 138 return (cputime64_t)jiffies_to_usecs(idle_time);
139} 139}
140 140
141static inline cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall) 141static inline cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall)