diff options
author | Ingo Molnar <mingo@kernel.org> | 2016-08-10 12:36:23 (GMT) |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-08-10 12:36:23 (GMT) |
commit | fdbdfefbabefcdf3f57560163b43fdc4cf95eb2f (patch) | |
tree | 1d0c420d4eaff48cf2486f10dded8d551241ee94 /drivers/of | |
parent | 6731b0d611a1274f9e785fa0189ac2aeeabd0591 (diff) | |
parent | a0cba2179ea4c1820fce2ee046b6ed90ecc56196 (diff) | |
download | linux-fdbdfefbabefcdf3f57560163b43fdc4cf95eb2f.tar.xz |
Merge branch 'linus' into timers/urgent, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/base.c | 22 | ||||
-rw-r--r-- | drivers/of/platform.c | 20 |
2 files changed, 40 insertions, 2 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index a4b6087..7792266 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -502,6 +502,28 @@ int of_device_is_compatible(const struct device_node *device, } EXPORT_SYMBOL(of_device_is_compatible); +/** Checks if the device is compatible with any of the entries in + * a NULL terminated array of strings. Returns the best match + * score or 0. + */ +int of_device_compatible_match(struct device_node *device, + const char *const *compat) +{ + unsigned int tmp, score = 0; + + if (!compat) + return 0; + + while (*compat) { + tmp = of_device_is_compatible(device, *compat); + if (tmp > score) + score = tmp; + compat++; + } + + return score; +} + /** * of_machine_is_compatible - Test root of device tree for a given compatible value * @compat: compatible string to look for in root node's compatible property. diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 765390e..8aa1976 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -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; } |