Re: [greybus-dev] [PATCH] staging: greybus: Directly use ida_alloc()/free()

From: Johan Hovold
Date: Tue Jun 21 2022 - 05:14:08 EST


On Fri, May 27, 2022 at 06:35:28AM +0000, keliu wrote:
> Use ida_alloc()/ida_free() instead of deprecated
> ida_simple_get()/ida_simple_remove() .
>
> Signed-off-by: keliu <liuke94@xxxxxxxxxx>

Is "keliu" really your full legal name?

> ---
> drivers/staging/greybus/audio_manager.c | 8 ++++----
> drivers/staging/greybus/authentication.c | 4 ++--
> drivers/staging/greybus/fw-download.c | 4 ++--
> drivers/staging/greybus/fw-management.c | 12 ++++++------
> drivers/staging/greybus/gbphy.c | 4 ++--
> drivers/staging/greybus/loopback.c | 6 +++---
> drivers/staging/greybus/raw.c | 6 +++---
> drivers/staging/greybus/vibrator.c | 6 +++---
> 8 files changed, 25 insertions(+), 25 deletions(-)

> diff --git a/drivers/staging/greybus/authentication.c b/drivers/staging/greybus/authentication.c
> index 297e69f011c7..01dd1cd958ea 100644
> --- a/drivers/staging/greybus/authentication.c
> +++ b/drivers/staging/greybus/authentication.c
> @@ -348,7 +348,7 @@ int gb_cap_connection_init(struct gb_connection *connection)
> err_del_cdev:
> cdev_del(&cap->cdev);
> err_remove_ida:
> - ida_simple_remove(&cap_minors_map, minor);
> + ida_free(&cap_minors_map, minor);
> err_connection_disable:
> gb_connection_disable(connection);
> err_list_del:
> @@ -372,7 +372,7 @@ void gb_cap_connection_exit(struct gb_connection *connection)
>
> device_destroy(cap_class, cap->dev_num);
> cdev_del(&cap->cdev);
> - ida_simple_remove(&cap_minors_map, MINOR(cap->dev_num));
> + ida_free(&cap_minors_map, MINOR(cap->dev_num));
>
> /*
> * Disallow any new ioctl operations on the char device and wait for

The above looks incomplete since you do not change the ida_simple_get()
in gb_cap_connection_init().

Please check for any similar mistakes throughout.

Johan