summaryrefslogtreecommitdiff
path: root/drivers/gnss/core.c
diff options
context:
space:
mode:
authorBo Liu <liubo03@inspur.com>2022-06-16 00:47:33 -0400
committerJohan Hovold <johan@kernel.org>2022-06-21 09:30:36 +0200
commitc0c725d7350ec8b8453257676a440bb4b2df2422 (patch)
treece96868bb861f9c8bfc8506104cc87dff01b8e49 /drivers/gnss/core.c
parenta111daf0c53ae91e71fd2bfe7497862d14132e3e (diff)
gnss: replace ida_simple API
Use ida_alloc_xxx()/ida_free() instead of ida_simple_get()/ida_simple_remove(), which has been deprecated. Note that the upper bound is now inclusive. Signed-off-by: Bo Liu <liubo03@inspur.com> Link: https://lore.kernel.org/r/20220616044733.3605-1-liubo03@inspur.com Reviewed-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> [ johan: amend commit message ] Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/gnss/core.c')
-rw-r--r--drivers/gnss/core.c4
1 files 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;