}
 #else
 static inline void cmos_of_init(struct platform_device *pdev) {}
-#define of_cmos_match NULL
 #endif
 /*----------------------------------------------------------------*/
 
 #ifdef CONFIG_PM
                .pm             = &cmos_pm_ops,
 #endif
-               .of_match_table = of_cmos_match,
+               .of_match_table = of_match_ptr(of_cmos_match),
        }
 };
 
 
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/rtc.h>
+#include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/of_platform.h>
 #include <linux/io.h>
        return 0;
 }
 
+#ifdef CONFIG_OF
 static struct of_device_id mpc5121_rtc_match[] = {
        { .compatible = "fsl,mpc5121-rtc", },
        { .compatible = "fsl,mpc5200-rtc", },
        {},
 };
+#endif
 
 static struct platform_driver mpc5121_rtc_driver = {
        .driver = {
                .name = "mpc5121-rtc",
                .owner = THIS_MODULE,
-               .of_match_table = mpc5121_rtc_match,
+               .of_match_table = of_match_ptr(mpc5121_rtc_match),
        },
        .probe = mpc5121_rtc_probe,
        .remove = mpc5121_rtc_remove,
 
 };
 #endif
 
+#ifdef CONFIG_OF
 static struct of_device_id sa1100_rtc_dt_ids[] = {
        { .compatible = "mrvl,sa1100-rtc", },
        { .compatible = "mrvl,mmp-rtc", },
        {}
 };
 MODULE_DEVICE_TABLE(of, sa1100_rtc_dt_ids);
+#endif
 
 static struct platform_driver sa1100_rtc_driver = {
        .probe          = sa1100_rtc_probe,
 #ifdef CONFIG_PM
                .pm     = &sa1100_rtc_pm_ops,
 #endif
-               .of_match_table = sa1100_rtc_dt_ids,
+               .of_match_table = of_match_ptr(sa1100_rtc_dt_ids),
        },
 };
 
 
                .name   = "snvs_rtc",
                .owner  = THIS_MODULE,
                .pm     = &snvs_rtc_pm_ops,
-               .of_match_table = snvs_dt_ids,
+               .of_match_table = of_match_ptr(snvs_dt_ids),
        },
        .probe          = snvs_rtc_probe,
        .remove         = snvs_rtc_remove,
 
 #include <linux/rtc.h>
 #include <linux/slab.h>
 #include <linux/of_device.h>
+#include <linux/of.h>
 
 #include <mach/common.h>
 
        .driver         = {
                .name   = "stmp3xxx-rtc",
                .owner  = THIS_MODULE,
-               .of_match_table = rtc_dt_ids,
+               .of_match_table = of_match_ptr(rtc_dt_ids),
        },
 };
 
 
 #include <linux/bcd.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
+#include <linux/of.h>
 
 #include <linux/i2c/twl.h>
 
 #define twl_rtc_resume  NULL
 #endif
 
+#ifdef CONFIG_OF
 static const struct of_device_id twl_rtc_of_match[] = {
        {.compatible = "ti,twl4030-rtc", },
        { },
 };
 MODULE_DEVICE_TABLE(of, twl_rtc_of_match);
+#endif
+
 MODULE_ALIAS("platform:twl_rtc");
 
 static struct platform_driver twl4030rtc_driver = {
        .driver         = {
                .owner          = THIS_MODULE,
                .name           = "twl_rtc",
-               .of_match_table = twl_rtc_of_match,
+               .of_match_table = of_match_ptr(twl_rtc_of_match),
        },
 };