ramoops: use DT reserved-memory bindings

Instead of a ramoops-specific node, use a child node of /reserved-memory.
This requires that of_platform_device_create() be explicitly called
for the node, though, since "/reserved-memory" does not have its own
"compatible" property.

Suggested-by: Rob Herring <[email protected]>
Signed-off-by: Kees Cook <[email protected]>
Acked-by: Rob Herring <[email protected]>
This commit is contained in:
Kees Cook 2016-07-29 18:11:32 -07:00
commit 529182e204
4 changed files with 56 additions and 33 deletions

View file

@ -499,8 +499,24 @@ EXPORT_SYMBOL_GPL(of_platform_default_populate);
static int __init of_platform_default_populate_init(void)
{
if (of_have_populated_dt())
of_platform_default_populate(NULL, NULL, NULL);
struct device_node *node;
if (!of_have_populated_dt())
return -ENODEV;
/*
* Handle ramoops explicitly, since it is inside /reserved-memory,
* which lacks a "compatible" property.
*/
node = of_find_node_by_path("/reserved-memory");
if (node) {
node = of_find_compatible_node(node, NULL, "ramoops");
if (node)
of_platform_device_create(node, NULL, NULL);
}
/* Populate everything else. */
of_platform_default_populate(NULL, NULL, NULL);
return 0;
}