[PATCH] vdpa: Remove usage of the deprecated ida_simple_xx() API

Christophe JAILLET posted 1 patch 2 years ago
drivers/vdpa/vdpa.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] vdpa: Remove usage of the deprecated ida_simple_xx() API
Posted by Christophe JAILLET 2 years ago
ida_alloc() and ida_free() should be preferred to the deprecated
ida_simple_get() and ida_simple_remove().

This is less verbose.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/vdpa/vdpa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
index a7612e0783b3..d0695680b282 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -131,7 +131,7 @@ static void vdpa_release_dev(struct device *d)
 	if (ops->free)
 		ops->free(vdev);
 
-	ida_simple_remove(&vdpa_index_ida, vdev->index);
+	ida_free(&vdpa_index_ida, vdev->index);
 	kfree(vdev->driver_override);
 	kfree(vdev);
 }
@@ -205,7 +205,7 @@ struct vdpa_device *__vdpa_alloc_device(struct device *parent,
 	return vdev;
 
 err_name:
-	ida_simple_remove(&vdpa_index_ida, vdev->index);
+	ida_free(&vdpa_index_ida, vdev->index);
 err_ida:
 	kfree(vdev);
 err:
-- 
2.34.1
Re: [PATCH] vdpa: Remove usage of the deprecated ida_simple_xx() API
Posted by Jason Wang 1 year, 12 months ago
On Mon, Dec 11, 2023 at 1:52 AM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> ida_alloc() and ida_free() should be preferred to the deprecated
> ida_simple_get() and ida_simple_remove().
>
> This is less verbose.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Acked-by: Jason Wang <jasowang@redhat.com>

Thanks

> ---
>  drivers/vdpa/vdpa.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
> index a7612e0783b3..d0695680b282 100644
> --- a/drivers/vdpa/vdpa.c
> +++ b/drivers/vdpa/vdpa.c
> @@ -131,7 +131,7 @@ static void vdpa_release_dev(struct device *d)
>         if (ops->free)
>                 ops->free(vdev);
>
> -       ida_simple_remove(&vdpa_index_ida, vdev->index);
> +       ida_free(&vdpa_index_ida, vdev->index);
>         kfree(vdev->driver_override);
>         kfree(vdev);
>  }
> @@ -205,7 +205,7 @@ struct vdpa_device *__vdpa_alloc_device(struct device *parent,
>         return vdev;
>
>  err_name:
> -       ida_simple_remove(&vdpa_index_ida, vdev->index);
> +       ida_free(&vdpa_index_ida, vdev->index);
>  err_ida:
>         kfree(vdev);
>  err:
> --
> 2.34.1
>