Skip to content

Commit f958625

Browse files
ij-intelbjorn-helgaas
authored andcommitted
resource: Document find_resource_space() and resource_constraint
Document find_resource_space() and the struct resource_constraint as they are going to be exposed outside of resource.c. Link: https://lore.kernel.org/r/[email protected] Tested-by: Lidong Wang <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Mika Westerberg <[email protected]>
1 parent 8559125 commit f958625

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

kernel/resource.c

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,19 @@ struct resource iomem_resource = {
4848
};
4949
EXPORT_SYMBOL(iomem_resource);
5050

51-
/* constraints to be met while allocating resources */
51+
/**
52+
* struct resource_constraint - constraints to be met while searching empty
53+
* resource space
54+
* @min: The minimum address for the memory range
55+
* @max: The maximum address for the memory range
56+
* @align: Alignment for the start address of the empty space
57+
* @alignf: Additional alignment constraints callback
58+
* @alignf_data: Data provided for @alignf callback
59+
*
60+
* Contains the range and alignment constraints that have to be met during
61+
* find_resource_space(). @alignf can be NULL indicating no alignment beyond
62+
* @align is necessary.
63+
*/
5264
struct resource_constraint {
5365
resource_size_t min, max, align;
5466
resource_size_t (*alignf)(void *, const struct resource *,
@@ -686,8 +698,19 @@ next: if (!this || this->end == root->end)
686698
return -EBUSY;
687699
}
688700

689-
/*
690-
* Find empty space in the resource tree given range and alignment.
701+
/**
702+
* find_resource_space - Find empty space in the resource tree
703+
* @root: Root resource descriptor
704+
* @new: Resource descriptor awaiting an empty resource space
705+
* @size: The minimum size of the empty space
706+
* @constraint: The range and alignment constraints to be met
707+
*
708+
* Finds an empty space under @root in the resource tree satisfying range and
709+
* alignment @constraints.
710+
*
711+
* Return:
712+
* * %0 - if successful, @new members start, end, and flags are altered.
713+
* * %-EBUSY - if no empty space was found.
691714
*/
692715
static int find_resource_space(struct resource *root, struct resource *new,
693716
resource_size_t size,

0 commit comments

Comments
 (0)