Convert to the much saner new idr interface.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Tejun Heo 2013-02-27 17:04:48 -08:00 коммит произвёл Linus Torvalds
Родитель 6d77093129
Коммит a1c36b166b
1 изменённых файлов: 1 добавлений и 16 удалений

Просмотреть файл

@ -139,23 +139,8 @@ EXPORT_SYMBOL_GPL(vfio_unregister_iommu_driver);
*/ */
static int vfio_alloc_group_minor(struct vfio_group *group) 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 */ /* index 0 is used by /dev/vfio/vfio */
ret = idr_get_new_above(&vfio.group_idr, group, 1, &minor); return idr_alloc(&vfio.group_idr, group, 1, MINORMASK + 1, GFP_KERNEL);
if (ret == -EAGAIN)
goto again;
if (ret || minor > MINORMASK) {
if (minor > MINORMASK)
idr_remove(&vfio.group_idr, minor);
return -ENOSPC;
}
return minor;
} }
static void vfio_free_group_minor(int minor) static void vfio_free_group_minor(int minor)