public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] misc: pci_endpoint_test: Remove usage of the deprecated ida_simple_xx() API
@ 2023-12-19  6:15 Christophe JAILLET
  2023-12-20 11:45 ` Manivannan Sadhasivam
  2023-12-31 11:16 ` Krzysztof Wilczyński
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2023-12-19  6:15 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Kishon Vijay Abraham I, Arnd Bergmann,
	Greg Kroah-Hartman
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-pci

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/misc/pci_endpoint_test.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index af519088732d..34124bdce68c 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -860,7 +860,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
 
 	pci_set_drvdata(pdev, test);
 
-	id = ida_simple_get(&pci_endpoint_test_ida, 0, 0, GFP_KERNEL);
+	id = ida_alloc(&pci_endpoint_test_ida, GFP_KERNEL);
 	if (id < 0) {
 		err = id;
 		dev_err(dev, "Unable to get id\n");
@@ -907,7 +907,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
 	kfree(test->name);
 
 err_ida_remove:
-	ida_simple_remove(&pci_endpoint_test_ida, id);
+	ida_free(&pci_endpoint_test_ida, id);
 
 err_iounmap:
 	for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) {
@@ -943,7 +943,7 @@ static void pci_endpoint_test_remove(struct pci_dev *pdev)
 	misc_deregister(&test->miscdev);
 	kfree(misc_device->name);
 	kfree(test->name);
-	ida_simple_remove(&pci_endpoint_test_ida, id);
+	ida_free(&pci_endpoint_test_ida, id);
 	for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) {
 		if (test->bar[bar])
 			pci_iounmap(pdev, test->bar[bar]);
-- 
2.34.1


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

* Re: [PATCH] misc: pci_endpoint_test: Remove usage of the deprecated ida_simple_xx() API
  2023-12-19  6:15 [PATCH] misc: pci_endpoint_test: Remove usage of the deprecated ida_simple_xx() API Christophe JAILLET
@ 2023-12-20 11:45 ` Manivannan Sadhasivam
  2023-12-31 11:16 ` Krzysztof Wilczyński
  1 sibling, 0 replies; 3+ messages in thread
From: Manivannan Sadhasivam @ 2023-12-20 11:45 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Lorenzo Pieralisi, Krzysztof Wilczyński,
	Kishon Vijay Abraham I, Arnd Bergmann, Greg Kroah-Hartman,
	linux-kernel, kernel-janitors, linux-pci

On Tue, Dec 19, 2023 at 07:15:37AM +0100, 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>

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

- Mani

> ---
>  drivers/misc/pci_endpoint_test.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
> index af519088732d..34124bdce68c 100644
> --- a/drivers/misc/pci_endpoint_test.c
> +++ b/drivers/misc/pci_endpoint_test.c
> @@ -860,7 +860,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
>  
>  	pci_set_drvdata(pdev, test);
>  
> -	id = ida_simple_get(&pci_endpoint_test_ida, 0, 0, GFP_KERNEL);
> +	id = ida_alloc(&pci_endpoint_test_ida, GFP_KERNEL);
>  	if (id < 0) {
>  		err = id;
>  		dev_err(dev, "Unable to get id\n");
> @@ -907,7 +907,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
>  	kfree(test->name);
>  
>  err_ida_remove:
> -	ida_simple_remove(&pci_endpoint_test_ida, id);
> +	ida_free(&pci_endpoint_test_ida, id);
>  
>  err_iounmap:
>  	for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) {
> @@ -943,7 +943,7 @@ static void pci_endpoint_test_remove(struct pci_dev *pdev)
>  	misc_deregister(&test->miscdev);
>  	kfree(misc_device->name);
>  	kfree(test->name);
> -	ida_simple_remove(&pci_endpoint_test_ida, id);
> +	ida_free(&pci_endpoint_test_ida, id);
>  	for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) {
>  		if (test->bar[bar])
>  			pci_iounmap(pdev, test->bar[bar]);
> -- 
> 2.34.1
> 

-- 
மணிவண்ணன் சதாசிவம்

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

* Re: [PATCH] misc: pci_endpoint_test: Remove usage of the deprecated ida_simple_xx() API
  2023-12-19  6:15 [PATCH] misc: pci_endpoint_test: Remove usage of the deprecated ida_simple_xx() API Christophe JAILLET
  2023-12-20 11:45 ` Manivannan Sadhasivam
@ 2023-12-31 11:16 ` Krzysztof Wilczyński
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Wilczyński @ 2023-12-31 11:16 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Lorenzo Pieralisi, Manivannan Sadhasivam, Kishon Vijay Abraham I,
	Arnd Bergmann, Greg Kroah-Hartman, linux-kernel, kernel-janitors,
	linux-pci

Hello,

> ida_alloc() and ida_free() should be preferred to the deprecated
> ida_simple_get() and ida_simple_remove().
> 
> This is less verbose.

Applied to remove-old-api, thank you!

[1/1] misc: pci_endpoint_test: Remove usage of the deprecated ida_simple_*() API
      https://git.kernel.org/pci/pci/c/130f335630b6

	Krzysztof

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

end of thread, other threads:[~2023-12-31 11:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-19  6:15 [PATCH] misc: pci_endpoint_test: Remove usage of the deprecated ida_simple_xx() API Christophe JAILLET
2023-12-20 11:45 ` Manivannan Sadhasivam
2023-12-31 11:16 ` Krzysztof Wilczyński

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox