[PATCH] of: move ramoops device creation into common code

Ahmad Fatoum a.fatoum at pengutronix.de
Wed May 15 04:22:54 PDT 2024


We already have a generic place where we check for reserved memory
matches, so add ramoops there as well.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/of/base.c |  1 +
 fs/pstore/ram.c   | 15 ---------------
 2 files changed, 1 insertion(+), 15 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 3b8878f34be3..2213165fd72d 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2735,6 +2735,7 @@ static void of_platform_device_create_root(struct device_node *np)
 }
 
 static const struct of_device_id reserved_mem_matches[] = {
+	{ .compatible = "ramoops" },
 	{ .compatible = "nvmem-rmem" },
 	{}
 };
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 9ecf7ef5e901..4cdeca904fad 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -685,21 +685,6 @@ static struct driver ramoops_driver = {
 
 static int __init ramoops_init(void)
 {
-	if (IS_ENABLED(CONFIG_OFTREE)) {
-		struct device_node *node;
-
-		node = of_get_root_node();
-		if (!node)
-			return 0;
-
-		node = of_get_child_by_name(node, "reserved-memory");
-		if (!node)
-			return 0;
-
-		for_each_matching_node(node, ramoops_dt_ids)
-			of_platform_device_create(node, NULL);
-	}
-
 	ramoops_register_dummy();
 	return platform_driver_register(&ramoops_driver);
 }
-- 
2.39.2




More information about the barebox mailing list