Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cc39a8fa authored by Tejun Heo's avatar Tejun Heo Committed by Linus Torvalds
Browse files

drm/vmwgfx: convert to idr_alloc()



Convert to the much saner new idr interface.

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarDavid Airlie <airlied@linux.ie>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 36888db2
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
@@ -177,17 +177,16 @@ int vmw_resource_alloc_id(struct vmw_resource *res)

	BUG_ON(res->id != -1);

	do {
		if (unlikely(idr_pre_get(idr, GFP_KERNEL) == 0))
			return -ENOMEM;

	idr_preload(GFP_KERNEL);
	write_lock(&dev_priv->resource_lock);
		ret = idr_get_new_above(idr, res, 1, &res->id);
		write_unlock(&dev_priv->resource_lock);

	} while (ret == -EAGAIN);
	ret = idr_alloc(idr, res, 1, 0, GFP_NOWAIT);
	if (ret >= 0)
		res->id = ret;

	return ret;
	write_unlock(&dev_priv->resource_lock);
	idr_preload_end();
	return ret < 0 ? ret : 0;
}

/**