diff mbox series

usb: chipidea: Remove usage of the deprecated ida_simple_xx() API

Message ID 8bf382976c0ba0986c0dbe93427266273f0776ef.1702230217.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State Accepted
Commit e4e5f9e3bff79951cef7fd6912049b1cecf8a72d
Headers show
Series usb: chipidea: Remove usage of the deprecated ida_simple_xx() API | expand

Commit Message

Christophe JAILLET Dec. 10, 2023, 5:43 p.m. UTC
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@wanadoo.fr>
---
 drivers/usb/chipidea/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Peter Chen Dec. 11, 2023, 1:44 a.m. UTC | #1
On 23-12-10 18:43:56, Christophe JAILLET 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@wanadoo.fr>

Acked-by: Peter Chen <peter.chen@kernel.org>

> ---
>  drivers/usb/chipidea/core.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 7ac39a281b8c..0af9e68035fb 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -862,7 +862,7 @@ struct platform_device *ci_hdrc_add_device(struct device *dev,
>  	if (ret)
>  		return ERR_PTR(ret);
>  
> -	id = ida_simple_get(&ci_ida, 0, 0, GFP_KERNEL);
> +	id = ida_alloc(&ci_ida, GFP_KERNEL);
>  	if (id < 0)
>  		return ERR_PTR(id);
>  
> @@ -892,7 +892,7 @@ struct platform_device *ci_hdrc_add_device(struct device *dev,
>  err:
>  	platform_device_put(pdev);
>  put_id:
> -	ida_simple_remove(&ci_ida, id);
> +	ida_free(&ci_ida, id);
>  	return ERR_PTR(ret);
>  }
>  EXPORT_SYMBOL_GPL(ci_hdrc_add_device);
> @@ -901,7 +901,7 @@ void ci_hdrc_remove_device(struct platform_device *pdev)
>  {
>  	int id = pdev->id;
>  	platform_device_unregister(pdev);
> -	ida_simple_remove(&ci_ida, id);
> +	ida_free(&ci_ida, id);
>  }
>  EXPORT_SYMBOL_GPL(ci_hdrc_remove_device);
>  
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 7ac39a281b8c..0af9e68035fb 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -862,7 +862,7 @@  struct platform_device *ci_hdrc_add_device(struct device *dev,
 	if (ret)
 		return ERR_PTR(ret);
 
-	id = ida_simple_get(&ci_ida, 0, 0, GFP_KERNEL);
+	id = ida_alloc(&ci_ida, GFP_KERNEL);
 	if (id < 0)
 		return ERR_PTR(id);
 
@@ -892,7 +892,7 @@  struct platform_device *ci_hdrc_add_device(struct device *dev,
 err:
 	platform_device_put(pdev);
 put_id:
-	ida_simple_remove(&ci_ida, id);
+	ida_free(&ci_ida, id);
 	return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(ci_hdrc_add_device);
@@ -901,7 +901,7 @@  void ci_hdrc_remove_device(struct platform_device *pdev)
 {
 	int id = pdev->id;
 	platform_device_unregister(pdev);
-	ida_simple_remove(&ci_ida, id);
+	ida_free(&ci_ida, id);
 }
 EXPORT_SYMBOL_GPL(ci_hdrc_remove_device);