Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
[sfrench/cifs-2.6.git] / drivers / thermal / cpu_cooling.c
index 836828e29a87982e2828949e4e2daea532bb7ed9..8dc44cbb3e09fe253546347e376c0834957efc1e 100644 (file)
@@ -73,21 +73,14 @@ static struct cpufreq_cooling_device *notify_device;
  */
 static int get_idr(struct idr *idr, int *id)
 {
-       int err;
-again:
-       if (unlikely(idr_pre_get(idr, GFP_KERNEL) == 0))
-               return -ENOMEM;
+       int ret;
 
        mutex_lock(&cooling_cpufreq_lock);
-       err = idr_get_new(idr, NULL, id);
+       ret = idr_alloc(idr, NULL, 0, 0, GFP_KERNEL);
        mutex_unlock(&cooling_cpufreq_lock);
-
-       if (unlikely(err == -EAGAIN))
-               goto again;
-       else if (unlikely(err))
-               return err;
-
-       *id = *id & MAX_IDR_MASK;
+       if (unlikely(ret < 0))
+               return ret;
+       *id = ret;
        return 0;
 }
 
@@ -118,8 +111,8 @@ static int is_cpufreq_valid(int cpu)
 /**
  * get_cpu_frequency - get the absolute value of frequency from level.
  * @cpu: cpu for which frequency is fetched.
- * @level: level of frequency of the CPU
- *     e.g level=1 --> 1st MAX FREQ, LEVEL=2 ---> 2nd MAX FREQ, .... etc
+ * @level: level of frequency, equals cooling state of cpu cooling device
+ *     e.g level=0 --> 1st MAX FREQ, level=1 ---> 2nd MAX FREQ, .... etc
  */
 static unsigned int get_cpu_frequency(unsigned int cpu, unsigned long level)
 {