summaryrefslogtreecommitdiff
path: root/drivers/thermal/cpu_cooling.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-02-28 01:04:46 (GMT)
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-28 03:10:19 (GMT)
commit6deb69facebb2f9a2b15a8e5e33ab00ebc7c44cb (patch)
tree4f23dc9cea95c526ef23c28e895379a19197e3b8 /drivers/thermal/cpu_cooling.c
parentab51603672a335d325963ca410d9c527d9f834f7 (diff)
downloadlinux-6deb69facebb2f9a2b15a8e5e33ab00ebc7c44cb.tar.xz
thermal: convert to idr_alloc()
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/thermal/cpu_cooling.c')
-rw-r--r--drivers/thermal/cpu_cooling.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
index 836828e..c33fa53 100644
--- a/drivers/thermal/cpu_cooling.c
+++ b/drivers/thermal/cpu_cooling.c
@@ -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;
}