Skip to content

Commit bf66171

Browse files
mszyprowrobherring
authored andcommitted
of: reserved_mem: clarify fdt_scan_reserved_mem*() functions
Rename fdt_scan_reserved_mem_reg_nodes() to fdt_scan_reserved_mem_late() to clearly show how it differs from fdt_scan_reserved_mem() and update description of both functions. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Link: https://patch.msgid.link/20260325090023.3175348-7-m.szyprowski@samsung.com Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
1 parent 427864f commit bf66171

3 files changed

Lines changed: 17 additions & 11 deletions

File tree

drivers/of/fdt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,7 @@ void __init unflatten_device_tree(void)
12741274
void *fdt = initial_boot_params;
12751275

12761276
/* Save the statically-placed regions in the reserved_mem array */
1277-
fdt_scan_reserved_mem_reg_nodes();
1277+
fdt_scan_reserved_mem_late();
12781278

12791279
/* Populate an empty root node when bootloader doesn't provide one */
12801280
if (!fdt) {

drivers/of/of_private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static inline struct device_node *__of_get_dma_parent(const struct device_node *
186186
#endif
187187

188188
int fdt_scan_reserved_mem(void);
189-
void __init fdt_scan_reserved_mem_reg_nodes(void);
189+
void __init fdt_scan_reserved_mem_late(void);
190190

191191
bool of_fdt_device_is_available(const void *blob, unsigned long node);
192192

drivers/of/of_reserved_mem.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -265,16 +265,15 @@ static void __init __rmem_check_for_overlap(void)
265265
}
266266

267267
/**
268-
* fdt_scan_reserved_mem_reg_nodes() - Store info for the "reg" defined
269-
* reserved memory regions.
268+
* fdt_scan_reserved_mem_late() - Scan FDT and initialize remaining reserved
269+
* memory regions.
270270
*
271-
* This function is used to scan through the DT and store the
272-
* information for the reserved memory regions that are defined using
273-
* the "reg" property. The region node number, name, base address, and
274-
* size are all stored in the reserved_mem array by calling the
275-
* fdt_reserved_mem_save_node() function.
271+
* This function is used to scan again through the DT and initialize the
272+
* "static" reserved memory regions, that are defined using the "reg"
273+
* property. Each such region is then initialized with its specific init
274+
* function and stored in the global reserved_mem array.
276275
*/
277-
void __init fdt_scan_reserved_mem_reg_nodes(void)
276+
void __init fdt_scan_reserved_mem_late(void)
278277
{
279278
const void *fdt = initial_boot_params;
280279
phys_addr_t base, size;
@@ -328,7 +327,14 @@ void __init fdt_scan_reserved_mem_reg_nodes(void)
328327
static int __init __reserved_mem_alloc_size(unsigned long node, const char *uname);
329328

330329
/*
331-
* fdt_scan_reserved_mem() - scan a single FDT node for reserved memory
330+
* fdt_scan_reserved_mem() - reserve and allocate memory occupied by
331+
* reserved memory regions.
332+
*
333+
* This function is used to scan through the FDT and mark memory occupied
334+
* by all static (defined by the "reg" property) reserved memory regions.
335+
* Then memory for all dynamic regions (defined by size & alignment) is
336+
* allocated, a region specific init function is called and region information
337+
* is stored in the reserved_mem array.
332338
*/
333339
int __init fdt_scan_reserved_mem(void)
334340
{

0 commit comments

Comments
 (0)