From cfedebec1fb3fe338012662d8b4f71d5c839ee4b Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Wed, 20 Feb 2013 13:15:41 +1100 Subject: [PATCH] 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: Sachin Kamat Cc: Alessandro Zummo Signed-off-by: Andrew Morton --- drivers/rtc/rtc-cmos.c | 3 +-- drivers/rtc/rtc-mpc5121.c | 5 ++++- drivers/rtc/rtc-sa1100.c | 4 +++- drivers/rtc/rtc-snvs.c | 2 +- drivers/rtc/rtc-stmp3xxx.c | 3 ++- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index 16630aa87f45..9deb9e47a67c 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -1098,7 +1098,6 @@ static __init void cmos_of_init(struct platform_device *pdev) } #else static inline void cmos_of_init(struct platform_device *pdev) {} -#define of_cmos_match NULL #endif /*----------------------------------------------------------------*/ @@ -1140,7 +1139,7 @@ static struct platform_driver cmos_platform_driver = { #ifdef CONFIG_PM .pm = &cmos_pm_ops, #endif - .of_match_table = of_cmos_match, + .of_match_table = of_match_ptr(of_cmos_match), } }; diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c index bec10be96f84..bdcc60830aec 100644 --- a/drivers/rtc/rtc-mpc5121.c +++ b/drivers/rtc/rtc-mpc5121.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -403,17 +404,19 @@ static int mpc5121_rtc_remove(struct platform_device *op) 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, diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c index 50a5c4adee48..df9180e80e3a 100644 --- a/drivers/rtc/rtc-sa1100.c +++ b/drivers/rtc/rtc-sa1100.c @@ -349,12 +349,14 @@ static const struct dev_pm_ops sa1100_rtc_pm_ops = { }; #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, @@ -364,7 +366,7 @@ static struct platform_driver sa1100_rtc_driver = { #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), }, }; diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c index 40662e9dc0ab..f7d90703db5e 100644 --- a/drivers/rtc/rtc-snvs.c +++ b/drivers/rtc/rtc-snvs.c @@ -338,7 +338,7 @@ static struct platform_driver snvs_rtc_driver = { .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, diff --git a/drivers/rtc/rtc-stmp3xxx.c b/drivers/rtc/rtc-stmp3xxx.c index cc9a9b652b13..98f0d3c30738 100644 --- a/drivers/rtc/rtc-stmp3xxx.c +++ b/drivers/rtc/rtc-stmp3xxx.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -344,7 +345,7 @@ static struct platform_driver stmp3xxx_rtcdrv = { .driver = { .name = "stmp3xxx-rtc", .owner = THIS_MODULE, - .of_match_table = rtc_dt_ids, + .of_match_table = of_match_ptr(rtc_dt_ids), }, }; -- 2.39.5