aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTejun Heo2013-02-27 19:03:52 -0600
committerLinus Torvalds2013-02-27 21:10:14 -0600
commit49038ef4fbe2842bd4d8338f89ec5c9ba71b0ae1 (patch)
treeefe83b3396bd93c1154edf1375a899811d62dde3 /lib
parent4106ecaf59b79efff3f9b466baf9e8c67e19ac5a (diff)
downloadam43-linux-kernel-49038ef4fbe2842bd4d8338f89ec5c9ba71b0ae1.tar.gz
am43-linux-kernel-49038ef4fbe2842bd4d8338f89ec5c9ba71b0ae1.tar.xz
am43-linux-kernel-49038ef4fbe2842bd4d8338f89ec5c9ba71b0ae1.zip
idr: relocate idr_for_each_entry() and reorganize id[r|a]_get_new()
* Move idr_for_each_entry() definition next to other idr related definitions. * Make id[r|a]_get_new() inline wrappers of id[r|a]_get_new_above(). This changes the implementation of idr_get_new() but the new implementation is trivial. This patch doesn't introduce any functional change. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/idr.c49
1 files changed, 0 insertions, 49 deletions
diff --git a/lib/idr.c b/lib/idr.c
index 814c53ce0d4..282841b5a56 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -317,36 +317,6 @@ int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id)
317} 317}
318EXPORT_SYMBOL(idr_get_new_above); 318EXPORT_SYMBOL(idr_get_new_above);
319 319
320/**
321 * idr_get_new - allocate new idr entry
322 * @idp: idr handle
323 * @ptr: pointer you want associated with the id
324 * @id: pointer to the allocated handle
325 *
326 * If allocation from IDR's private freelist fails, idr_get_new_above() will
327 * return %-EAGAIN. The caller should retry the idr_pre_get() call to refill
328 * IDR's preallocation and then retry the idr_get_new_above() call.
329 *
330 * If the idr is full idr_get_new_above() will return %-ENOSPC.
331 *
332 * @id returns a value in the range %0 ... %0x7fffffff
333 */
334int idr_get_new(struct idr *idp, void *ptr, int *id)
335{
336 int rv;
337
338 rv = idr_get_new_above_int(idp, ptr, 0);
339 /*
340 * This is a cheap hack until the IDR code can be fixed to
341 * return proper error values.
342 */
343 if (rv < 0)
344 return _idr_rc_to_errno(rv);
345 *id = rv;
346 return 0;
347}
348EXPORT_SYMBOL(idr_get_new);
349
350static void idr_remove_warning(int id) 320static void idr_remove_warning(int id)
351{ 321{
352 printk(KERN_WARNING 322 printk(KERN_WARNING
@@ -857,25 +827,6 @@ int ida_get_new_above(struct ida *ida, int starting_id, int *p_id)
857EXPORT_SYMBOL(ida_get_new_above); 827EXPORT_SYMBOL(ida_get_new_above);
858 828
859/** 829/**
860 * ida_get_new - allocate new ID
861 * @ida: idr handle
862 * @p_id: pointer to the allocated handle
863 *
864 * Allocate new ID. It should be called with any required locks.
865 *
866 * If memory is required, it will return %-EAGAIN, you should unlock
867 * and go back to the idr_pre_get() call. If the idr is full, it will
868 * return %-ENOSPC.
869 *
870 * @p_id returns a value in the range %0 ... %0x7fffffff.
871 */
872int ida_get_new(struct ida *ida, int *p_id)
873{
874 return ida_get_new_above(ida, 0, p_id);
875}
876EXPORT_SYMBOL(ida_get_new);
877
878/**
879 * ida_remove - remove the given ID 830 * ida_remove - remove the given ID
880 * @ida: ida handle 831 * @ida: ida handle
881 * @id: ID to free 832 * @id: ID to free