Skip to contentSkip to conversation

ida: Remove the ida_simple_xxx() API

PATCH Superseded Christophe JAILLET 2 participants 5 messages Aug 5, 2024 – Aug 7, 2024

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover ida: Remove the ida_simple_xxx() API

This is the final steps to remove the ida_simple_xxx() API.

Patch 1 updates the test suite. This is the last users of the API.

Patch 2 removes the old API.

Patch 3 is just a minor clean-up that still speak about the old API.

Christophe JAILLET (3):
idr test suite: Remove usage of the deprecated ida_simple_xx() API
ida: Remove the ida_simple_xxx() API
nvmem: Update a comment related to struct nvmem_config

 include/linux/idr.h                 |  8 --------
 include/linux/nvmem-provider.h      |  2 +-
 tools/testing/radix-tree/idr-test.c | 16 +++++++---------
 3 files changed, 8 insertions(+), 18 deletions(-)
Signature · 1 line
2.45.2
#1 lore raw

PATCH v2 1/3 idr test suite: Remove usage of the deprecated ida_simple_xx() API

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 {}.

---
Changes in v2:
- This patch was already proposed see [1]. This one also rename the function
used for the test: s/ida_simple_get_remove_test/ida_alloc_free_test/.
I've kept the A-b tag given at that time.

v1: https://lore.kernel.org/all/81f44a41b7ccceb26a802af473f931799445821a.1705683269.git.christophe.jaillet@wanadoo.fr/

---
 tools/testing/radix-tree/idr-test.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
tools/testing/radix-tree/idr-test.c +7 -9
index 84b8c3c92c79..2f830ff8396c 100644
@@ -499,19 +499,17 @@ void ida_check_random(void)
 		goto repeat;
 }
 
-void ida_simple_get_remove_test(void)
+void ida_alloc_free_test(void)
 {
 	DEFINE_IDA(ida);
 	unsigned long i;
 
-	for (i = 0; i < 10000; i++) {
-		assert(ida_simple_get(&ida, 0, 20000, GFP_KERNEL) == i);
-	}
-	assert(ida_simple_get(&ida, 5, 30, GFP_KERNEL) < 0);
+	for (i = 0; i < 10000; i++)
+		assert(ida_alloc_max(&ida, 20000, GFP_KERNEL) == i);
+	assert(ida_alloc_range(&ida, 5, 30, GFP_KERNEL) < 0);
 
-	for (i = 0; i < 10000; i++) {
-		ida_simple_remove(&ida, i);
-	}
+	for (i = 0; i < 10000; i++)
+		ida_free(&ida, i);
 	assert(ida_is_empty(&ida));
 
 	ida_destroy(&ida);
@@ -524,7 +522,7 @@ void user_ida_checks(void)
 	ida_check_nomem();
 	ida_check_conv_user();
 	ida_check_random();
-	ida_simple_get_remove_test();
+	ida_alloc_free_test();
 
 	radix_tree_cpu_dead(1);
 }
Signature · 1 line
2.45.2
#2 lore raw

PATCH v2 2/3 ida: Remove the ida_simple_xxx() API

In reply to Christophe JAILLET

All users of the ida_simple_xxx() have been converted. In Linux 6.11-rc2, the only callers are in tools/testing/.

So it is now time to remove the definition of this old and deprecated ida_simple_get() and ida_simple_remove().

---
v2: new patch

---
 include/linux/idr.h | 8 --------
 1 file changed, 8 deletions(-)
include/linux/idr.h +0 -8
index da5f5fa4a3a6..60216f8fc04c 100644
@@ -316,14 +316,6 @@ static inline void ida_init(struct ida *ida)
 	xa_init_flags(&ida->xa, IDA_INIT_FLAGS);
 }
 
-/*
- * ida_simple_get() and ida_simple_remove() are deprecated. Use
- * ida_alloc() and ida_free() instead respectively.
- */
-#define ida_simple_get(ida, start, end, gfp)	\
-			ida_alloc_range(ida, start, (end) - 1, gfp)
-#define ida_simple_remove(ida, id)	ida_free(ida, id)
-
 static inline bool ida_is_empty(const struct ida *ida)
 {
 	return xa_empty(&ida->xa);
Signature · 1 line
2.45.2
#3 lore raw

PATCH v2 3/3 nvmem: Update a comment related to struct nvmem_config

In reply to Christophe JAILLET

Update a comment to match the function used in nvmem_register(). ida_simple_get() was replaced by ida_alloc() in commit 1eb51d6a4fce ("nvmem: switch to simpler IDA interface")

---
Changes in v2:
- No chnages

v1: https://lore.kernel.org/all/032b8035bd1f2dcc13ffc781c8348d9fbdf9e3b2.1713606957.git.christophe.jaillet@wanadoo.fr/

---
 include/linux/nvmem-provider.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/nvmem-provider.h +1 -1
index 3ebeaa0ded00..9a5f262d20f5 100644
@@ -103,7 +103,7 @@ struct nvmem_cell_info {
  *
  * Note: A default "nvmem<id>" name will be assigned to the device if
  * no name is specified in its configuration. In such case "<id>" is
- * generated with ida_simple_get() and provided id field is ignored.
+ * generated with ida_alloc() and provided id field is ignored.
  *
  * Note: Specifying name and setting id to -1 implies a unique device
  * whose name is provided as-is (kept unaltered).
Signature · 1 line
2.45.2
#4 lore raw
In reply to Christophe JAILLET
Quoted 4 lines · Christophe JAILLET

This is the final steps to remove the ida_simple_xxx() API.

Patch 1 updates the test suite. This is the last users of the API.

Quoted 8 lines

Patch 2 removes the old API.

Patch 3 is just a minor clean-up that still speak about the old API.

Christophe JAILLET (3):
idr test suite: Remove usage of the deprecated ida_simple_xx() API
ida: Remove the ida_simple_xxx() API
nvmem: Update a comment related to struct nvmem_config

Congrats. :)

regards,
dan carpenter