@@ -19,7 +19,6 @@
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of_address.h>
-#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include "coreboot_table.h"
@@ -30,7 +29,6 @@ static int coreboot_table_of_probe(struct platform_device *pdev)
void __iomem *ptr;
ptr = of_iomap(fw_dn, 0);
- of_node_put(fw_dn);
if (!ptr)
return -ENOMEM;
@@ -44,8 +42,9 @@ static int coreboot_table_of_remove(struct platform_device *pdev)
static const struct of_device_id coreboot_of_match[] = {
{ .compatible = "coreboot" },
- {},
+ {}
};
+MODULE_DEVICE_TABLE(of, coreboot_of_match);
static struct platform_driver coreboot_table_of_driver = {
.probe = coreboot_table_of_probe,
@@ -55,28 +54,7 @@ static struct platform_driver coreboot_table_of_driver = {
.of_match_table = coreboot_of_match,
},
};
-
-static int __init platform_coreboot_table_of_init(void)
-{
- struct platform_device *pdev;
- struct device_node *of_node;
-
- /* Limit device creation to the presence of /firmware/coreboot node */
- of_node = of_find_node_by_path("/firmware/coreboot");
- if (!of_node)
- return -ENODEV;
-
- if (!of_match_node(coreboot_of_match, of_node))
- return -ENODEV;
-
- pdev = of_platform_device_create(of_node, "coreboot_table_of", NULL);
- if (!pdev)
- return -ENODEV;
-
- return platform_driver_register(&coreboot_table_of_driver);
-}
-
-module_init(platform_coreboot_table_of_init);
+module_platform_driver(coreboot_table_of_driver);
MODULE_AUTHOR("Google, Inc.");
MODULE_LICENSE("GPL");