lkml.org 
[lkml]   [2022]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] gnss: Remove usage of the deprecated ida_simple_xxx API
From
Le 16/06/2022 à 06:47, Bo Liu a écrit :
> Use ida_alloc_xxx()/ida_free() instead of
> ida_simple_get()/ida_simple_remove().
> The latter is deprecated and more verbose.
>
> Signed-off-by: Bo Liu <liubo03@inspur.com>

Hi,

even if a more detailed description about the reason of the added -1
would be welcomed:

Reviewed-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

> ---
> drivers/gnss/core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gnss/core.c b/drivers/gnss/core.c
> index e6f94501cb28..1e82b7967570 100644
> --- a/drivers/gnss/core.c
> +++ b/drivers/gnss/core.c
> @@ -217,7 +217,7 @@ static void gnss_device_release(struct device *dev)
>
> kfree(gdev->write_buf);
> kfifo_free(&gdev->read_fifo);
> - ida_simple_remove(&gnss_minors, gdev->id);
> + ida_free(&gnss_minors, gdev->id);
> kfree(gdev);
> }
>
> @@ -232,7 +232,7 @@ struct gnss_device *gnss_allocate_device(struct device *parent)
> if (!gdev)
> return NULL;
>
> - id = ida_simple_get(&gnss_minors, 0, GNSS_MINORS, GFP_KERNEL);
> + id = ida_alloc_max(&gnss_minors, GNSS_MINORS - 1, GFP_KERNEL);
> if (id < 0) {
> kfree(gdev);
> return NULL;

\
 
 \ /
  Last update: 2022-09-17 16:25    [W:0.055 / U:1.968 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site