~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/cpufreq/cpufreq.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include <linux/cpu.h>
29
29
#include <linux/completion.h>
30
30
#include <linux/mutex.h>
 
31
#include <linux/syscore_ops.h>
31
32
 
32
33
#include <trace/events/power.h>
33
34
 
34
 
#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_CORE, \
35
 
                                                "cpufreq-core", msg)
36
 
 
37
35
/**
38
36
 * The "cpufreq driver" - the arch- or hardware-dependent low
39
37
 * level driver of CPUFreq support, and its spinlock. This lock
180
178
 
181
179
 
182
180
/*********************************************************************
183
 
 *                     UNIFIED DEBUG HELPERS                         *
184
 
 *********************************************************************/
185
 
#ifdef CONFIG_CPU_FREQ_DEBUG
186
 
 
187
 
/* what part(s) of the CPUfreq subsystem are debugged? */
188
 
static unsigned int debug;
189
 
 
190
 
/* is the debug output ratelimit'ed using printk_ratelimit? User can
191
 
 * set or modify this value.
192
 
 */
193
 
static unsigned int debug_ratelimit = 1;
194
 
 
195
 
/* is the printk_ratelimit'ing enabled? It's enabled after a successful
196
 
 * loading of a cpufreq driver, temporarily disabled when a new policy
197
 
 * is set, and disabled upon cpufreq driver removal
198
 
 */
199
 
static unsigned int disable_ratelimit = 1;
200
 
static DEFINE_SPINLOCK(disable_ratelimit_lock);
201
 
 
202
 
static void cpufreq_debug_enable_ratelimit(void)
203
 
{
204
 
        unsigned long flags;
205
 
 
206
 
        spin_lock_irqsave(&disable_ratelimit_lock, flags);
207
 
        if (disable_ratelimit)
208
 
                disable_ratelimit--;
209
 
        spin_unlock_irqrestore(&disable_ratelimit_lock, flags);
210
 
}
211
 
 
212
 
static void cpufreq_debug_disable_ratelimit(void)
213
 
{
214
 
        unsigned long flags;
215
 
 
216
 
        spin_lock_irqsave(&disable_ratelimit_lock, flags);
217
 
        disable_ratelimit++;
218
 
        spin_unlock_irqrestore(&disable_ratelimit_lock, flags);
219
 
}
220
 
 
221
 
void cpufreq_debug_printk(unsigned int type, const char *prefix,
222
 
                        const char *fmt, ...)
223
 
{
224
 
        char s[256];
225
 
        va_list args;
226
 
        unsigned int len;
227
 
        unsigned long flags;
228
 
 
229
 
        WARN_ON(!prefix);
230
 
        if (type & debug) {
231
 
                spin_lock_irqsave(&disable_ratelimit_lock, flags);
232
 
                if (!disable_ratelimit && debug_ratelimit
233
 
                                        && !printk_ratelimit()) {
234
 
                        spin_unlock_irqrestore(&disable_ratelimit_lock, flags);
235
 
                        return;
236
 
                }
237
 
                spin_unlock_irqrestore(&disable_ratelimit_lock, flags);
238
 
 
239
 
                len = snprintf(s, 256, KERN_DEBUG "%s: ", prefix);
240
 
 
241
 
                va_start(args, fmt);
242
 
                len += vsnprintf(&s[len], (256 - len), fmt, args);
243
 
                va_end(args);
244
 
 
245
 
                printk(s);
246
 
 
247
 
                WARN_ON(len < 5);
248
 
        }
249
 
}
250
 
EXPORT_SYMBOL(cpufreq_debug_printk);
251
 
 
252
 
 
253
 
module_param(debug, uint, 0644);
254
 
MODULE_PARM_DESC(debug, "CPUfreq debugging: add 1 to debug core,"
255
 
                        " 2 to debug drivers, and 4 to debug governors.");
256
 
 
257
 
module_param(debug_ratelimit, uint, 0644);
258
 
MODULE_PARM_DESC(debug_ratelimit, "CPUfreq debugging:"
259
 
                                        " set to 0 to disable ratelimiting.");
260
 
 
261
 
#else /* !CONFIG_CPU_FREQ_DEBUG */
262
 
 
263
 
static inline void cpufreq_debug_enable_ratelimit(void) { return; }
264
 
static inline void cpufreq_debug_disable_ratelimit(void) { return; }
265
 
 
266
 
#endif /* CONFIG_CPU_FREQ_DEBUG */
267
 
 
268
 
 
269
 
/*********************************************************************
270
181
 *            EXTERNALLY AFFECTING FREQUENCY CHANGES                 *
271
182
 *********************************************************************/
272
183
 
290
201
        if (!l_p_j_ref_freq) {
291
202
                l_p_j_ref = loops_per_jiffy;
292
203
                l_p_j_ref_freq = ci->old;
293
 
                dprintk("saving %lu as reference value for loops_per_jiffy; "
 
204
                pr_debug("saving %lu as reference value for loops_per_jiffy; "
294
205
                        "freq is %u kHz\n", l_p_j_ref, l_p_j_ref_freq);
295
206
        }
296
207
        if ((val == CPUFREQ_PRECHANGE  && ci->old < ci->new) ||
298
209
            (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) {
299
210
                loops_per_jiffy = cpufreq_scale(l_p_j_ref, l_p_j_ref_freq,
300
211
                                                                ci->new);
301
 
                dprintk("scaling loops_per_jiffy to %lu "
 
212
                pr_debug("scaling loops_per_jiffy to %lu "
302
213
                        "for frequency %u kHz\n", loops_per_jiffy, ci->new);
303
214
        }
304
215
}
325
236
        BUG_ON(irqs_disabled());
326
237
 
327
238
        freqs->flags = cpufreq_driver->flags;
328
 
        dprintk("notification %u of frequency transition to %u kHz\n",
 
239
        pr_debug("notification %u of frequency transition to %u kHz\n",
329
240
                state, freqs->new);
330
241
 
331
242
        policy = per_cpu(cpufreq_cpu_data, freqs->cpu);
339
250
                if (!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) {
340
251
                        if ((policy) && (policy->cpu == freqs->cpu) &&
341
252
                            (policy->cur) && (policy->cur != freqs->old)) {
342
 
                                dprintk("Warning: CPU frequency is"
 
253
                                pr_debug("Warning: CPU frequency is"
343
254
                                        " %u, cpufreq assumed %u kHz.\n",
344
255
                                        freqs->old, policy->cur);
345
256
                                freqs->old = policy->cur;
352
263
 
353
264
        case CPUFREQ_POSTCHANGE:
354
265
                adjust_jiffies(CPUFREQ_POSTCHANGE, freqs);
355
 
                dprintk("FREQ: %lu - CPU: %lu", (unsigned long)freqs->new,
 
266
                pr_debug("FREQ: %lu - CPU: %lu", (unsigned long)freqs->new,
356
267
                        (unsigned long)freqs->cpu);
357
268
                trace_power_frequency(POWER_PSTATE, freqs->new, freqs->cpu);
358
269
                trace_cpu_frequency(freqs->new, freqs->cpu);
410
321
                t = __find_governor(str_governor);
411
322
 
412
323
                if (t == NULL) {
413
 
                        char *name = kasprintf(GFP_KERNEL, "cpufreq_%s",
414
 
                                                                str_governor);
415
 
 
416
 
                        if (name) {
417
 
                                int ret;
418
 
 
419
 
                                mutex_unlock(&cpufreq_governor_mutex);
420
 
                                ret = request_module("%s", name);
421
 
                                mutex_lock(&cpufreq_governor_mutex);
422
 
 
423
 
                                if (ret == 0)
424
 
                                        t = __find_governor(str_governor);
425
 
                        }
426
 
 
427
 
                        kfree(name);
 
324
                        int ret;
 
325
 
 
326
                        mutex_unlock(&cpufreq_governor_mutex);
 
327
                        ret = request_module("cpufreq_%s", str_governor);
 
328
                        mutex_lock(&cpufreq_governor_mutex);
 
329
 
 
330
                        if (ret == 0)
 
331
                                t = __find_governor(str_governor);
428
332
                }
429
333
 
430
334
                if (t != NULL) {
752
656
static void cpufreq_sysfs_release(struct kobject *kobj)
753
657
{
754
658
        struct cpufreq_policy *policy = to_policy(kobj);
755
 
        dprintk("last reference is dropped\n");
 
659
        pr_debug("last reference is dropped\n");
756
660
        complete(&policy->kobj_unregister);
757
661
}
758
662
 
787
691
        gov = __find_governor(per_cpu(cpufreq_cpu_governor, cpu));
788
692
        if (gov) {
789
693
                policy->governor = gov;
790
 
                dprintk("Restoring governor %s for cpu %d\n",
 
694
                pr_debug("Restoring governor %s for cpu %d\n",
791
695
                       policy->governor->name, cpu);
792
696
        }
793
697
#endif
823
727
                        per_cpu(cpufreq_cpu_data, cpu) = managed_policy;
824
728
                        spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
825
729
 
826
 
                        dprintk("CPU already managed, adding link\n");
 
730
                        pr_debug("CPU already managed, adding link\n");
827
731
                        ret = sysfs_create_link(&sys_dev->kobj,
828
732
                                                &managed_policy->kobj,
829
733
                                                "cpufreq");
864
768
                if (!cpu_online(j))
865
769
                        continue;
866
770
 
867
 
                dprintk("CPU %u already managed, adding link\n", j);
 
771
                pr_debug("CPU %u already managed, adding link\n", j);
868
772
                managed_policy = cpufreq_cpu_get(cpu);
869
773
                cpu_sys_dev = get_cpu_sysdev(j);
870
774
                ret = sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj,
940
844
        policy->user_policy.governor = policy->governor;
941
845
 
942
846
        if (ret) {
943
 
                dprintk("setting policy failed\n");
 
847
                pr_debug("setting policy failed\n");
944
848
                if (cpufreq_driver->exit)
945
849
                        cpufreq_driver->exit(policy);
946
850
        }
976
880
        if (cpu_is_offline(cpu))
977
881
                return 0;
978
882
 
979
 
        cpufreq_debug_disable_ratelimit();
980
 
        dprintk("adding CPU %u\n", cpu);
 
883
        pr_debug("adding CPU %u\n", cpu);
981
884
 
982
885
#ifdef CONFIG_SMP
983
886
        /* check whether a different CPU already registered this
985
888
        policy = cpufreq_cpu_get(cpu);
986
889
        if (unlikely(policy)) {
987
890
                cpufreq_cpu_put(policy);
988
 
                cpufreq_debug_enable_ratelimit();
989
891
                return 0;
990
892
        }
991
893
#endif
1036
938
         */
1037
939
        ret = cpufreq_driver->init(policy);
1038
940
        if (ret) {
1039
 
                dprintk("initialization failed\n");
 
941
                pr_debug("initialization failed\n");
1040
942
                goto err_unlock_policy;
1041
943
        }
1042
944
        policy->user_policy.min = policy->min;
1062
964
 
1063
965
        kobject_uevent(&policy->kobj, KOBJ_ADD);
1064
966
        module_put(cpufreq_driver->owner);
1065
 
        dprintk("initialization complete\n");
1066
 
        cpufreq_debug_enable_ratelimit();
 
967
        pr_debug("initialization complete\n");
1067
968
 
1068
969
        return 0;
1069
970
 
1087
988
nomem_out:
1088
989
        module_put(cpufreq_driver->owner);
1089
990
module_out:
1090
 
        cpufreq_debug_enable_ratelimit();
1091
991
        return ret;
1092
992
}
1093
993
 
1111
1011
        unsigned int j;
1112
1012
#endif
1113
1013
 
1114
 
        cpufreq_debug_disable_ratelimit();
1115
 
        dprintk("unregistering CPU %u\n", cpu);
 
1014
        pr_debug("unregistering CPU %u\n", cpu);
1116
1015
 
1117
1016
        spin_lock_irqsave(&cpufreq_driver_lock, flags);
1118
1017
        data = per_cpu(cpufreq_cpu_data, cpu);
1119
1018
 
1120
1019
        if (!data) {
1121
1020
                spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
1122
 
                cpufreq_debug_enable_ratelimit();
1123
1021
                unlock_policy_rwsem_write(cpu);
1124
1022
                return -EINVAL;
1125
1023
        }
1131
1029
         * only need to unlink, put and exit
1132
1030
         */
1133
1031
        if (unlikely(cpu != data->cpu)) {
1134
 
                dprintk("removing link\n");
 
1032
                pr_debug("removing link\n");
1135
1033
                cpumask_clear_cpu(cpu, data->cpus);
1136
1034
                spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
1137
1035
                kobj = &sys_dev->kobj;
1138
1036
                cpufreq_cpu_put(data);
1139
 
                cpufreq_debug_enable_ratelimit();
1140
1037
                unlock_policy_rwsem_write(cpu);
1141
1038
                sysfs_remove_link(kobj, "cpufreq");
1142
1039
                return 0;
1169
1066
                for_each_cpu(j, data->cpus) {
1170
1067
                        if (j == cpu)
1171
1068
                                continue;
1172
 
                        dprintk("removing link for cpu %u\n", j);
 
1069
                        pr_debug("removing link for cpu %u\n", j);
1173
1070
#ifdef CONFIG_HOTPLUG_CPU
1174
1071
                        strncpy(per_cpu(cpufreq_cpu_governor, j),
1175
1072
                                data->governor->name, CPUFREQ_NAME_LEN);
1198
1095
         * not referenced anymore by anybody before we proceed with
1199
1096
         * unloading.
1200
1097
         */
1201
 
        dprintk("waiting for dropping of refcount\n");
 
1098
        pr_debug("waiting for dropping of refcount\n");
1202
1099
        wait_for_completion(cmp);
1203
 
        dprintk("wait complete\n");
 
1100
        pr_debug("wait complete\n");
1204
1101
 
1205
1102
        lock_policy_rwsem_write(cpu);
1206
1103
        if (cpufreq_driver->exit)
1207
1104
                cpufreq_driver->exit(data);
1208
1105
        unlock_policy_rwsem_write(cpu);
1209
1106
 
 
1107
#ifdef CONFIG_HOTPLUG_CPU
 
1108
        /* when the CPU which is the parent of the kobj is hotplugged
 
1109
         * offline, check for siblings, and create cpufreq sysfs interface
 
1110
         * and symlinks
 
1111
         */
 
1112
        if (unlikely(cpumask_weight(data->cpus) > 1)) {
 
1113
                /* first sibling now owns the new sysfs dir */
 
1114
                cpumask_clear_cpu(cpu, data->cpus);
 
1115
                cpufreq_add_dev(get_cpu_sysdev(cpumask_first(data->cpus)));
 
1116
 
 
1117
                /* finally remove our own symlink */
 
1118
                lock_policy_rwsem_write(cpu);
 
1119
                __cpufreq_remove_dev(sys_dev);
 
1120
        }
 
1121
#endif
 
1122
 
1210
1123
        free_cpumask_var(data->related_cpus);
1211
1124
        free_cpumask_var(data->cpus);
1212
1125
        kfree(data);
1213
 
        per_cpu(cpufreq_cpu_data, cpu) = NULL;
1214
1126
 
1215
 
        cpufreq_debug_enable_ratelimit();
1216
1127
        return 0;
1217
1128
}
1218
1129
 
1238
1149
        struct cpufreq_policy *policy =
1239
1150
                container_of(work, struct cpufreq_policy, update);
1240
1151
        unsigned int cpu = policy->cpu;
1241
 
        dprintk("handle_update for cpu %u called\n", cpu);
 
1152
        pr_debug("handle_update for cpu %u called\n", cpu);
1242
1153
        cpufreq_update_policy(cpu);
1243
1154
}
1244
1155
 
1256
1167
{
1257
1168
        struct cpufreq_freqs freqs;
1258
1169
 
1259
 
        dprintk("Warning: CPU frequency out of sync: cpufreq and timing "
 
1170
        pr_debug("Warning: CPU frequency out of sync: cpufreq and timing "
1260
1171
               "core thinks of %u, is %u kHz.\n", old_freq, new_freq);
1261
1172
 
1262
1173
        freqs.cpu = cpu;
1340
1251
}
1341
1252
EXPORT_SYMBOL(cpufreq_get);
1342
1253
 
 
1254
static struct sysdev_driver cpufreq_sysdev_driver = {
 
1255
        .add            = cpufreq_add_dev,
 
1256
        .remove         = cpufreq_remove_dev,
 
1257
};
 
1258
 
1343
1259
 
1344
1260
/**
1345
 
 *      cpufreq_suspend - let the low level driver prepare for suspend
 
1261
 * cpufreq_bp_suspend - Prepare the boot CPU for system suspend.
 
1262
 *
 
1263
 * This function is only executed for the boot processor.  The other CPUs
 
1264
 * have been put offline by means of CPU hotplug.
1346
1265
 */
1347
 
 
1348
 
static int cpufreq_suspend(struct sys_device *sysdev, pm_message_t pmsg)
 
1266
static int cpufreq_bp_suspend(void)
1349
1267
{
1350
1268
        int ret = 0;
1351
1269
 
1352
 
        int cpu = sysdev->id;
 
1270
        int cpu = smp_processor_id();
1353
1271
        struct cpufreq_policy *cpu_policy;
1354
1272
 
1355
 
        dprintk("suspending cpu %u\n", cpu);
1356
 
 
1357
 
        if (!cpu_online(cpu))
1358
 
                return 0;
1359
 
 
1360
 
        /* we may be lax here as interrupts are off. Nonetheless
1361
 
         * we need to grab the correct cpu policy, as to check
1362
 
         * whether we really run on this CPU.
1363
 
         */
1364
 
 
 
1273
        pr_debug("suspending cpu %u\n", cpu);
 
1274
 
 
1275
        /* If there's no policy for the boot CPU, we have nothing to do. */
1365
1276
        cpu_policy = cpufreq_cpu_get(cpu);
1366
1277
        if (!cpu_policy)
1367
 
                return -EINVAL;
1368
 
 
1369
 
        /* only handle each CPU group once */
1370
 
        if (unlikely(cpu_policy->cpu != cpu))
1371
 
                goto out;
 
1278
                return 0;
1372
1279
 
1373
1280
        if (cpufreq_driver->suspend) {
1374
1281
                ret = cpufreq_driver->suspend(cpu_policy);
1377
1284
                                        "step on CPU %u\n", cpu_policy->cpu);
1378
1285
        }
1379
1286
 
1380
 
out:
1381
1287
        cpufreq_cpu_put(cpu_policy);
1382
1288
        return ret;
1383
1289
}
1384
1290
 
1385
1291
/**
1386
 
 *      cpufreq_resume -  restore proper CPU frequency handling after resume
 
1292
 * cpufreq_bp_resume - Restore proper frequency handling of the boot CPU.
1387
1293
 *
1388
1294
 *      1.) resume CPUfreq hardware support (cpufreq_driver->resume())
1389
1295
 *      2.) schedule call cpufreq_update_policy() ASAP as interrupts are
1391
1297
 *          what we believe it to be. This is a bit later than when it
1392
1298
 *          should be, but nonethteless it's better than calling
1393
1299
 *          cpufreq_driver->get() here which might re-enable interrupts...
 
1300
 *
 
1301
 * This function is only executed for the boot CPU.  The other CPUs have not
 
1302
 * been turned on yet.
1394
1303
 */
1395
 
static int cpufreq_resume(struct sys_device *sysdev)
 
1304
static void cpufreq_bp_resume(void)
1396
1305
{
1397
1306
        int ret = 0;
1398
1307
 
1399
 
        int cpu = sysdev->id;
 
1308
        int cpu = smp_processor_id();
1400
1309
        struct cpufreq_policy *cpu_policy;
1401
1310
 
1402
 
        dprintk("resuming cpu %u\n", cpu);
1403
 
 
1404
 
        if (!cpu_online(cpu))
1405
 
                return 0;
1406
 
 
1407
 
        /* we may be lax here as interrupts are off. Nonetheless
1408
 
         * we need to grab the correct cpu policy, as to check
1409
 
         * whether we really run on this CPU.
1410
 
         */
1411
 
 
 
1311
        pr_debug("resuming cpu %u\n", cpu);
 
1312
 
 
1313
        /* If there's no policy for the boot CPU, we have nothing to do. */
1412
1314
        cpu_policy = cpufreq_cpu_get(cpu);
1413
1315
        if (!cpu_policy)
1414
 
                return -EINVAL;
1415
 
 
1416
 
        /* only handle each CPU group once */
1417
 
        if (unlikely(cpu_policy->cpu != cpu))
1418
 
                goto fail;
 
1316
                return;
1419
1317
 
1420
1318
        if (cpufreq_driver->resume) {
1421
1319
                ret = cpufreq_driver->resume(cpu_policy);
1430
1328
 
1431
1329
fail:
1432
1330
        cpufreq_cpu_put(cpu_policy);
1433
 
        return ret;
1434
1331
}
1435
1332
 
1436
 
static struct sysdev_driver cpufreq_sysdev_driver = {
1437
 
        .add            = cpufreq_add_dev,
1438
 
        .remove         = cpufreq_remove_dev,
1439
 
        .suspend        = cpufreq_suspend,
1440
 
        .resume         = cpufreq_resume,
 
1333
static struct syscore_ops cpufreq_syscore_ops = {
 
1334
        .suspend        = cpufreq_bp_suspend,
 
1335
        .resume         = cpufreq_bp_resume,
1441
1336
};
1442
1337
 
1443
1338
 
1525
1420
{
1526
1421
        int retval = -EINVAL;
1527
1422
 
1528
 
        dprintk("target for CPU %u: %u kHz, relation %u\n", policy->cpu,
 
1423
        pr_debug("target for CPU %u: %u kHz, relation %u\n", policy->cpu,
1529
1424
                target_freq, relation);
1530
1425
        if (cpu_online(policy->cpu) && cpufreq_driver->target)
1531
1426
                retval = cpufreq_driver->target(policy, target_freq, relation);
1611
1506
        if (!try_module_get(policy->governor->owner))
1612
1507
                return -EINVAL;
1613
1508
 
1614
 
        dprintk("__cpufreq_governor for CPU %u, event %u\n",
 
1509
        pr_debug("__cpufreq_governor for CPU %u, event %u\n",
1615
1510
                                                policy->cpu, event);
1616
1511
        ret = policy->governor->governor(policy, event);
1617
1512
 
1712
1607
{
1713
1608
        int ret = 0;
1714
1609
 
1715
 
        cpufreq_debug_disable_ratelimit();
1716
 
        dprintk("setting new policy for CPU %u: %u - %u kHz\n", policy->cpu,
 
1610
        pr_debug("setting new policy for CPU %u: %u - %u kHz\n", policy->cpu,
1717
1611
                policy->min, policy->max);
1718
1612
 
1719
1613
        memcpy(&policy->cpuinfo, &data->cpuinfo,
1750
1644
        data->min = policy->min;
1751
1645
        data->max = policy->max;
1752
1646
 
1753
 
        dprintk("new min and max freqs are %u - %u kHz\n",
 
1647
        pr_debug("new min and max freqs are %u - %u kHz\n",
1754
1648
                                        data->min, data->max);
1755
1649
 
1756
1650
        if (cpufreq_driver->setpolicy) {
1757
1651
                data->policy = policy->policy;
1758
 
                dprintk("setting range\n");
 
1652
                pr_debug("setting range\n");
1759
1653
                ret = cpufreq_driver->setpolicy(policy);
1760
1654
        } else {
1761
1655
                if (policy->governor != data->governor) {
1762
1656
                        /* save old, working values */
1763
1657
                        struct cpufreq_governor *old_gov = data->governor;
1764
1658
 
1765
 
                        dprintk("governor switch\n");
 
1659
                        pr_debug("governor switch\n");
1766
1660
 
1767
1661
                        /* end old governor */
1768
1662
                        if (data->governor)
1772
1666
                        data->governor = policy->governor;
1773
1667
                        if (__cpufreq_governor(data, CPUFREQ_GOV_START)) {
1774
1668
                                /* new governor failed, so re-start old one */
1775
 
                                dprintk("starting governor %s failed\n",
 
1669
                                pr_debug("starting governor %s failed\n",
1776
1670
                                                        data->governor->name);
1777
1671
                                if (old_gov) {
1778
1672
                                        data->governor = old_gov;
1784
1678
                        }
1785
1679
                        /* might be a policy change, too, so fall through */
1786
1680
                }
1787
 
                dprintk("governor: change or update limits\n");
 
1681
                pr_debug("governor: change or update limits\n");
1788
1682
                __cpufreq_governor(data, CPUFREQ_GOV_LIMITS);
1789
1683
        }
1790
1684
 
1791
1685
error_out:
1792
 
        cpufreq_debug_enable_ratelimit();
1793
1686
        return ret;
1794
1687
}
1795
1688
 
1797
1690
 *      cpufreq_update_policy - re-evaluate an existing cpufreq policy
1798
1691
 *      @cpu: CPU which shall be re-evaluated
1799
1692
 *
1800
 
 *      Usefull for policy notifiers which have different necessities
 
1693
 *      Useful for policy notifiers which have different necessities
1801
1694
 *      at different times.
1802
1695
 */
1803
1696
int cpufreq_update_policy(unsigned int cpu)
1816
1709
                goto fail;
1817
1710
        }
1818
1711
 
1819
 
        dprintk("updating policy for CPU %u\n", cpu);
 
1712
        pr_debug("updating policy for CPU %u\n", cpu);
1820
1713
        memcpy(&policy, data, sizeof(struct cpufreq_policy));
1821
1714
        policy.min = data->user_policy.min;
1822
1715
        policy.max = data->user_policy.max;
1828
1721
        if (cpufreq_driver->get) {
1829
1722
                policy.cur = cpufreq_driver->get(cpu);
1830
1723
                if (!data->cur) {
1831
 
                        dprintk("Driver did not initialize current freq");
 
1724
                        pr_debug("Driver did not initialize current freq");
1832
1725
                        data->cur = policy.cur;
1833
1726
                } else {
1834
1727
                        if (data->cur != policy.cur)
1904
1797
            ((!driver_data->setpolicy) && (!driver_data->target)))
1905
1798
                return -EINVAL;
1906
1799
 
1907
 
        dprintk("trying to register driver %s\n", driver_data->name);
 
1800
        pr_debug("trying to register driver %s\n", driver_data->name);
1908
1801
 
1909
1802
        if (driver_data->setpolicy)
1910
1803
                driver_data->flags |= CPUFREQ_CONST_LOOPS;
1935
1828
 
1936
1829
                /* if all ->init() calls failed, unregister */
1937
1830
                if (ret) {
1938
 
                        dprintk("no CPU initialized for driver %s\n",
 
1831
                        pr_debug("no CPU initialized for driver %s\n",
1939
1832
                                                        driver_data->name);
1940
1833
                        goto err_sysdev_unreg;
1941
1834
                }
1942
1835
        }
1943
1836
 
1944
1837
        register_hotcpu_notifier(&cpufreq_cpu_notifier);
1945
 
        dprintk("driver %s up and running\n", driver_data->name);
1946
 
        cpufreq_debug_enable_ratelimit();
 
1838
        pr_debug("driver %s up and running\n", driver_data->name);
1947
1839
 
1948
1840
        return 0;
1949
1841
err_sysdev_unreg:
1970
1862
{
1971
1863
        unsigned long flags;
1972
1864
 
1973
 
        cpufreq_debug_disable_ratelimit();
1974
 
 
1975
 
        if (!cpufreq_driver || (driver != cpufreq_driver)) {
1976
 
                cpufreq_debug_enable_ratelimit();
 
1865
        if (!cpufreq_driver || (driver != cpufreq_driver))
1977
1866
                return -EINVAL;
1978
 
        }
1979
1867
 
1980
 
        dprintk("unregistering driver %s\n", driver->name);
 
1868
        pr_debug("unregistering driver %s\n", driver->name);
1981
1869
 
1982
1870
        sysdev_driver_unregister(&cpu_sysdev_class, &cpufreq_sysdev_driver);
1983
1871
        unregister_hotcpu_notifier(&cpufreq_cpu_notifier);
2002
1890
        cpufreq_global_kobject = kobject_create_and_add("cpufreq",
2003
1891
                                                &cpu_sysdev_class.kset.kobj);
2004
1892
        BUG_ON(!cpufreq_global_kobject);
 
1893
        register_syscore_ops(&cpufreq_syscore_ops);
2005
1894
 
2006
1895
        return 0;
2007
1896
}