Skip to content

Commit 8f09142

Browse files
tititiou36akpm00
authored andcommitted
idr test suite: remove usage of the deprecated ida_simple_xx() API
Patch series "ida: Remove the ida_simple_xxx() API", v3. These are the final steps in removing the ida_simple_xxx() API. This series was last proposed in August 2024. Since then, some users of the old API have be re-introduced and then removed. A first time in drivers/misc/rpmb-core.c, added in commit 1e9046e ("rpmb: add Replay Protected Memory Block (RPMB) subsystem") (2024-08-26) and removed in commit dfc881a ("rpmb: Remove usage of the deprecated ida_simple_xx() API") (2024-10-13). A second time in drivers/gpio/gpio-mpsse.c, added in commit c46a74f ("gpio: add support for FTDI's MPSSE as GPIO") (2024-10-14) and removed in commit f57c084 (gpio: mpsse: Remove usage of the deprecated ida_simple_xx() API) (2024-11-22). Since then, I've not spotted any new usage. So things being stable now, it's time to end this story once and for all. This patch (of 3): ida_alloc() and ida_free() should be preferred to the deprecated ida_simple_get() and ida_simple_remove(). Note that the upper limit of ida_simple_get() is exclusive, but the one of ida_alloc_range()/ida_alloc_max() is inclusive. But because of the ranges used for the tests, there is no need to adjust them. While at it remove some useless {}. Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/2904fa2006e4fe58eea63aef87fa7f832c7804a1.1752480043.git.christophe.jaillet@wanadoo.fr Signed-off-by: Christophe JAILLET <[email protected]> Acked-by: Matthew Wilcox (Oracle) <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 1455b6a commit 8f09142

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

tools/testing/radix-tree/idr-test.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -499,19 +499,17 @@ void ida_check_random(void)
499499
goto repeat;
500500
}
501501

502-
void ida_simple_get_remove_test(void)
502+
void ida_alloc_free_test(void)
503503
{
504504
DEFINE_IDA(ida);
505505
unsigned long i;
506506

507-
for (i = 0; i < 10000; i++) {
508-
assert(ida_simple_get(&ida, 0, 20000, GFP_KERNEL) == i);
509-
}
510-
assert(ida_simple_get(&ida, 5, 30, GFP_KERNEL) < 0);
507+
for (i = 0; i < 10000; i++)
508+
assert(ida_alloc_max(&ida, 20000, GFP_KERNEL) == i);
509+
assert(ida_alloc_range(&ida, 5, 30, GFP_KERNEL) < 0);
511510

512-
for (i = 0; i < 10000; i++) {
513-
ida_simple_remove(&ida, i);
514-
}
511+
for (i = 0; i < 10000; i++)
512+
ida_free(&ida, i);
515513
assert(ida_is_empty(&ida));
516514

517515
ida_destroy(&ida);
@@ -524,7 +522,7 @@ void user_ida_checks(void)
524522
ida_check_nomem();
525523
ida_check_conv_user();
526524
ida_check_random();
527-
ida_simple_get_remove_test();
525+
ida_alloc_free_test();
528526

529527
radix_tree_cpu_dead(1);
530528
}

0 commit comments

Comments
 (0)