Commit a50ff19d authored by Bjorn Andersson's avatar Bjorn Andersson Committed by Andy Gross

of/platform: Generalize /reserved-memory handling

By iterating over all /reserved-memory child nodes and match each one to
a list of compatibles that we want to treat specially, we can easily
extend the list of compatibles to handle - without having to resort to
of_platform_populate() that would create unnecessary platform_devices.
Reviewed-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: default avatarAndy Gross <andy.gross@linaro.org>
parent 8c1b7dc9
...@@ -497,6 +497,11 @@ int of_platform_default_populate(struct device_node *root, ...@@ -497,6 +497,11 @@ int of_platform_default_populate(struct device_node *root,
EXPORT_SYMBOL_GPL(of_platform_default_populate); EXPORT_SYMBOL_GPL(of_platform_default_populate);
#ifndef CONFIG_PPC #ifndef CONFIG_PPC
static const struct of_device_id reserved_mem_matches[] = {
{ .compatible = "ramoops" },
{}
};
static int __init of_platform_default_populate_init(void) static int __init of_platform_default_populate_init(void)
{ {
struct device_node *node; struct device_node *node;
...@@ -505,15 +510,12 @@ static int __init of_platform_default_populate_init(void) ...@@ -505,15 +510,12 @@ static int __init of_platform_default_populate_init(void)
return -ENODEV; return -ENODEV;
/* /*
* Handle ramoops explicitly, since it is inside /reserved-memory, * Handle certain compatibles explicitly, since we don't want to create
* which lacks a "compatible" property. * platform_devices for every node in /reserved-memory with a
* "compatible",
*/ */
node = of_find_node_by_path("/reserved-memory"); for_each_matching_node(node, reserved_mem_matches)
if (node) { of_platform_device_create(node, NULL, NULL);
node = of_find_compatible_node(node, NULL, "ramoops");
if (node)
of_platform_device_create(node, NULL, NULL);
}
/* Populate everything else. */ /* Populate everything else. */
of_platform_default_populate(NULL, NULL, NULL); of_platform_default_populate(NULL, NULL, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment