diff options
author | Tejun Heo <tj@kernel.org> | 2013-02-27 20:04:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-27 22:10:16 -0500 |
commit | ff512357fe1bf7f901bd0ea19fc718025dff6b07 (patch) | |
tree | d232c34f6bfe534e7bdb893b3015c2835f362c7f | |
parent | c8c470afe316002d5d5259a134984ed03f40e249 (diff) |
drm/sis: convert to idr_alloc()
Convert to the much saner new idr interface.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: David Airlie <airlied@linux.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/gpu/drm/sis/sis_mm.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/gpu/drm/sis/sis_mm.c b/drivers/gpu/drm/sis/sis_mm.c index 2b2f78c428af..9a43d98e5003 100644 --- a/drivers/gpu/drm/sis/sis_mm.c +++ b/drivers/gpu/drm/sis/sis_mm.c | |||
@@ -128,17 +128,10 @@ static int sis_drm_alloc(struct drm_device *dev, struct drm_file *file, | |||
128 | if (retval) | 128 | if (retval) |
129 | goto fail_alloc; | 129 | goto fail_alloc; |
130 | 130 | ||
131 | again: | 131 | retval = idr_alloc(&dev_priv->object_idr, item, 1, 0, GFP_KERNEL); |
132 | if (idr_pre_get(&dev_priv->object_idr, GFP_KERNEL) == 0) { | 132 | if (retval < 0) |
133 | retval = -ENOMEM; | ||
134 | goto fail_idr; | ||
135 | } | ||
136 | |||
137 | retval = idr_get_new_above(&dev_priv->object_idr, item, 1, &user_key); | ||
138 | if (retval == -EAGAIN) | ||
139 | goto again; | ||
140 | if (retval) | ||
141 | goto fail_idr; | 133 | goto fail_idr; |
134 | user_key = retval; | ||
142 | 135 | ||
143 | list_add(&item->owner_list, &file_priv->obj_list); | 136 | list_add(&item->owner_list, &file_priv->obj_list); |
144 | mutex_unlock(&dev->struct_mutex); | 137 | mutex_unlock(&dev->struct_mutex); |