[PATCH 2/4] backports: add backport for idr_remove

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Since commit d3e709e63e97 ("idr: Return the deleted entry from
idr_remove") the function signature changed so provide a backport
which does a idr_find() and subsequent idr_remove().

Signed-off-by: Arend van Spriel <arend.vanspriel@xxxxxxxxxxxx>
Hi Johannes,

Not sure if the find/remove approach is a good one here. Better solutions
are welcome.

 backport/backport-include/linux/idr.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/backport/backport-include/linux/idr.h b/backport/backport-include/linux/idr.h
index d7cf9f0..01aa2c2 100644
--- a/backport/backport-include/linux/idr.h
+++ b/backport/backport-include/linux/idr.h
@@ -61,4 +61,14 @@ static inline void idr_preload_end(void)
 	for (id = 0; ((entry) = idr_get_next(idp, &(id))) != NULL; ++id)

+#if LINUX_VERSION_IS_LESS(4, 11, 0)
+static inline void *backport_idr_remove(struct idr *idr, int id)
+	void *item = idr_find(idr, id);
+	idr_remove(idr, id);
+	return item;
+#define idr_remove	backport_idr_remove
 #endif /* __BACKPORT_IDR_H */

To unsubscribe from this list: send the line "unsubscribe backports" in

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux