Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 359367
b: refs/heads/master
c: 6deb69f
h: refs/heads/master
i:
  359365: a5fa81a
  359363: b0075d1
  359359: 5a16415
v: v3
  • Loading branch information
Tejun Heo authored and Linus Torvalds committed Feb 28, 2013
1 parent b6891d0 commit 12fee83
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ab51603672a335d325963ca410d9c527d9f834f7
refs/heads/master: 6deb69facebb2f9a2b15a8e5e33ab00ebc7c44cb
17 changes: 5 additions & 12 deletions trunk/drivers/thermal/cpu_cooling.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
17 changes: 5 additions & 12 deletions trunk/drivers/thermal/thermal_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,23 +132,16 @@ EXPORT_SYMBOL_GPL(thermal_unregister_governor);

static int get_idr(struct idr *idr, struct mutex *lock, int *id)
{
int err;

again:
if (unlikely(idr_pre_get(idr, GFP_KERNEL) == 0))
return -ENOMEM;
int ret;

if (lock)
mutex_lock(lock);
err = idr_get_new(idr, NULL, id);
ret = idr_alloc(idr, NULL, 0, 0, GFP_KERNEL);
if (lock)
mutex_unlock(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;
}

Expand Down

0 comments on commit 12fee83

Please sign in to comment.