Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <christophe.jaillet@wanadoo.fr>
Reviewed-by: Simon Horman <horms@kernel.org>
Message-Id: <67c2edf49788c27d5f7a49fc701520b9fcf739b5.1713088999.git.christophe.jaillet@wanadoo.fr>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>

authored by

Christophe JAILLET and committed by
Michael S. Tsirkin
f452001d 4d685629

+3 -3
+3 -3
drivers/vhost/vdpa.c
··· 1548 1548 struct vhost_vdpa *v = 1549 1549 container_of(device, struct vhost_vdpa, dev); 1550 1550 1551 - ida_simple_remove(&vhost_vdpa_ida, v->minor); 1551 + ida_free(&vhost_vdpa_ida, v->minor); 1552 1552 kfree(v->vqs); 1553 1553 kfree(v); 1554 1554 } ··· 1571 1571 if (!v) 1572 1572 return -ENOMEM; 1573 1573 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); 1576 1576 if (minor < 0) { 1577 1577 kfree(v); 1578 1578 return minor;