backports: add idr_for_each_entry()
authorJohannes Berg <johannes.berg@intel.com>
Tue, 7 Feb 2017 13:12:19 +0000 (14:12 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 7 Feb 2017 14:07:21 +0000 (15:07 +0100)
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
backport/backport-include/linux/idr.h

index 737632bf5e7332d1ccac51a3f7ac80f22749c19e..d4ad95224ba87e0715008cb947e0dc0f5a434a72 100644 (file)
@@ -56,4 +56,9 @@ static inline void idr_preload_end(void)
 }
 #endif
 
+#ifndef idr_for_each_entry
+#define idr_for_each_entry(idp, entry, id)                     \
+       for (id = 0; ((entry) = idr_get_next(idp, &(id))) != NULL; ++id)
+#endif
+
 #endif /* __BACKPORT_IDR_H */