Commit c8a6046e authored by Sachin Kamat's avatar Sachin Kamat Committed by Linus Torvalds

drivers/rtc: use of_match_ptr() macro

This eliminates having an #ifdef returning NULL for the case when OF is
disabled.  Maintains consistency in cases where OF is always selected.
Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f32bc70d
...@@ -1098,7 +1098,6 @@ static __init void cmos_of_init(struct platform_device *pdev) ...@@ -1098,7 +1098,6 @@ static __init void cmos_of_init(struct platform_device *pdev)
} }
#else #else
static inline void cmos_of_init(struct platform_device *pdev) {} static inline void cmos_of_init(struct platform_device *pdev) {}
#define of_cmos_match NULL
#endif #endif
/*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/
...@@ -1140,7 +1139,7 @@ static struct platform_driver cmos_platform_driver = { ...@@ -1140,7 +1139,7 @@ static struct platform_driver cmos_platform_driver = {
#ifdef CONFIG_PM #ifdef CONFIG_PM
.pm = &cmos_pm_ops, .pm = &cmos_pm_ops,
#endif #endif
.of_match_table = of_cmos_match, .of_match_table = of_match_ptr(of_cmos_match),
} }
}; };
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/rtc.h> #include <linux/rtc.h>
#include <linux/of.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/io.h> #include <linux/io.h>
...@@ -403,17 +404,19 @@ static int mpc5121_rtc_remove(struct platform_device *op) ...@@ -403,17 +404,19 @@ static int mpc5121_rtc_remove(struct platform_device *op)
return 0; return 0;
} }
#ifdef CONFIG_OF
static struct of_device_id mpc5121_rtc_match[] = { static struct of_device_id mpc5121_rtc_match[] = {
{ .compatible = "fsl,mpc5121-rtc", }, { .compatible = "fsl,mpc5121-rtc", },
{ .compatible = "fsl,mpc5200-rtc", }, { .compatible = "fsl,mpc5200-rtc", },
{}, {},
}; };
#endif
static struct platform_driver mpc5121_rtc_driver = { static struct platform_driver mpc5121_rtc_driver = {
.driver = { .driver = {
.name = "mpc5121-rtc", .name = "mpc5121-rtc",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.of_match_table = mpc5121_rtc_match, .of_match_table = of_match_ptr(mpc5121_rtc_match),
}, },
.probe = mpc5121_rtc_probe, .probe = mpc5121_rtc_probe,
.remove = mpc5121_rtc_remove, .remove = mpc5121_rtc_remove,
......
...@@ -349,12 +349,14 @@ static const struct dev_pm_ops sa1100_rtc_pm_ops = { ...@@ -349,12 +349,14 @@ static const struct dev_pm_ops sa1100_rtc_pm_ops = {
}; };
#endif #endif
#ifdef CONFIG_OF
static struct of_device_id sa1100_rtc_dt_ids[] = { static struct of_device_id sa1100_rtc_dt_ids[] = {
{ .compatible = "mrvl,sa1100-rtc", }, { .compatible = "mrvl,sa1100-rtc", },
{ .compatible = "mrvl,mmp-rtc", }, { .compatible = "mrvl,mmp-rtc", },
{} {}
}; };
MODULE_DEVICE_TABLE(of, sa1100_rtc_dt_ids); MODULE_DEVICE_TABLE(of, sa1100_rtc_dt_ids);
#endif
static struct platform_driver sa1100_rtc_driver = { static struct platform_driver sa1100_rtc_driver = {
.probe = sa1100_rtc_probe, .probe = sa1100_rtc_probe,
...@@ -364,7 +366,7 @@ static struct platform_driver sa1100_rtc_driver = { ...@@ -364,7 +366,7 @@ static struct platform_driver sa1100_rtc_driver = {
#ifdef CONFIG_PM #ifdef CONFIG_PM
.pm = &sa1100_rtc_pm_ops, .pm = &sa1100_rtc_pm_ops,
#endif #endif
.of_match_table = sa1100_rtc_dt_ids, .of_match_table = of_match_ptr(sa1100_rtc_dt_ids),
}, },
}; };
......
...@@ -338,7 +338,7 @@ static struct platform_driver snvs_rtc_driver = { ...@@ -338,7 +338,7 @@ static struct platform_driver snvs_rtc_driver = {
.name = "snvs_rtc", .name = "snvs_rtc",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = &snvs_rtc_pm_ops, .pm = &snvs_rtc_pm_ops,
.of_match_table = snvs_dt_ids, .of_match_table = of_match_ptr(snvs_dt_ids),
}, },
.probe = snvs_rtc_probe, .probe = snvs_rtc_probe,
.remove = snvs_rtc_remove, .remove = snvs_rtc_remove,
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/rtc.h> #include <linux/rtc.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of.h>
#include <mach/common.h> #include <mach/common.h>
...@@ -280,7 +281,7 @@ static struct platform_driver stmp3xxx_rtcdrv = { ...@@ -280,7 +281,7 @@ static struct platform_driver stmp3xxx_rtcdrv = {
.driver = { .driver = {
.name = "stmp3xxx-rtc", .name = "stmp3xxx-rtc",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.of_match_table = rtc_dt_ids, .of_match_table = of_match_ptr(rtc_dt_ids),
}, },
}; };
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/bcd.h> #include <linux/bcd.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/of.h>
#include <linux/i2c/twl.h> #include <linux/i2c/twl.h>
...@@ -588,11 +589,14 @@ static int twl_rtc_resume(struct platform_device *pdev) ...@@ -588,11 +589,14 @@ static int twl_rtc_resume(struct platform_device *pdev)
#define twl_rtc_resume NULL #define twl_rtc_resume NULL
#endif #endif
#ifdef CONFIG_OF
static const struct of_device_id twl_rtc_of_match[] = { static const struct of_device_id twl_rtc_of_match[] = {
{.compatible = "ti,twl4030-rtc", }, {.compatible = "ti,twl4030-rtc", },
{ }, { },
}; };
MODULE_DEVICE_TABLE(of, twl_rtc_of_match); MODULE_DEVICE_TABLE(of, twl_rtc_of_match);
#endif
MODULE_ALIAS("platform:twl_rtc"); MODULE_ALIAS("platform:twl_rtc");
static struct platform_driver twl4030rtc_driver = { static struct platform_driver twl4030rtc_driver = {
...@@ -604,7 +608,7 @@ static struct platform_driver twl4030rtc_driver = { ...@@ -604,7 +608,7 @@ static struct platform_driver twl4030rtc_driver = {
.driver = { .driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "twl_rtc", .name = "twl_rtc",
.of_match_table = twl_rtc_of_match, .of_match_table = of_match_ptr(twl_rtc_of_match),
}, },
}; };
......
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