mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
idr: Return the deleted entry from idr_remove
It is a relatively common idiom (8 instances) to first look up an IDR entry, and then remove it from the tree if it is found, possibly doing further operations upon the entry afterwards. If we change idr_remove() to return the removed object, all of these users can save themselves a walk of the IDR tree. Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
This commit is contained in:
parent
8ac0486831
commit
d3e709e63e
9 changed files with 15 additions and 29 deletions
|
@ -88,9 +88,9 @@ void *idr_get_next(struct idr *, int *nextid);
|
|||
void *idr_replace(struct idr *, void *, int id);
|
||||
void idr_destroy(struct idr *);
|
||||
|
||||
static inline void idr_remove(struct idr *idr, int id)
|
||||
static inline void *idr_remove(struct idr *idr, int id)
|
||||
{
|
||||
radix_tree_delete(&idr->idr_rt, id);
|
||||
return radix_tree_delete_item(&idr->idr_rt, id, NULL);
|
||||
}
|
||||
|
||||
static inline void idr_init(struct idr *idr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue