Skip to content

Commit ff51235

Browse files
htejuntorvalds
authored andcommitted
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>
1 parent c8c470a commit ff51235

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

‎drivers/gpu/drm/sis/sis_mm.c‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,17 +128,10 @@ static int sis_drm_alloc(struct drm_device *dev, struct drm_file *file,
128128
if (retval)
129129
goto fail_alloc;
130130

131-
again:
132-
if (idr_pre_get(&dev_priv->object_idr, GFP_KERNEL) == 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)
131+
retval = idr_alloc(&dev_priv->object_idr, item, 1, 0, GFP_KERNEL);
132+
if (retval < 0)
141133
goto fail_idr;
134+
user_key = retval;
142135

143136
list_add(&item->owner_list, &file_priv->obj_list);
144137
mutex_unlock(&dev->struct_mutex);

0 commit comments

Comments
 (0)