ARM: OMAP3: Fix errors for omap_l3_smx when booted with device tree
[deliverable/linux.git] / drivers / bus / omap_l3_smx.c
index acc216491b8a5908656354f7c2ba7ffbfce8944a..597fdaee731508c684fc5b83ac38a8963c34c2c6 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+
 #include "omap_l3_smx.h"
 
 static inline u64 omap3_l3_readll(void __iomem *base, u16 reg)
@@ -211,7 +215,17 @@ static irqreturn_t omap3_l3_app_irq(int irq, void *_l3)
        return ret;
 }
 
-static int __init omap3_l3_probe(struct platform_device *pdev)
+#if IS_BUILTIN(CONFIG_OF)
+static const struct of_device_id omap3_l3_match[] = {
+       {
+               .compatible = "ti,omap3-l3-smx",
+       },
+       { },
+};
+MODULE_DEVICE_TABLE(of, omap3_l3_match);
+#endif
+
+static int omap3_l3_probe(struct platform_device *pdev)
 {
        struct omap3_l3 *l3;
        struct resource *res;
@@ -265,7 +279,7 @@ err0:
        return ret;
 }
 
-static int __exit omap3_l3_remove(struct platform_device *pdev)
+static int omap3_l3_remove(struct platform_device *pdev)
 {
        struct omap3_l3         *l3 = platform_get_drvdata(pdev);
 
@@ -278,15 +292,17 @@ static int __exit omap3_l3_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver omap3_l3_driver = {
-       .remove         = __exit_p(omap3_l3_remove),
+       .probe          = omap3_l3_probe,
+       .remove         = omap3_l3_remove,
        .driver         = {
-       .name   = "omap_l3_smx",
+               .name   = "omap_l3_smx",
+               .of_match_table = of_match_ptr(omap3_l3_match),
        },
 };
 
 static int __init omap3_l3_init(void)
 {
-       return platform_driver_probe(&omap3_l3_driver, omap3_l3_probe);
+       return platform_driver_register(&omap3_l3_driver);
 }
 postcore_initcall_sync(omap3_l3_init);
 
This page took 0.025348 seconds and 5 git commands to generate.