diff options
author | Matthew Wilcox <mawilcox@microsoft.com> | 2018-02-06 15:05:49 -0500 |
---|---|---|
committer | Matthew Wilcox <mawilcox@microsoft.com> | 2018-02-06 16:41:29 -0500 |
commit | ac665d9423474e64e64b34b0e2cea43601b50d7d (patch) | |
tree | 7e74505b3e71b90f303d52b3bf66bc65d609e48c /include | |
parent | 6ce711f2750031d12cec91384ac5cfa0a485b60a (diff) |
idr: Add documentation
Move the idr kernel-doc to its own idr.rst file and add a few
paragraphs about how to use it. Also add some more kernel-doc.
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/idr.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/include/linux/idr.h b/include/linux/idr.h index 86b38df6e121..7d6a6313f0ab 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h @@ -36,7 +36,6 @@ struct idr { .idr_base = (base), \ .idr_next = 0, \ } -#define DEFINE_IDR(name) struct idr name = IDR_INIT /** * IDR_INIT() - Initialise an IDR. @@ -46,6 +45,15 @@ struct idr { #define IDR_INIT IDR_INIT_BASE(0) /** + * DEFINE_IDR() - Define a statically-allocated IDR + * @name: Name of IDR + * + * An IDR defined using this macro is ready for use with no additional + * initialisation required. It contains no IDs. + */ +#define DEFINE_IDR(name) struct idr name = IDR_INIT + +/** * idr_get_cursor - Return the current position of the cyclic allocator * @idr: idr handle * @@ -130,6 +138,12 @@ static inline void idr_init(struct idr *idr) idr_init_base(idr, 0); } +/** + * idr_is_empty() - Are there any IDs allocated? + * @idr: IDR handle. + * + * Return: %true if any IDs have been allocated from this IDR. + */ static inline bool idr_is_empty(const struct idr *idr) { return radix_tree_empty(&idr->idr_rt) && |