Commit 319b11ef authored by Wesley W. Terpstra's avatar Wesley W. Terpstra Committed by Greg Kroah-Hartman

base: fix order of OF initialization

This fixes: [    0.010000] cpu cpu0: Error -2 creating of_node link
... which you get for every CPU on all architectures that use
CONFIG_GENERIC_CPU_DEVICES.

In that case, driver_init() calls cpu_dev_init() before calling
of_core_init(). Then we get the callchain:

  cpu_dev_init()
    -> cpu_dev_register_generic()
    -> register_cpu(cpu, i)
    -> device_register(&cpu->dev)
    -> device_add(dev)
    -> device_add_class_symlinks(dev)

... in device_add_class_symlinks, we we dev->of_node, and call
sysfs_create_link(), which fails because we haven't called
of_core_init() to register the sysfs devicetree directory yet.
Signed-off-by: default avatarWesley W. Terpstra <wesley@sifive.com>
[hch: updated the changelog based on review feedback]
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
Acked-by: default avatarFrank Rowand <frowand.list@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ea614629
...@@ -30,9 +30,9 @@ void __init driver_init(void) ...@@ -30,9 +30,9 @@ void __init driver_init(void)
/* These are also core pieces, but must come after the /* These are also core pieces, but must come after the
* core core pieces. * core core pieces.
*/ */
of_core_init();
platform_bus_init(); platform_bus_init();
cpu_dev_init(); cpu_dev_init();
memory_dev_init(); memory_dev_init();
container_dev_init(); container_dev_init();
of_core_init();
} }
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