From 05f7a7d6a7d23a877063857cf2df1dffec5a96dc Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Mon, 8 Aug 2011 23:36:56 +0200 Subject: idr: Add new function idr_is_empty() Signed-off-by: Andreas Gruenbacher Signed-off-by: Philipp Reisner --- lib/idr.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib') diff --git a/lib/idr.c b/lib/idr.c index bfe4db4e165..1ba4956bfbf 100644 --- a/lib/idr.c +++ b/lib/idr.c @@ -869,6 +869,16 @@ void idr_init(struct idr *idp) } EXPORT_SYMBOL(idr_init); +static int idr_has_entry(int id, void *p, void *data) +{ + return 1; +} + +bool idr_is_empty(struct idr *idp) +{ + return !idr_for_each(idp, idr_has_entry, NULL); +} +EXPORT_SYMBOL(idr_is_empty); /** * DOC: IDA description -- cgit v1.2.3-18-g5258