aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@linaro.org>2017-10-11 01:08:53 -0400
committerAndy Gross <andy.gross@linaro.org>2017-10-22 06:06:33 -0400
commita50ff19d0658d8a09026158448894f06a4521f33 (patch)
treef9f4927d4bb7dd10ea5cbcdce4abe8a0a4e61679
parent8c1b7dc9ba2294c6dbd1870a3d2e534bfda3047a (diff)
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: Rob Herring <robh@kernel.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Andy Gross <andy.gross@linaro.org>
-rw-r--r--drivers/of/platform.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index ac15d0e3d27d..922b46646bcc 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -497,6 +497,11 @@ int of_platform_default_populate(struct device_node *root,
497EXPORT_SYMBOL_GPL(of_platform_default_populate); 497EXPORT_SYMBOL_GPL(of_platform_default_populate);
498 498
499#ifndef CONFIG_PPC 499#ifndef CONFIG_PPC
500static const struct of_device_id reserved_mem_matches[] = {
501 { .compatible = "ramoops" },
502 {}
503};
504
500static int __init of_platform_default_populate_init(void) 505static int __init of_platform_default_populate_init(void)
501{ 506{
502 struct device_node *node; 507 struct device_node *node;
@@ -505,15 +510,12 @@ static int __init of_platform_default_populate_init(void)
505 return -ENODEV; 510 return -ENODEV;
506 511
507 /* 512 /*
508 * Handle ramoops explicitly, since it is inside /reserved-memory, 513 * Handle certain compatibles explicitly, since we don't want to create
509 * which lacks a "compatible" property. 514 * platform_devices for every node in /reserved-memory with a
515 * "compatible",
510 */ 516 */
511 node = of_find_node_by_path("/reserved-memory"); 517 for_each_matching_node(node, reserved_mem_matches)
512 if (node) { 518 of_platform_device_create(node, NULL, NULL);
513 node = of_find_compatible_node(node, NULL, "ramoops");
514 if (node)
515 of_platform_device_create(node, NULL, NULL);
516 }
517 519
518 /* Populate everything else. */ 520 /* Populate everything else. */
519 of_platform_default_populate(NULL, NULL, NULL); 521 of_platform_default_populate(NULL, NULL, NULL);