You need to sign in or sign up before continuing.
提交 a1c36b16 编写于 作者: T Tejun Heo 提交者: Linus Torvalds

vfio: convert to idr_alloc()

Convert to the much saner new idr interface.
Signed-off-by: NTejun Heo <tj@kernel.org>
Acked-by: NAlex Williamson <alex.williamson@redhat.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 6d770931
......@@ -139,23 +139,8 @@ EXPORT_SYMBOL_GPL(vfio_unregister_iommu_driver);
*/
static int vfio_alloc_group_minor(struct vfio_group *group)
{
int ret, minor;
again:
if (unlikely(idr_pre_get(&vfio.group_idr, GFP_KERNEL) == 0))
return -ENOMEM;
/* index 0 is used by /dev/vfio/vfio */
ret = idr_get_new_above(&vfio.group_idr, group, 1, &minor);
if (ret == -EAGAIN)
goto again;
if (ret || minor > MINORMASK) {
if (minor > MINORMASK)
idr_remove(&vfio.group_idr, minor);
return -ENOSPC;
}
return minor;
return idr_alloc(&vfio.group_idr, group, 1, MINORMASK + 1, GFP_KERNEL);
}
static void vfio_free_group_minor(int minor)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册