Re: [PATCH 1/2] rpmb: Remove usage of the deprecated ida_simple_xx() API
From: Jens Wiklander
Date: Mon Oct 14 2024 - 06:39:06 EST
On Wed, Oct 9, 2024 at 10:53 PM Christophe JAILLET
<christophe.jaillet@xxxxxxxxxx> 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@xxxxxxxxxx>
> ---
> The ida_simple_get()/ida_simple_remove() API was close to be removed (see
> [1]). A usage has been re-introduced with this new driver :(
>
> [1]: https://lore.kernel.org/all/cover.1722853349.git.christophe.jaillet@xxxxxxxxxx/
I'm picking up this for v6.13. I guess your patch set now depends on
this patch. I can ack the patch instead and let you include it in your
patch set if it's more convenient. Please let me know what you prefer
to avoid potential conflicts.
Thanks,
Jens
> ---
> drivers/misc/rpmb-core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/misc/rpmb-core.c b/drivers/misc/rpmb-core.c
> index bc68cde1a8bf..ad1b5c1a37fa 100644
> --- a/drivers/misc/rpmb-core.c
> +++ b/drivers/misc/rpmb-core.c
> @@ -64,7 +64,7 @@ static void rpmb_dev_release(struct device *dev)
> struct rpmb_dev *rdev = to_rpmb_dev(dev);
>
> mutex_lock(&rpmb_mutex);
> - ida_simple_remove(&rpmb_ida, rdev->id);
> + ida_free(&rpmb_ida, rdev->id);
> mutex_unlock(&rpmb_mutex);
> kfree(rdev->descr.dev_id);
> kfree(rdev);
> @@ -176,7 +176,7 @@ struct rpmb_dev *rpmb_dev_register(struct device *dev,
> }
>
> mutex_lock(&rpmb_mutex);
> - ret = ida_simple_get(&rpmb_ida, 0, 0, GFP_KERNEL);
> + ret = ida_alloc(&rpmb_ida, GFP_KERNEL);
> mutex_unlock(&rpmb_mutex);
> if (ret < 0)
> goto err_free_dev_id;
> --
> 2.46.2
>