Skip to content

Commit f452001

Browse files
tititiou36mstsirkin
authored andcommitted
vhost-vdpa: Remove usage of the deprecated ida_simple_xx() API
ida_alloc() and ida_free() should be preferred to the deprecated ida_simple_get() and ida_simple_remove(). Note that the upper limit of ida_simple_get() is exclusive, but the one of ida_alloc_max() is inclusive. So a -1 has been added when needed. Signed-off-by: Christophe JAILLET <[email protected]> Reviewed-by: Simon Horman <[email protected]> Message-Id: <67c2edf49788c27d5f7a49fc701520b9fcf739b5.1713088999.git.christophe.jaillet@wanadoo.fr> Signed-off-by: Michael S. Tsirkin <[email protected]> Acked-by: Jason Wang <[email protected]>
1 parent 4d68562 commit f452001

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/vhost/vdpa.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1548,7 +1548,7 @@ static void vhost_vdpa_release_dev(struct device *device)
15481548
struct vhost_vdpa *v =
15491549
container_of(device, struct vhost_vdpa, dev);
15501550

1551-
ida_simple_remove(&vhost_vdpa_ida, v->minor);
1551+
ida_free(&vhost_vdpa_ida, v->minor);
15521552
kfree(v->vqs);
15531553
kfree(v);
15541554
}
@@ -1571,8 +1571,8 @@ static int vhost_vdpa_probe(struct vdpa_device *vdpa)
15711571
if (!v)
15721572
return -ENOMEM;
15731573

1574-
minor = ida_simple_get(&vhost_vdpa_ida, 0,
1575-
VHOST_VDPA_DEV_MAX, GFP_KERNEL);
1574+
minor = ida_alloc_max(&vhost_vdpa_ida, VHOST_VDPA_DEV_MAX - 1,
1575+
GFP_KERNEL);
15761576
if (minor < 0) {
15771577
kfree(v);
15781578
return minor;

0 commit comments

Comments
 (0)