tools headers UAPI: Sync kvm.h headers with the kernel sources
[linux-2.6-microblaze.git] / drivers / base / arch_topology.c
index 75f72d6..de8587c 100644 (file)
 #include <linux/sched.h>
 #include <linux/smp.h>
 
-__weak bool arch_freq_counters_available(struct cpumask *cpus)
+bool topology_scale_freq_invariant(void)
+{
+       return cpufreq_supports_freq_invariance() ||
+              arch_freq_counters_available(cpu_online_mask);
+}
+
+__weak bool arch_freq_counters_available(const struct cpumask *cpus)
 {
        return false;
 }
 DEFINE_PER_CPU(unsigned long, freq_scale) = SCHED_CAPACITY_SCALE;
 
-void arch_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq,
-                        unsigned long max_freq)
+void topology_set_freq_scale(const struct cpumask *cpus, unsigned long cur_freq,
+                            unsigned long max_freq)
 {
        unsigned long scale;
        int i;
 
+       if (WARN_ON_ONCE(!cur_freq || !max_freq))
+               return;
+
        /*
         * If the use of counters for FIE is enabled, just return as we don't
         * want to update the scale factor with information from CPUFREQ.
@@ -71,7 +80,7 @@ static ssize_t cpu_capacity_show(struct device *dev,
 {
        struct cpu *cpu = container_of(dev, struct cpu, dev);
 
-       return sprintf(buf, "%lu\n", topology_get_cpu_scale(cpu->dev.id));
+       return sysfs_emit(buf, "%lu\n", topology_get_cpu_scale(cpu->dev.id));
 }
 
 static void update_topology_flags_workfn(struct work_struct *work);