diff mbox series

[46/46] of: reserved_mem: Delete the fdt_init_reserved_mem() function

Message ID 20240126235425.12233-47-quic_obabatun@quicinc.com (mailing list archive)
State New, archived
Headers show
Series Dynamic allocation of reserved_mem array. | expand

Commit Message

Oreoluwa Babatunde Jan. 26, 2024, 11:54 p.m. UTC
Delete the fdt_init_reserved_mem() function as all architectures have
been switched to using dt_init_reserved_mem(), which is basically a copy
of the function, but uses the unflatten devicetree APIs instead of the
fdt APIs.

Signed-off-by: Oreoluwa Babatunde <quic_obabatun@quicinc.com>
---
 drivers/of/of_reserved_mem.c    | 54 ---------------------------------
 include/linux/of_reserved_mem.h |  3 --
 2 files changed, 57 deletions(-)
diff mbox series

Patch

diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 3650efab0afd..3d1ab2325217 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -382,60 +382,6 @@  static void __init __rmem_check_for_overlap(void)
 	}
 }
 
-/**
- * fdt_init_reserved_mem() - allocate and init all saved reserved memory regions
- */
-void __init fdt_init_reserved_mem(void)
-{
-	int i, ret;
-
-	ret = alloc_reserved_mem_array();
-	if (ret)
-		pr_err("Failed to allocate memory for reserved_mem array with err: %d", ret);
-
-	dt_scan_reserved_mem_reg_nodes();
-
-	/* check for overlapping reserved regions */
-	__rmem_check_for_overlap();
-
-	for (i = 0; i < reserved_mem_count; i++) {
-		struct reserved_mem *rmem = &reserved_mem[i];
-		struct device_node *node = rmem->dev_node;
-		int len;
-		const __be32 *prop;
-		int err = 0;
-		bool nomap;
-
-		nomap = of_get_property(node, "no-map", NULL) != NULL;
-		prop = of_get_property(node, "phandle", &len);
-		if (!prop)
-			prop = of_get_property(node, "linux,phandle", &len);
-		if (prop)
-			rmem->phandle = of_read_number(prop, len/4);
-
-		err = __reserved_mem_init_node(rmem);
-		if (err != 0 && err != -ENOENT) {
-			pr_info("node %s compatible matching fail\n",
-				rmem->name);
-			if (nomap)
-				memblock_clear_nomap(rmem->base, rmem->size);
-			else
-				memblock_phys_free(rmem->base,
-						   rmem->size);
-		} else {
-			phys_addr_t end = rmem->base + rmem->size - 1;
-			bool reusable =
-				(of_get_property(node, "reusable", NULL)) != NULL;
-
-			pr_info("%pa..%pa (%lu KiB) %s %s %s\n",
-				&rmem->base, &end, (unsigned long)(rmem->size / SZ_1K),
-				nomap ? "nomap" : "map",
-				reusable ? "reusable" : "non-reusable",
-				rmem->name ? rmem->name : "unknown");
-		}
-	}
-}
-
 /**
  * dt_init_reserved_mem() - allocate and init all saved reserved memory regions
  */
diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h
index b1f71a4894aa..dd67b9b2488e 100644
--- a/include/linux/of_reserved_mem.h
+++ b/include/linux/of_reserved_mem.h
@@ -33,7 +33,6 @@  typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem);
 	_OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn)
 
 void dt_init_reserved_mem(void);
-void fdt_init_reserved_mem(void);
 int of_reserved_mem_device_init_by_idx(struct device *dev,
 				       struct device_node *np, int idx);
 int of_reserved_mem_device_init_by_name(struct device *dev,
@@ -50,8 +49,6 @@  struct reserved_mem *of_reserved_mem_lookup(struct device_node *np);
 
 static inline void dt_init_reserved_mem(void) { }
 
-static inline void fdt_init_reserved_mem(void) { }
-
 static inline int of_reserved_mem_device_init_by_idx(struct device *dev,
 					struct device_node *np, int idx)
 {