@@ -320,16 +320,9 @@ EXPORT_SYMBOL(idr_replace);
320
320
* ida_alloc(), ida_alloc_min(), ida_alloc_max() or ida_alloc_range().
321
321
* To free an ID, call ida_free().
322
322
*
323
- * If you have more complex locking requirements, use a loop around
324
- * ida_pre_get() and ida_get_new() to allocate a new ID. Then use
325
- * ida_remove() to free an ID. You must make sure that ida_get_new() and
326
- * ida_remove() cannot be called at the same time as each other for the
327
- * same IDA.
328
- *
329
- * You can also use ida_get_new_above() if you need an ID to be allocated
330
- * above a particular number. ida_destroy() can be used to dispose of an
331
- * IDA without needing to free the individual IDs in it. You can use
332
- * ida_is_empty() to find out whether the IDA has any IDs currently allocated.
323
+ * ida_destroy() can be used to dispose of an IDA without needing to
324
+ * free the individual IDs in it. You can use ida_is_empty() to find
325
+ * out whether the IDA has any IDs currently allocated.
333
326
*
334
327
* IDs are currently limited to the range [0-INT_MAX]. If this is an awkward
335
328
* limitation, it should be quite straightforward to raise the maximum.
@@ -370,25 +363,7 @@ EXPORT_SYMBOL(idr_replace);
370
363
371
364
#define IDA_MAX (0x80000000U / IDA_BITMAP_BITS - 1)
372
365
373
- /**
374
- * ida_get_new_above - allocate new ID above or equal to a start id
375
- * @ida: ida handle
376
- * @start: id to start search at
377
- * @id: pointer to the allocated handle
378
- *
379
- * Allocate new ID above or equal to @start. It should be called
380
- * with any required locks to ensure that concurrent calls to
381
- * ida_get_new_above() / ida_get_new() / ida_remove() are not allowed.
382
- * Consider using ida_alloc_range() if you do not have complex locking
383
- * requirements.
384
- *
385
- * If memory is required, it will return %-EAGAIN, you should unlock
386
- * and go back to the ida_pre_get() call. If the ida is full, it will
387
- * return %-ENOSPC. On success, it will return 0.
388
- *
389
- * @id returns a value in the range @start ... %0x7fffffff.
390
- */
391
- int ida_get_new_above (struct ida * ida , int start , int * id )
366
+ static int ida_get_new_above (struct ida * ida , int start , int * id )
392
367
{
393
368
struct radix_tree_root * root = & ida -> ida_rt ;
394
369
void __rcu * * slot ;
@@ -473,16 +448,8 @@ int ida_get_new_above(struct ida *ida, int start, int *id)
473
448
return 0 ;
474
449
}
475
450
}
476
- EXPORT_SYMBOL (ida_get_new_above );
477
451
478
- /**
479
- * ida_remove - Free the given ID
480
- * @ida: ida handle
481
- * @id: ID to free
482
- *
483
- * This function should not be called at the same time as ida_get_new_above().
484
- */
485
- void ida_remove (struct ida * ida , int id )
452
+ static void ida_remove (struct ida * ida , int id )
486
453
{
487
454
unsigned long index = id / IDA_BITMAP_BITS ;
488
455
unsigned offset = id % IDA_BITMAP_BITS ;
@@ -519,9 +486,8 @@ void ida_remove(struct ida *ida, int id)
519
486
}
520
487
return ;
521
488
err :
522
- WARN (1 , "ida_remove called for id=%d which is not allocated.\n" , id );
489
+ WARN (1 , "ida_free called for id=%d which is not allocated.\n" , id );
523
490
}
524
- EXPORT_SYMBOL (ida_remove );
525
491
526
492
/**
527
493
* ida_destroy() - Free all IDs.
@@ -568,7 +534,7 @@ EXPORT_SYMBOL(ida_destroy);
568
534
int ida_alloc_range (struct ida * ida , unsigned int min , unsigned int max ,
569
535
gfp_t gfp )
570
536
{
571
- int ret , id ;
537
+ int ret , id = 0 ;
572
538
unsigned long flags ;
573
539
574
540
if ((int )min < 0 )
0 commit comments