linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] hwmon: Directly use ida_alloc()/free()
@ 2022-05-17  6:31 keliu
  2022-05-17  6:31 ` [PATCH 2/2] " keliu
  2022-05-17 12:48 ` [PATCH 1/2] " Guenter Roeck
  0 siblings, 2 replies; 4+ messages in thread
From: keliu @ 2022-05-17  6:31 UTC (permalink / raw)
  To: jdelvare, linux, linux-hwmon, linux-kernel; +Cc: keliu

Use ida_alloc()/ida_free() instead of deprecated
ida_simple_get()/ida_simple_remove() .

Signed-off-by: keliu <liuke94@huawei.com>
---
 drivers/hwmon/hwmon.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 22de7a9e7ba7..2e2cd79d89eb 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -764,7 +764,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
 			 "hwmon: '%s' is not a valid name attribute, please fix\n",
 			 name);
 
-	id = ida_simple_get(&hwmon_ida, 0, 0, GFP_KERNEL);
+	id = ida_alloc(&hwmon_ida, GFP_KERNEL);
 	if (id < 0)
 		return ERR_PTR(id);
 
@@ -856,7 +856,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
 free_hwmon:
 	hwmon_dev_release(hdev);
 ida_remove:
-	ida_simple_remove(&hwmon_ida, id);
+	ida_free(&hwmon_ida, id);
 	return ERR_PTR(err);
 }
 
@@ -968,7 +968,7 @@ void hwmon_device_unregister(struct device *dev)
 
 	if (likely(sscanf(dev_name(dev), HWMON_ID_FORMAT, &id) == 1)) {
 		device_unregister(dev);
-		ida_simple_remove(&hwmon_ida, id);
+		ida_free(&hwmon_ida, id);
 	} else
 		dev_dbg(dev->parent,
 			"hwmon_device_unregister() failed: bad class ID!\n");
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] hwmon: Directly use ida_alloc()/free()
  2022-05-17  6:31 [PATCH 1/2] hwmon: Directly use ida_alloc()/free() keliu
@ 2022-05-17  6:31 ` keliu
  2022-05-17 12:50   ` Guenter Roeck
  2022-05-17 12:48 ` [PATCH 1/2] " Guenter Roeck
  1 sibling, 1 reply; 4+ messages in thread
From: keliu @ 2022-05-17  6:31 UTC (permalink / raw)
  To: jdelvare, linux, linux-hwmon, linux-kernel; +Cc: keliu

Use ida_alloc()/ida_free() instead of deprecated
ida_simple_get()/ida_simple_remove() .

Signed-off-by: keliu <liuke94@huawei.com>
---
 drivers/hwmon/ibmaem.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c
index de6baf6ca3d1..5c4cf742f5ae 100644
--- a/drivers/hwmon/ibmaem.c
+++ b/drivers/hwmon/ibmaem.c
@@ -482,7 +482,7 @@ static void aem_delete(struct aem_data *data)
 	ipmi_destroy_user(data->ipmi.user);
 	platform_set_drvdata(data->pdev, NULL);
 	platform_device_unregister(data->pdev);
-	ida_simple_remove(&aem_ida, data->id);
+	ida_free(&aem_ida, data->id);
 	kfree(data);
 }
 
@@ -539,7 +539,7 @@ static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle)
 		data->power_period[i] = AEM_DEFAULT_POWER_INTERVAL;
 
 	/* Create sub-device for this fw instance */
-	data->id = ida_simple_get(&aem_ida, 0, 0, GFP_KERNEL);
+	data->id = ida_alloc(&aem_ida, GFP_KERNEL);
 	if (data->id < 0)
 		goto id_err;
 
@@ -600,7 +600,7 @@ static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle)
 	platform_set_drvdata(data->pdev, NULL);
 	platform_device_unregister(data->pdev);
 dev_err:
-	ida_simple_remove(&aem_ida, data->id);
+	ida_free(&aem_ida, data->id);
 id_err:
 	kfree(data);
 
@@ -679,7 +679,7 @@ static int aem_init_aem2_inst(struct aem_ipmi_data *probe,
 		data->power_period[i] = AEM_DEFAULT_POWER_INTERVAL;
 
 	/* Create sub-device for this fw instance */
-	data->id = ida_simple_get(&aem_ida, 0, 0, GFP_KERNEL);
+	data->id = ida_alloc(&aem_ida, GFP_KERNEL);
 	if (data->id < 0)
 		goto id_err;
 
@@ -740,7 +740,7 @@ static int aem_init_aem2_inst(struct aem_ipmi_data *probe,
 	platform_set_drvdata(data->pdev, NULL);
 	platform_device_unregister(data->pdev);
 dev_err:
-	ida_simple_remove(&aem_ida, data->id);
+	ida_free(&aem_ida, data->id);
 id_err:
 	kfree(data);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] hwmon: Directly use ida_alloc()/free()
  2022-05-17  6:31 [PATCH 1/2] hwmon: Directly use ida_alloc()/free() keliu
  2022-05-17  6:31 ` [PATCH 2/2] " keliu
@ 2022-05-17 12:48 ` Guenter Roeck
  1 sibling, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2022-05-17 12:48 UTC (permalink / raw)
  To: keliu; +Cc: jdelvare, linux-hwmon, linux-kernel

On Tue, May 17, 2022 at 06:31:25AM +0000, keliu wrote:
> Use ida_alloc()/ida_free() instead of deprecated
> ida_simple_get()/ida_simple_remove() .
> 
> Signed-off-by: keliu <liuke94@huawei.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/hwmon.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
> index 22de7a9e7ba7..2e2cd79d89eb 100644
> --- a/drivers/hwmon/hwmon.c
> +++ b/drivers/hwmon/hwmon.c
> @@ -764,7 +764,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
>  			 "hwmon: '%s' is not a valid name attribute, please fix\n",
>  			 name);
>  
> -	id = ida_simple_get(&hwmon_ida, 0, 0, GFP_KERNEL);
> +	id = ida_alloc(&hwmon_ida, GFP_KERNEL);
>  	if (id < 0)
>  		return ERR_PTR(id);
>  
> @@ -856,7 +856,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
>  free_hwmon:
>  	hwmon_dev_release(hdev);
>  ida_remove:
> -	ida_simple_remove(&hwmon_ida, id);
> +	ida_free(&hwmon_ida, id);
>  	return ERR_PTR(err);
>  }
>  
> @@ -968,7 +968,7 @@ void hwmon_device_unregister(struct device *dev)
>  
>  	if (likely(sscanf(dev_name(dev), HWMON_ID_FORMAT, &id) == 1)) {
>  		device_unregister(dev);
> -		ida_simple_remove(&hwmon_ida, id);
> +		ida_free(&hwmon_ida, id);
>  	} else
>  		dev_dbg(dev->parent,
>  			"hwmon_device_unregister() failed: bad class ID!\n");

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] hwmon: Directly use ida_alloc()/free()
  2022-05-17  6:31 ` [PATCH 2/2] " keliu
@ 2022-05-17 12:50   ` Guenter Roeck
  0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2022-05-17 12:50 UTC (permalink / raw)
  To: keliu; +Cc: jdelvare, linux-hwmon, linux-kernel

On Tue, May 17, 2022 at 06:31:26AM +0000, keliu wrote:
> Use ida_alloc()/ida_free() instead of deprecated
> ida_simple_get()/ida_simple_remove() .
> 
> Signed-off-by: keliu <liuke94@huawei.com>

Applied, after updating subject to include the driver name.

Guenter

> ---
>  drivers/hwmon/ibmaem.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c
> index de6baf6ca3d1..5c4cf742f5ae 100644
> --- a/drivers/hwmon/ibmaem.c
> +++ b/drivers/hwmon/ibmaem.c
> @@ -482,7 +482,7 @@ static void aem_delete(struct aem_data *data)
>  	ipmi_destroy_user(data->ipmi.user);
>  	platform_set_drvdata(data->pdev, NULL);
>  	platform_device_unregister(data->pdev);
> -	ida_simple_remove(&aem_ida, data->id);
> +	ida_free(&aem_ida, data->id);
>  	kfree(data);
>  }
>  
> @@ -539,7 +539,7 @@ static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle)
>  		data->power_period[i] = AEM_DEFAULT_POWER_INTERVAL;
>  
>  	/* Create sub-device for this fw instance */
> -	data->id = ida_simple_get(&aem_ida, 0, 0, GFP_KERNEL);
> +	data->id = ida_alloc(&aem_ida, GFP_KERNEL);
>  	if (data->id < 0)
>  		goto id_err;
>  
> @@ -600,7 +600,7 @@ static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle)
>  	platform_set_drvdata(data->pdev, NULL);
>  	platform_device_unregister(data->pdev);
>  dev_err:
> -	ida_simple_remove(&aem_ida, data->id);
> +	ida_free(&aem_ida, data->id);
>  id_err:
>  	kfree(data);
>  
> @@ -679,7 +679,7 @@ static int aem_init_aem2_inst(struct aem_ipmi_data *probe,
>  		data->power_period[i] = AEM_DEFAULT_POWER_INTERVAL;
>  
>  	/* Create sub-device for this fw instance */
> -	data->id = ida_simple_get(&aem_ida, 0, 0, GFP_KERNEL);
> +	data->id = ida_alloc(&aem_ida, GFP_KERNEL);
>  	if (data->id < 0)
>  		goto id_err;
>  
> @@ -740,7 +740,7 @@ static int aem_init_aem2_inst(struct aem_ipmi_data *probe,
>  	platform_set_drvdata(data->pdev, NULL);
>  	platform_device_unregister(data->pdev);
>  dev_err:
> -	ida_simple_remove(&aem_ida, data->id);
> +	ida_free(&aem_ida, data->id);
>  id_err:
>  	kfree(data);
>  

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-17 12:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-17  6:31 [PATCH 1/2] hwmon: Directly use ida_alloc()/free() keliu
2022-05-17  6:31 ` [PATCH 2/2] " keliu
2022-05-17 12:50   ` Guenter Roeck
2022-05-17 12:48 ` [PATCH 1/2] " Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).