Skip to content

Commit acc48fe

Browse files
tititiou36mathieupoirier
authored andcommitted
rpmsg: 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> Link: https://lore.kernel.org/r/c09ee5b66d451bf97d14c167048549aa0824ee06.1705225049.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
1 parent 6613476 commit acc48fe

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

drivers/rpmsg/rpmsg_char.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,8 @@ static void rpmsg_eptdev_release_device(struct device *dev)
399399
{
400400
struct rpmsg_eptdev *eptdev = dev_to_eptdev(dev);
401401

402-
ida_simple_remove(&rpmsg_ept_ida, dev->id);
403-
ida_simple_remove(&rpmsg_minor_ida, MINOR(eptdev->dev.devt));
402+
ida_free(&rpmsg_ept_ida, dev->id);
403+
ida_free(&rpmsg_minor_ida, MINOR(eptdev->dev.devt));
404404
kfree(eptdev);
405405
}
406406

@@ -441,12 +441,12 @@ static int rpmsg_chrdev_eptdev_add(struct rpmsg_eptdev *eptdev, struct rpmsg_cha
441441

442442
eptdev->chinfo = chinfo;
443443

444-
ret = ida_simple_get(&rpmsg_minor_ida, 0, RPMSG_DEV_MAX, GFP_KERNEL);
444+
ret = ida_alloc_max(&rpmsg_minor_ida, RPMSG_DEV_MAX - 1, GFP_KERNEL);
445445
if (ret < 0)
446446
goto free_eptdev;
447447
dev->devt = MKDEV(MAJOR(rpmsg_major), ret);
448448

449-
ret = ida_simple_get(&rpmsg_ept_ida, 0, 0, GFP_KERNEL);
449+
ret = ida_alloc(&rpmsg_ept_ida, GFP_KERNEL);
450450
if (ret < 0)
451451
goto free_minor_ida;
452452
dev->id = ret;
@@ -462,9 +462,9 @@ static int rpmsg_chrdev_eptdev_add(struct rpmsg_eptdev *eptdev, struct rpmsg_cha
462462
return ret;
463463

464464
free_ept_ida:
465-
ida_simple_remove(&rpmsg_ept_ida, dev->id);
465+
ida_free(&rpmsg_ept_ida, dev->id);
466466
free_minor_ida:
467-
ida_simple_remove(&rpmsg_minor_ida, MINOR(dev->devt));
467+
ida_free(&rpmsg_minor_ida, MINOR(dev->devt));
468468
free_eptdev:
469469
put_device(dev);
470470
kfree(eptdev);

drivers/rpmsg/rpmsg_ctrl.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ static void rpmsg_ctrldev_release_device(struct device *dev)
130130
{
131131
struct rpmsg_ctrldev *ctrldev = dev_to_ctrldev(dev);
132132

133-
ida_simple_remove(&rpmsg_ctrl_ida, dev->id);
134-
ida_simple_remove(&rpmsg_minor_ida, MINOR(dev->devt));
133+
ida_free(&rpmsg_ctrl_ida, dev->id);
134+
ida_free(&rpmsg_minor_ida, MINOR(dev->devt));
135135
kfree(ctrldev);
136136
}
137137

@@ -156,12 +156,12 @@ static int rpmsg_ctrldev_probe(struct rpmsg_device *rpdev)
156156
cdev_init(&ctrldev->cdev, &rpmsg_ctrldev_fops);
157157
ctrldev->cdev.owner = THIS_MODULE;
158158

159-
ret = ida_simple_get(&rpmsg_minor_ida, 0, RPMSG_DEV_MAX, GFP_KERNEL);
159+
ret = ida_alloc_max(&rpmsg_minor_ida, RPMSG_DEV_MAX - 1, GFP_KERNEL);
160160
if (ret < 0)
161161
goto free_ctrldev;
162162
dev->devt = MKDEV(MAJOR(rpmsg_major), ret);
163163

164-
ret = ida_simple_get(&rpmsg_ctrl_ida, 0, 0, GFP_KERNEL);
164+
ret = ida_alloc(&rpmsg_ctrl_ida, GFP_KERNEL);
165165
if (ret < 0)
166166
goto free_minor_ida;
167167
dev->id = ret;
@@ -179,9 +179,9 @@ static int rpmsg_ctrldev_probe(struct rpmsg_device *rpdev)
179179
return ret;
180180

181181
free_ctrl_ida:
182-
ida_simple_remove(&rpmsg_ctrl_ida, dev->id);
182+
ida_free(&rpmsg_ctrl_ida, dev->id);
183183
free_minor_ida:
184-
ida_simple_remove(&rpmsg_minor_ida, MINOR(dev->devt));
184+
ida_free(&rpmsg_minor_ida, MINOR(dev->devt));
185185
free_ctrldev:
186186
put_device(dev);
187187
kfree(ctrldev);

0 commit comments

Comments
 (0)