diff mbox series

idr-test: ida_simple_get/remove are deprecated, so switch to ida_alloc/free.

Message ID 20241122115425.3820230-1-zhangheng@kylinos.cn (mailing list archive)
State New
Headers show
Series idr-test: ida_simple_get/remove are deprecated, so switch to ida_alloc/free. | expand

Commit Message

zhangheng Nov. 22, 2024, 11:54 a.m. UTC
Signed-off-by: zhangheng <zhangheng@kylinos.cn>
---
 tools/testing/radix-tree/idr-test.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Christophe JAILLET Nov. 22, 2024, 12:50 p.m. UTC | #1
Le 22/11/2024 à 12:54, zhangheng a écrit :
> Signed-off-by: zhangheng <zhangheng@kylinos.cn>
> ---
>   tools/testing/radix-tree/idr-test.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/radix-tree/idr-test.c b/tools/testing/radix-tree/idr-test.c
> index 84b8c3c92c79..7fb04a830a21 100644
> --- a/tools/testing/radix-tree/idr-test.c
> +++ b/tools/testing/radix-tree/idr-test.c
> @@ -505,12 +505,12 @@ void ida_simple_get_remove_test(void)
>   	unsigned long i;
>   
>   	for (i = 0; i < 10000; i++) {
> -		assert(ida_simple_get(&ida, 0, 20000, GFP_KERNEL) == i);
> +		assert(ida_alloc_range(&ida, 0, 19999, GFP_KERNEL) == i);
>   	}
> -	assert(ida_simple_get(&ida, 5, 30, GFP_KERNEL) < 0);
> +	assert(ida_alloc_range(&ida, 5, 29, GFP_KERNEL) < 0);
>   
>   	for (i = 0; i < 10000; i++) {
> -		ida_simple_remove(&ida, i);
> +		ida_free(&ida, i);
>   	}
>   	assert(ida_is_empty(&ida));
>   

Hi,

A more complete fix for this specific file is available at [0].


please also see the serie at [1], resent at [2].
It was delayed because another usage of the API was added, and then 
fixed [3].

After that, drivers/gpio/gpio-mpsse.c also re-introduced another usage.
The fix for this one was apparently never sent. This is now done. [4]

CJ

[0]: 
https://lore.kernel.org/linux-kernel/715cff763aa4b2c174cc649750e14e404db6e65b.1722853349.git.christophe.jaillet@wanadoo.fr/

[1]: 
https://lore.kernel.org/linux-kernel/81f44a41b7ccceb26a802af473f931799445821a.1705683269.git.christophe.jaillet@wanadoo.fr/

[2]: 
https://lore.kernel.org/linux-kernel/cover.1722853349.git.christophe.jaillet@wanadoo.fr/

[3]: 
https://lore.kernel.org/linux-kernel/df8bfbe2a603c596566a4f967e37d10d208bbc3f.1728507153.git.christophe.jaillet@wanadoo.fr/

[4]: 
https://lore.kernel.org/linux-kernel/2ce706d3242b9d3e4b9c20c0a7d9a8afcf8897ec.1729423829.git.christophe.jaillet@wanadoo.fr/
diff mbox series

Patch

diff --git a/tools/testing/radix-tree/idr-test.c b/tools/testing/radix-tree/idr-test.c
index 84b8c3c92c79..7fb04a830a21 100644
--- a/tools/testing/radix-tree/idr-test.c
+++ b/tools/testing/radix-tree/idr-test.c
@@ -505,12 +505,12 @@  void ida_simple_get_remove_test(void)
 	unsigned long i;
 
 	for (i = 0; i < 10000; i++) {
-		assert(ida_simple_get(&ida, 0, 20000, GFP_KERNEL) == i);
+		assert(ida_alloc_range(&ida, 0, 19999, GFP_KERNEL) == i);
 	}
-	assert(ida_simple_get(&ida, 5, 30, GFP_KERNEL) < 0);
+	assert(ida_alloc_range(&ida, 5, 29, GFP_KERNEL) < 0);
 
 	for (i = 0; i < 10000; i++) {
-		ida_simple_remove(&ida, i);
+		ida_free(&ida, i);
 	}
 	assert(ida_is_empty(&ida));