Skip to content

Commit 09ed061

Browse files
bebarinogregkh
authored andcommitted
firmware: coreboot: Let OF core populate platform device
Now that the /firmware/coreboot node in DT is populated by the core DT platform code with commit 3aa0582 ("of: platform: populate /firmware/ node from of_platform_default_populate_init()") we should and can remove the platform device creation here. Otherwise, the of_platform_device_create() call will fail, the coreboot of driver won't be registered, and this driver will never bind. At the same time, we should move this driver to use MODULE_DEVICE_TABLE so that module auto-load works properly when the coreboot device is auto-populated and we should drop the of_node handling that was presumably placed here to hold a reference to the DT node created during module init that no longer happens. Cc: Wei-Ning Huang <[email protected]> Cc: Julius Werner <[email protected]> Reviewed-by: Brian Norris <[email protected]> Cc: Samuel Holland <[email protected]> Reviewed-by: Sudeep Holla <[email protected]> Fixes: 3aa0582 ("of: platform: populate /firmware/ node from of_platform_default_populate_init()") Signed-off-by: Stephen Boyd <[email protected]> Reviewed-by: Julius Werner <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent dbd7139 commit 09ed061

File tree

1 file changed

+3
-25
lines changed

1 file changed

+3
-25
lines changed

drivers/firmware/google/coreboot_table-of.c

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <linux/io.h>
2020
#include <linux/module.h>
2121
#include <linux/of_address.h>
22-
#include <linux/of_platform.h>
2322
#include <linux/platform_device.h>
2423

2524
#include "coreboot_table.h"
@@ -30,7 +29,6 @@ static int coreboot_table_of_probe(struct platform_device *pdev)
3029
void __iomem *ptr;
3130

3231
ptr = of_iomap(fw_dn, 0);
33-
of_node_put(fw_dn);
3432
if (!ptr)
3533
return -ENOMEM;
3634

@@ -44,8 +42,9 @@ static int coreboot_table_of_remove(struct platform_device *pdev)
4442

4543
static const struct of_device_id coreboot_of_match[] = {
4644
{ .compatible = "coreboot" },
47-
{},
45+
{}
4846
};
47+
MODULE_DEVICE_TABLE(of, coreboot_of_match);
4948

5049
static struct platform_driver coreboot_table_of_driver = {
5150
.probe = coreboot_table_of_probe,
@@ -55,28 +54,7 @@ static struct platform_driver coreboot_table_of_driver = {
5554
.of_match_table = coreboot_of_match,
5655
},
5756
};
58-
59-
static int __init platform_coreboot_table_of_init(void)
60-
{
61-
struct platform_device *pdev;
62-
struct device_node *of_node;
63-
64-
/* Limit device creation to the presence of /firmware/coreboot node */
65-
of_node = of_find_node_by_path("/firmware/coreboot");
66-
if (!of_node)
67-
return -ENODEV;
68-
69-
if (!of_match_node(coreboot_of_match, of_node))
70-
return -ENODEV;
71-
72-
pdev = of_platform_device_create(of_node, "coreboot_table_of", NULL);
73-
if (!pdev)
74-
return -ENODEV;
75-
76-
return platform_driver_register(&coreboot_table_of_driver);
77-
}
78-
79-
module_init(platform_coreboot_table_of_init);
57+
module_platform_driver(coreboot_table_of_driver);
8058

8159
MODULE_AUTHOR("Google, Inc.");
8260
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)