aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r--drivers/cpufreq/cpufreq.c129
1 files changed, 57 insertions, 72 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 35a26a3e5f68..d3575f5ec6d2 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -118,9 +118,11 @@ static void handle_update(struct work_struct *work);
118static BLOCKING_NOTIFIER_HEAD(cpufreq_policy_notifier_list); 118static BLOCKING_NOTIFIER_HEAD(cpufreq_policy_notifier_list);
119static struct srcu_notifier_head cpufreq_transition_notifier_list; 119static struct srcu_notifier_head cpufreq_transition_notifier_list;
120 120
121static bool init_cpufreq_transition_notifier_list_called;
121static int __init init_cpufreq_transition_notifier_list(void) 122static int __init init_cpufreq_transition_notifier_list(void)
122{ 123{
123 srcu_init_notifier_head(&cpufreq_transition_notifier_list); 124 srcu_init_notifier_head(&cpufreq_transition_notifier_list);
125 init_cpufreq_transition_notifier_list_called = true;
124 return 0; 126 return 0;
125} 127}
126pure_initcall(init_cpufreq_transition_notifier_list); 128pure_initcall(init_cpufreq_transition_notifier_list);
@@ -216,7 +218,7 @@ static void cpufreq_debug_disable_ratelimit(void)
216} 218}
217 219
218void cpufreq_debug_printk(unsigned int type, const char *prefix, 220void cpufreq_debug_printk(unsigned int type, const char *prefix,
219 const char *fmt, ...) 221 const char *fmt, ...)
220{ 222{
221 char s[256]; 223 char s[256];
222 va_list args; 224 va_list args;
@@ -378,7 +380,7 @@ static struct cpufreq_governor *__find_governor(const char *str_governor)
378/** 380/**
379 * cpufreq_parse_governor - parse a governor string 381 * cpufreq_parse_governor - parse a governor string
380 */ 382 */
381static int cpufreq_parse_governor (char *str_governor, unsigned int *policy, 383static int cpufreq_parse_governor(char *str_governor, unsigned int *policy,
382 struct cpufreq_governor **governor) 384 struct cpufreq_governor **governor)
383{ 385{
384 int err = -EINVAL; 386 int err = -EINVAL;
@@ -446,7 +448,7 @@ extern struct sysdev_class cpu_sysdev_class;
446 448
447#define show_one(file_name, object) \ 449#define show_one(file_name, object) \
448static ssize_t show_##file_name \ 450static ssize_t show_##file_name \
449(struct cpufreq_policy * policy, char *buf) \ 451(struct cpufreq_policy *policy, char *buf) \
450{ \ 452{ \
451 return sprintf (buf, "%u\n", policy->object); \ 453 return sprintf (buf, "%u\n", policy->object); \
452} 454}
@@ -465,7 +467,7 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data,
465 */ 467 */
466#define store_one(file_name, object) \ 468#define store_one(file_name, object) \
467static ssize_t store_##file_name \ 469static ssize_t store_##file_name \
468(struct cpufreq_policy * policy, const char *buf, size_t count) \ 470(struct cpufreq_policy *policy, const char *buf, size_t count) \
469{ \ 471{ \
470 unsigned int ret = -EINVAL; \ 472 unsigned int ret = -EINVAL; \
471 struct cpufreq_policy new_policy; \ 473 struct cpufreq_policy new_policy; \
@@ -490,8 +492,8 @@ store_one(scaling_max_freq,max);
490/** 492/**
491 * show_cpuinfo_cur_freq - current CPU frequency as detected by hardware 493 * show_cpuinfo_cur_freq - current CPU frequency as detected by hardware
492 */ 494 */
493static ssize_t show_cpuinfo_cur_freq (struct cpufreq_policy * policy, 495static ssize_t show_cpuinfo_cur_freq(struct cpufreq_policy *policy,
494 char *buf) 496 char *buf)
495{ 497{
496 unsigned int cur_freq = __cpufreq_get(policy->cpu); 498 unsigned int cur_freq = __cpufreq_get(policy->cpu);
497 if (!cur_freq) 499 if (!cur_freq)
@@ -503,8 +505,7 @@ static ssize_t show_cpuinfo_cur_freq (struct cpufreq_policy * policy,
503/** 505/**
504 * show_scaling_governor - show the current policy for the specified CPU 506 * show_scaling_governor - show the current policy for the specified CPU
505 */ 507 */
506static ssize_t show_scaling_governor (struct cpufreq_policy * policy, 508static ssize_t show_scaling_governor(struct cpufreq_policy *policy, char *buf)
507 char *buf)
508{ 509{
509 if(policy->policy == CPUFREQ_POLICY_POWERSAVE) 510 if(policy->policy == CPUFREQ_POLICY_POWERSAVE)
510 return sprintf(buf, "powersave\n"); 511 return sprintf(buf, "powersave\n");
@@ -519,8 +520,8 @@ static ssize_t show_scaling_governor (struct cpufreq_policy * policy,
519/** 520/**
520 * store_scaling_governor - store policy for the specified CPU 521 * store_scaling_governor - store policy for the specified CPU
521 */ 522 */
522static ssize_t store_scaling_governor (struct cpufreq_policy * policy, 523static ssize_t store_scaling_governor(struct cpufreq_policy *policy,
523 const char *buf, size_t count) 524 const char *buf, size_t count)
524{ 525{
525 unsigned int ret = -EINVAL; 526 unsigned int ret = -EINVAL;
526 char str_governor[16]; 527 char str_governor[16];
@@ -554,7 +555,7 @@ static ssize_t store_scaling_governor (struct cpufreq_policy * policy,
554/** 555/**
555 * show_scaling_driver - show the cpufreq driver currently loaded 556 * show_scaling_driver - show the cpufreq driver currently loaded
556 */ 557 */
557static ssize_t show_scaling_driver (struct cpufreq_policy * policy, char *buf) 558static ssize_t show_scaling_driver(struct cpufreq_policy *policy, char *buf)
558{ 559{
559 return scnprintf(buf, CPUFREQ_NAME_LEN, "%s\n", cpufreq_driver->name); 560 return scnprintf(buf, CPUFREQ_NAME_LEN, "%s\n", cpufreq_driver->name);
560} 561}
@@ -562,8 +563,8 @@ static ssize_t show_scaling_driver (struct cpufreq_policy * policy, char *buf)
562/** 563/**
563 * show_scaling_available_governors - show the available CPUfreq governors 564 * show_scaling_available_governors - show the available CPUfreq governors
564 */ 565 */
565static ssize_t show_scaling_available_governors (struct cpufreq_policy *policy, 566static ssize_t show_scaling_available_governors(struct cpufreq_policy *policy,
566 char *buf) 567 char *buf)
567{ 568{
568 ssize_t i = 0; 569 ssize_t i = 0;
569 struct cpufreq_governor *t; 570 struct cpufreq_governor *t;
@@ -585,7 +586,7 @@ out:
585/** 586/**
586 * show_affected_cpus - show the CPUs affected by each transition 587 * show_affected_cpus - show the CPUs affected by each transition
587 */ 588 */
588static ssize_t show_affected_cpus (struct cpufreq_policy * policy, char *buf) 589static ssize_t show_affected_cpus(struct cpufreq_policy *policy, char *buf)
589{ 590{
590 ssize_t i = 0; 591 ssize_t i = 0;
591 unsigned int cpu; 592 unsigned int cpu;
@@ -602,7 +603,7 @@ static ssize_t show_affected_cpus (struct cpufreq_policy * policy, char *buf)
602} 603}
603 604
604static ssize_t store_scaling_setspeed(struct cpufreq_policy *policy, 605static ssize_t store_scaling_setspeed(struct cpufreq_policy *policy,
605 const char *buf, size_t count) 606 const char *buf, size_t count)
606{ 607{
607 unsigned int freq = 0; 608 unsigned int freq = 0;
608 unsigned int ret; 609 unsigned int ret;
@@ -651,7 +652,7 @@ define_one_rw(scaling_max_freq);
651define_one_rw(scaling_governor); 652define_one_rw(scaling_governor);
652define_one_rw(scaling_setspeed); 653define_one_rw(scaling_setspeed);
653 654
654static struct attribute * default_attrs[] = { 655static struct attribute *default_attrs[] = {
655 &cpuinfo_min_freq.attr, 656 &cpuinfo_min_freq.attr,
656 &cpuinfo_max_freq.attr, 657 &cpuinfo_max_freq.attr,
657 &scaling_min_freq.attr, 658 &scaling_min_freq.attr,
@@ -667,10 +668,10 @@ static struct attribute * default_attrs[] = {
667#define to_policy(k) container_of(k,struct cpufreq_policy,kobj) 668#define to_policy(k) container_of(k,struct cpufreq_policy,kobj)
668#define to_attr(a) container_of(a,struct freq_attr,attr) 669#define to_attr(a) container_of(a,struct freq_attr,attr)
669 670
670static ssize_t show(struct kobject * kobj, struct attribute * attr ,char * buf) 671static ssize_t show(struct kobject *kobj, struct attribute *attr ,char *buf)
671{ 672{
672 struct cpufreq_policy * policy = to_policy(kobj); 673 struct cpufreq_policy *policy = to_policy(kobj);
673 struct freq_attr * fattr = to_attr(attr); 674 struct freq_attr *fattr = to_attr(attr);
674 ssize_t ret = -EINVAL; 675 ssize_t ret = -EINVAL;
675 policy = cpufreq_cpu_get(policy->cpu); 676 policy = cpufreq_cpu_get(policy->cpu);
676 if (!policy) 677 if (!policy)
@@ -691,11 +692,11 @@ no_policy:
691 return ret; 692 return ret;
692} 693}
693 694
694static ssize_t store(struct kobject * kobj, struct attribute * attr, 695static ssize_t store(struct kobject *kobj, struct attribute *attr,
695 const char * buf, size_t count) 696 const char *buf, size_t count)
696{ 697{
697 struct cpufreq_policy * policy = to_policy(kobj); 698 struct cpufreq_policy *policy = to_policy(kobj);
698 struct freq_attr * fattr = to_attr(attr); 699 struct freq_attr *fattr = to_attr(attr);
699 ssize_t ret = -EINVAL; 700 ssize_t ret = -EINVAL;
700 policy = cpufreq_cpu_get(policy->cpu); 701 policy = cpufreq_cpu_get(policy->cpu);
701 if (!policy) 702 if (!policy)
@@ -716,9 +717,9 @@ no_policy:
716 return ret; 717 return ret;
717} 718}
718 719
719static void cpufreq_sysfs_release(struct kobject * kobj) 720static void cpufreq_sysfs_release(struct kobject *kobj)
720{ 721{
721 struct cpufreq_policy * policy = to_policy(kobj); 722 struct cpufreq_policy *policy = to_policy(kobj);
722 dprintk("last reference is dropped\n"); 723 dprintk("last reference is dropped\n");
723 complete(&policy->kobj_unregister); 724 complete(&policy->kobj_unregister);
724} 725}
@@ -740,7 +741,7 @@ static struct kobj_type ktype_cpufreq = {
740 * 741 *
741 * Adds the cpufreq interface for a CPU device. 742 * Adds the cpufreq interface for a CPU device.
742 */ 743 */
743static int cpufreq_add_dev (struct sys_device * sys_dev) 744static int cpufreq_add_dev(struct sys_device *sys_dev)
744{ 745{
745 unsigned int cpu = sys_dev->id; 746 unsigned int cpu = sys_dev->id;
746 int ret = 0; 747 int ret = 0;
@@ -800,7 +801,6 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
800 ret = cpufreq_driver->init(policy); 801 ret = cpufreq_driver->init(policy);
801 if (ret) { 802 if (ret) {
802 dprintk("initialization failed\n"); 803 dprintk("initialization failed\n");
803 unlock_policy_rwsem_write(cpu);
804 goto err_out; 804 goto err_out;
805 } 805 }
806 policy->user_policy.min = policy->cpuinfo.min_freq; 806 policy->user_policy.min = policy->cpuinfo.min_freq;
@@ -823,7 +823,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
823 /* check for existing affected CPUs. They may not be aware 823 /* check for existing affected CPUs. They may not be aware
824 * of it due to CPU Hotplug. 824 * of it due to CPU Hotplug.
825 */ 825 */
826 managed_policy = cpufreq_cpu_get(j); 826 managed_policy = cpufreq_cpu_get(j); // FIXME: Where is this released? What about error paths?
827 if (unlikely(managed_policy)) { 827 if (unlikely(managed_policy)) {
828 828
829 /* Set proper policy_cpu */ 829 /* Set proper policy_cpu */
@@ -842,14 +842,11 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
842 ret = sysfs_create_link(&sys_dev->kobj, 842 ret = sysfs_create_link(&sys_dev->kobj,
843 &managed_policy->kobj, 843 &managed_policy->kobj,
844 "cpufreq"); 844 "cpufreq");
845 if (ret) { 845 if (ret)
846 unlock_policy_rwsem_write(cpu);
847 goto err_out_driver_exit; 846 goto err_out_driver_exit;
848 }
849 847
850 cpufreq_debug_enable_ratelimit(); 848 cpufreq_debug_enable_ratelimit();
851 ret = 0; 849 ret = 0;
852 unlock_policy_rwsem_write(cpu);
853 goto err_out_driver_exit; /* call driver->exit() */ 850 goto err_out_driver_exit; /* call driver->exit() */
854 } 851 }
855 } 852 }
@@ -859,33 +856,26 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
859 /* prepare interface data */ 856 /* prepare interface data */
860 ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, &sys_dev->kobj, 857 ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, &sys_dev->kobj,
861 "cpufreq"); 858 "cpufreq");
862 if (ret) { 859 if (ret)
863 unlock_policy_rwsem_write(cpu);
864 goto err_out_driver_exit; 860 goto err_out_driver_exit;
865 } 861
866 /* set up files for this cpu device */ 862 /* set up files for this cpu device */
867 drv_attr = cpufreq_driver->attr; 863 drv_attr = cpufreq_driver->attr;
868 while ((drv_attr) && (*drv_attr)) { 864 while ((drv_attr) && (*drv_attr)) {
869 ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr)); 865 ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr));
870 if (ret) { 866 if (ret)
871 unlock_policy_rwsem_write(cpu);
872 goto err_out_driver_exit; 867 goto err_out_driver_exit;
873 }
874 drv_attr++; 868 drv_attr++;
875 } 869 }
876 if (cpufreq_driver->get){ 870 if (cpufreq_driver->get) {
877 ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr); 871 ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr);
878 if (ret) { 872 if (ret)
879 unlock_policy_rwsem_write(cpu);
880 goto err_out_driver_exit; 873 goto err_out_driver_exit;
881 }
882 } 874 }
883 if (cpufreq_driver->target){ 875 if (cpufreq_driver->target) {
884 ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr); 876 ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr);
885 if (ret) { 877 if (ret)
886 unlock_policy_rwsem_write(cpu);
887 goto err_out_driver_exit; 878 goto err_out_driver_exit;
888 }
889 } 879 }
890 880
891 spin_lock_irqsave(&cpufreq_driver_lock, flags); 881 spin_lock_irqsave(&cpufreq_driver_lock, flags);
@@ -907,10 +897,8 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
907 cpu_sys_dev = get_cpu_sysdev(j); 897 cpu_sys_dev = get_cpu_sysdev(j);
908 ret = sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj, 898 ret = sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj,
909 "cpufreq"); 899 "cpufreq");
910 if (ret) { 900 if (ret)
911 unlock_policy_rwsem_write(cpu);
912 goto err_out_unregister; 901 goto err_out_unregister;
913 }
914 } 902 }
915 903
916 policy->governor = NULL; /* to assure that the starting sequence is 904 policy->governor = NULL; /* to assure that the starting sequence is
@@ -950,6 +938,7 @@ err_out_driver_exit:
950 cpufreq_driver->exit(policy); 938 cpufreq_driver->exit(policy);
951 939
952err_out: 940err_out:
941 unlock_policy_rwsem_write(cpu);
953 kfree(policy); 942 kfree(policy);
954 943
955nomem_out: 944nomem_out:
@@ -967,7 +956,7 @@ module_out:
967 * Caller should already have policy_rwsem in write mode for this CPU. 956 * Caller should already have policy_rwsem in write mode for this CPU.
968 * This routine frees the rwsem before returning. 957 * This routine frees the rwsem before returning.
969 */ 958 */
970static int __cpufreq_remove_dev (struct sys_device * sys_dev) 959static int __cpufreq_remove_dev(struct sys_device *sys_dev)
971{ 960{
972 unsigned int cpu = sys_dev->id; 961 unsigned int cpu = sys_dev->id;
973 unsigned long flags; 962 unsigned long flags;
@@ -1071,7 +1060,7 @@ static int __cpufreq_remove_dev (struct sys_device * sys_dev)
1071} 1060}
1072 1061
1073 1062
1074static int cpufreq_remove_dev (struct sys_device * sys_dev) 1063static int cpufreq_remove_dev(struct sys_device *sys_dev)
1075{ 1064{
1076 unsigned int cpu = sys_dev->id; 1065 unsigned int cpu = sys_dev->id;
1077 int retval; 1066 int retval;
@@ -1138,7 +1127,7 @@ unsigned int cpufreq_quick_get(unsigned int cpu)
1138 cpufreq_cpu_put(policy); 1127 cpufreq_cpu_put(policy);
1139 } 1128 }
1140 1129
1141 return (ret_freq); 1130 return ret_freq;
1142} 1131}
1143EXPORT_SYMBOL(cpufreq_quick_get); 1132EXPORT_SYMBOL(cpufreq_quick_get);
1144 1133
@@ -1149,7 +1138,7 @@ static unsigned int __cpufreq_get(unsigned int cpu)
1149 unsigned int ret_freq = 0; 1138 unsigned int ret_freq = 0;
1150 1139
1151 if (!cpufreq_driver->get) 1140 if (!cpufreq_driver->get)
1152 return (ret_freq); 1141 return ret_freq;
1153 1142
1154 ret_freq = cpufreq_driver->get(cpu); 1143 ret_freq = cpufreq_driver->get(cpu);
1155 1144
@@ -1163,7 +1152,7 @@ static unsigned int __cpufreq_get(unsigned int cpu)
1163 } 1152 }
1164 } 1153 }
1165 1154
1166 return (ret_freq); 1155 return ret_freq;
1167} 1156}
1168 1157
1169/** 1158/**
@@ -1190,7 +1179,7 @@ unsigned int cpufreq_get(unsigned int cpu)
1190out_policy: 1179out_policy:
1191 cpufreq_cpu_put(policy); 1180 cpufreq_cpu_put(policy);
1192out: 1181out:
1193 return (ret_freq); 1182 return ret_freq;
1194} 1183}
1195EXPORT_SYMBOL(cpufreq_get); 1184EXPORT_SYMBOL(cpufreq_get);
1196 1185
@@ -1199,7 +1188,7 @@ EXPORT_SYMBOL(cpufreq_get);
1199 * cpufreq_suspend - let the low level driver prepare for suspend 1188 * cpufreq_suspend - let the low level driver prepare for suspend
1200 */ 1189 */
1201 1190
1202static int cpufreq_suspend(struct sys_device * sysdev, pm_message_t pmsg) 1191static int cpufreq_suspend(struct sys_device *sysdev, pm_message_t pmsg)
1203{ 1192{
1204 int cpu = sysdev->id; 1193 int cpu = sysdev->id;
1205 int ret = 0; 1194 int ret = 0;
@@ -1221,22 +1210,18 @@ static int cpufreq_suspend(struct sys_device * sysdev, pm_message_t pmsg)
1221 return -EINVAL; 1210 return -EINVAL;
1222 1211
1223 /* only handle each CPU group once */ 1212 /* only handle each CPU group once */
1224 if (unlikely(cpu_policy->cpu != cpu)) { 1213 if (unlikely(cpu_policy->cpu != cpu))
1225 cpufreq_cpu_put(cpu_policy); 1214 goto out;
1226 return 0;
1227 }
1228 1215
1229 if (cpufreq_driver->suspend) { 1216 if (cpufreq_driver->suspend) {
1230 ret = cpufreq_driver->suspend(cpu_policy, pmsg); 1217 ret = cpufreq_driver->suspend(cpu_policy, pmsg);
1231 if (ret) { 1218 if (ret) {
1232 printk(KERN_ERR "cpufreq: suspend failed in ->suspend " 1219 printk(KERN_ERR "cpufreq: suspend failed in ->suspend "
1233 "step on CPU %u\n", cpu_policy->cpu); 1220 "step on CPU %u\n", cpu_policy->cpu);
1234 cpufreq_cpu_put(cpu_policy); 1221 goto out;
1235 return ret;
1236 } 1222 }
1237 } 1223 }
1238 1224
1239
1240 if (cpufreq_driver->flags & CPUFREQ_CONST_LOOPS) 1225 if (cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)
1241 goto out; 1226 goto out;
1242 1227
@@ -1270,7 +1255,7 @@ static int cpufreq_suspend(struct sys_device * sysdev, pm_message_t pmsg)
1270 1255
1271out: 1256out:
1272 cpufreq_cpu_put(cpu_policy); 1257 cpufreq_cpu_put(cpu_policy);
1273 return 0; 1258 return ret;
1274} 1259}
1275 1260
1276/** 1261/**
@@ -1281,7 +1266,7 @@ out:
1281 * 3.) schedule call cpufreq_update_policy() ASAP as interrupts are 1266 * 3.) schedule call cpufreq_update_policy() ASAP as interrupts are
1282 * restored. 1267 * restored.
1283 */ 1268 */
1284static int cpufreq_resume(struct sys_device * sysdev) 1269static int cpufreq_resume(struct sys_device *sysdev)
1285{ 1270{
1286 int cpu = sysdev->id; 1271 int cpu = sysdev->id;
1287 int ret = 0; 1272 int ret = 0;
@@ -1302,18 +1287,15 @@ static int cpufreq_resume(struct sys_device * sysdev)
1302 return -EINVAL; 1287 return -EINVAL;
1303 1288
1304 /* only handle each CPU group once */ 1289 /* only handle each CPU group once */
1305 if (unlikely(cpu_policy->cpu != cpu)) { 1290 if (unlikely(cpu_policy->cpu != cpu))
1306 cpufreq_cpu_put(cpu_policy); 1291 goto fail;
1307 return 0;
1308 }
1309 1292
1310 if (cpufreq_driver->resume) { 1293 if (cpufreq_driver->resume) {
1311 ret = cpufreq_driver->resume(cpu_policy); 1294 ret = cpufreq_driver->resume(cpu_policy);
1312 if (ret) { 1295 if (ret) {
1313 printk(KERN_ERR "cpufreq: resume failed in ->resume " 1296 printk(KERN_ERR "cpufreq: resume failed in ->resume "
1314 "step on CPU %u\n", cpu_policy->cpu); 1297 "step on CPU %u\n", cpu_policy->cpu);
1315 cpufreq_cpu_put(cpu_policy); 1298 goto fail;
1316 return ret;
1317 } 1299 }
1318 } 1300 }
1319 1301
@@ -1353,6 +1335,7 @@ static int cpufreq_resume(struct sys_device * sysdev)
1353 1335
1354out: 1336out:
1355 schedule_work(&cpu_policy->update); 1337 schedule_work(&cpu_policy->update);
1338fail:
1356 cpufreq_cpu_put(cpu_policy); 1339 cpufreq_cpu_put(cpu_policy);
1357 return ret; 1340 return ret;
1358} 1341}
@@ -1386,6 +1369,8 @@ int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list)
1386{ 1369{
1387 int ret; 1370 int ret;
1388 1371
1372 WARN_ON(!init_cpufreq_transition_notifier_list_called);
1373
1389 switch (list) { 1374 switch (list) {
1390 case CPUFREQ_TRANSITION_NOTIFIER: 1375 case CPUFREQ_TRANSITION_NOTIFIER:
1391 ret = srcu_notifier_chain_register( 1376 ret = srcu_notifier_chain_register(
@@ -1848,7 +1833,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
1848 cpufreq_debug_enable_ratelimit(); 1833 cpufreq_debug_enable_ratelimit();
1849 } 1834 }
1850 1835
1851 return (ret); 1836 return ret;
1852} 1837}
1853EXPORT_SYMBOL_GPL(cpufreq_register_driver); 1838EXPORT_SYMBOL_GPL(cpufreq_register_driver);
1854 1839