cpufreq: Convert existing drivers to use cpufreq_freq_transition_{begin|end}
authorViresh Kumar <viresh.kumar@linaro.org>
Mon, 24 Mar 2014 08:05:45 +0000 (13:35 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 26 Mar 2014 15:41:41 +0000 (16:41 +0100)
CPUFreq core has new infrastructure that would guarantee serialized calls to
target() or target_index() callbacks. These are called
cpufreq_freq_transition_begin() and cpufreq_freq_transition_end().

This patch converts existing drivers to use these new set of routines.

Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
13 files changed:
drivers/cpufreq/cpufreq-nforce2.c
drivers/cpufreq/cpufreq.c
drivers/cpufreq/exynos5440-cpufreq.c
drivers/cpufreq/gx-suspmod.c
drivers/cpufreq/integrator-cpufreq.c
drivers/cpufreq/longhaul.c
drivers/cpufreq/pcc-cpufreq.c
drivers/cpufreq/powernow-k6.c
drivers/cpufreq/powernow-k7.c
drivers/cpufreq/powernow-k8.c
drivers/cpufreq/s3c24xx-cpufreq.c
drivers/cpufreq/sh-cpufreq.c
drivers/cpufreq/unicore2-cpufreq.c

index a05b876f375e5672c00b05412782c23ead83a773..bc447b9003c3f579a74c706c2083089dc2b00c74 100644 (file)
@@ -270,7 +270,7 @@ static int nforce2_target(struct cpufreq_policy *policy,
        pr_debug("Old CPU frequency %d kHz, new %d kHz\n",
               freqs.old, freqs.new);
 
-       cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
+       cpufreq_freq_transition_begin(policy, &freqs);
 
        /* Disable IRQs */
        /* local_irq_save(flags); */
@@ -285,7 +285,7 @@ static int nforce2_target(struct cpufreq_policy *policy,
        /* Enable IRQs */
        /* local_irq_restore(flags); */
 
-       cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
+       cpufreq_freq_transition_end(policy, &freqs, 0);
 
        return 0;
 }
index d57806a85def82789204201b3b985ff39e801b3d..eb562d0434128cb11da889c8a47c68b595f1fe60 100644 (file)
@@ -1507,8 +1507,8 @@ static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq,
        policy = per_cpu(cpufreq_cpu_data, cpu);
        read_unlock_irqrestore(&cpufreq_driver_lock, flags);
 
-       cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
-       cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
+       cpufreq_freq_transition_begin(policy, &freqs);
+       cpufreq_freq_transition_end(policy, &freqs, 0);
 }
 
 /**
@@ -1868,8 +1868,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
                        pr_debug("%s: cpu: %d, oldfreq: %u, new freq: %u\n",
                                 __func__, policy->cpu, freqs.old, freqs.new);
 
-                       cpufreq_notify_transition(policy, &freqs,
-                                       CPUFREQ_PRECHANGE);
+                       cpufreq_freq_transition_begin(policy, &freqs);
                }
 
                retval = cpufreq_driver->target_index(policy, index);
@@ -1878,7 +1877,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
                               __func__, retval);
 
                if (notify)
-                       cpufreq_notify_post_transition(policy, &freqs, retval);
+                       cpufreq_freq_transition_end(policy, &freqs, retval);
        }
 
 out:
index 7f776aa91e2ff431f972bbb3995fcee82b941c66..a6b8214d7b7712bb7d877d68d71e476e7bde26dc 100644 (file)
@@ -219,7 +219,7 @@ static int exynos_target(struct cpufreq_policy *policy, unsigned int index)
        freqs.old = policy->cur;
        freqs.new = freq_table[index].frequency;
 
-       cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
+       cpufreq_freq_transition_begin(policy, &freqs);
 
        /* Set the target frequency in all C0_3_PSTATE register */
        for_each_cpu(i, policy->cpus) {
@@ -258,7 +258,7 @@ static void exynos_cpufreq_work(struct work_struct *work)
                dev_crit(dvfs_info->dev, "New frequency out of range\n");
                freqs.new = freqs.old;
        }
-       cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
+       cpufreq_freq_transition_end(policy, &freqs, 0);
 
        cpufreq_cpu_put(policy);
        mutex_unlock(&cpufreq_lock);
index d83e8266a58e2eddf824696c80240ced024bab57..1d723dc8880c58605a1e0b407a9e5e38bbb61308 100644 (file)
@@ -265,7 +265,7 @@ static void gx_set_cpuspeed(struct cpufreq_policy *policy, unsigned int khz)
 
        freqs.new = new_khz;
 
-       cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
+       cpufreq_freq_transition_begin(policy, &freqs);
        local_irq_save(flags);
 
        if (new_khz != stock_freq) {
@@ -314,7 +314,7 @@ static void gx_set_cpuspeed(struct cpufreq_policy *policy, unsigned int khz)
 
        gx_params->pci_suscfg = suscfg;
 
-       cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
+       cpufreq_freq_transition_end(policy, &freqs, 0);
 
        pr_debug("suspend modulation w/ duration of ON:%d us, OFF:%d us\n",
                gx_params->on_duration * 32, gx_params->off_duration * 32);
index 0e27844e8c2d91742679580b8596e45d0cfdb6a9..e5122f1bfe78ca8f9d37881053b85cd02b94c881 100644 (file)
@@ -122,7 +122,7 @@ static int integrator_set_target(struct cpufreq_policy *policy,
                return 0;
        }
 
-       cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
+       cpufreq_freq_transition_begin(policy, &freqs);
 
        cm_osc = __raw_readl(cm_base + INTEGRATOR_HDR_OSC_OFFSET);
 
@@ -143,7 +143,7 @@ static int integrator_set_target(struct cpufreq_policy *policy,
         */
        set_cpus_allowed(current, cpus_allowed);
 
-       cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
+       cpufreq_freq_transition_end(policy, &freqs, 0);
 
        return 0;
 }
index 7b94da3d2d1012e3075f73eb5dcb49523841a985..5c440f87ba8a5973a0cd3e0e8a234415523d45b9 100644 (file)
@@ -269,7 +269,7 @@ static void longhaul_setstate(struct cpufreq_policy *policy,
        freqs.old = calc_speed(longhaul_get_cpu_mult());
        freqs.new = speed;
 
-       cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
+       cpufreq_freq_transition_begin(policy, &freqs);
 
        pr_debug("Setting to FSB:%dMHz Mult:%d.%dx (%s)\n",
                        fsb, mult/10, mult%10, print_speed(speed/1000));
@@ -386,7 +386,7 @@ retry_loop:
                }
        }
        /* Report true CPU frequency */
-       cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
+       cpufreq_freq_transition_end(policy, &freqs, 0);
 
        if (!bm_timeout)
                printk(KERN_INFO PFX "Warning: Timeout while waiting for "
index 1c0f1067af73318387d3d3e133e3d67a990eac61..728a2d8794993defdbe1e10c15fe7ee814c528bb 100644 (file)
@@ -215,7 +215,7 @@ static int pcc_cpufreq_target(struct cpufreq_policy *policy,
 
        freqs.old = policy->cur;
        freqs.new = target_freq;
-       cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
+       cpufreq_freq_transition_begin(policy, &freqs);
 
        input_buffer = 0x1 | (((target_freq * 100)
                               / (ioread32(&pcch_hdr->nominal) * 1000)) << 8);
@@ -231,7 +231,7 @@ static int pcc_cpufreq_target(struct cpufreq_policy *policy,
        status = ioread16(&pcch_hdr->status);
        iowrite16(0, &pcch_hdr->status);
 
-       cpufreq_notify_post_transition(policy, &freqs, status != CMD_COMPLETE);
+       cpufreq_freq_transition_end(policy, &freqs, status != CMD_COMPLETE);
        spin_unlock(&pcc_lock);
 
        if (status != CMD_COMPLETE) {
index ce27e6c26c94de3de132407b168acb1c06ac7782..62c6f2e5afced391ee7260e6ab6065c73954fa58 100644 (file)
@@ -148,11 +148,11 @@ static int powernow_k6_target(struct cpufreq_policy *policy,
        freqs.old = busfreq * powernow_k6_get_cpu_multiplier();
        freqs.new = busfreq * clock_ratio[best_i].driver_data;
 
-       cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
+       cpufreq_freq_transition_begin(policy, &freqs);
 
        powernow_k6_set_cpu_multiplier(best_i);
 
-       cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
+       cpufreq_freq_transition_end(policy, &freqs, 0);
 
        return 0;
 }
index 0e68e027562135fd34214d440abeaab4dc2405ed..f911645c3f6db59e18f32b68c06bfc890283c029 100644 (file)
@@ -269,7 +269,7 @@ static int powernow_target(struct cpufreq_policy *policy, unsigned int index)
 
        freqs.new = powernow_table[index].frequency;
 
-       cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
+       cpufreq_freq_transition_begin(policy, &freqs);
 
        /* Now do the magic poking into the MSRs.  */
 
@@ -290,7 +290,7 @@ static int powernow_target(struct cpufreq_policy *policy, unsigned int index)
        if (have_a0 == 1)
                local_irq_enable();
 
-       cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
+       cpufreq_freq_transition_end(policy, &freqs, 0);
 
        return 0;
 }
index 27eb2be44de56cbae978069c5251fd74c2b76afb..770a9e1b3468f3f13b1b67a8ed81934bf4a1f139 100644 (file)
@@ -963,9 +963,9 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data,
        policy = cpufreq_cpu_get(smp_processor_id());
        cpufreq_cpu_put(policy);
 
-       cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
+       cpufreq_freq_transition_begin(policy, &freqs);
        res = transition_fid_vid(data, fid, vid);
-       cpufreq_notify_post_transition(policy, &freqs, res);
+       cpufreq_freq_transition_end(policy, &freqs, res);
 
        return res;
 }
index 25069741b507588a1ee7139d0568d2fe09fb0d0d..a3dc192d21f98c6e3b1bb22713426f8de1c40658 100644 (file)
@@ -217,7 +217,7 @@ static int s3c_cpufreq_settarget(struct cpufreq_policy *policy,
        s3c_cpufreq_updateclk(clk_pclk, cpu_new.freq.pclk);
 
        /* start the frequency change */
-       cpufreq_notify_transition(policy, &freqs.freqs, CPUFREQ_PRECHANGE);
+       cpufreq_freq_transition_begin(policy, &freqs.freqs);
 
        /* If hclk is staying the same, then we do not need to
         * re-write the IO or the refresh timings whilst we are changing
@@ -261,7 +261,7 @@ static int s3c_cpufreq_settarget(struct cpufreq_policy *policy,
        local_irq_restore(flags);
 
        /* notify everyone we've done this */
-       cpufreq_notify_transition(policy, &freqs.freqs, CPUFREQ_POSTCHANGE);
+       cpufreq_freq_transition_end(policy, &freqs.freqs, 0);
 
        s3c_freq_dbg("%s: finished\n", __func__);
        return 0;
index 696170ebd3a3efb8a92f1946215e863d58ce7e9a..86628e22b2a36827d37f35d552f0624bc9dc387c 100644 (file)
@@ -68,10 +68,10 @@ static int sh_cpufreq_target(struct cpufreq_policy *policy,
        freqs.new       = (freq + 500) / 1000;
        freqs.flags     = 0;
 
-       cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
+       cpufreq_freq_transition_begin(policy, &freqs);
        set_cpus_allowed_ptr(current, &cpus_allowed);
        clk_set_rate(cpuclk, freq);
-       cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
+       cpufreq_freq_transition_end(policy, &freqs, 0);
 
        dev_dbg(dev, "set frequency %lu Hz\n", freq);
 
index 36cc330b8747c70b3430175c6fec28891526688c..13be802b6170e1a8aefb457e28745ff6318ef125 100644 (file)
@@ -44,9 +44,9 @@ static int ucv2_target(struct cpufreq_policy *policy,
        freqs.old = policy->cur;
        freqs.new = target_freq;
 
-       cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
+       cpufreq_freq_transition_begin(policy, &freqs);
        ret = clk_set_rate(policy->mclk, target_freq * 1000);
-       cpufreq_notify_post_transition(policy, &freqs, ret);
+       cpufreq_freq_transition_end(policy, &freqs, ret);
 
        return ret;
 }