diff mbox

[1/1] rtc-cmos: Use of_match_ptr() macro

Message ID 1355911460-19926-1-git-send-email-sachin.kamat@linaro.org
State Superseded
Headers show

Commit Message

Sachin Kamat Dec. 19, 2012, 10:04 a.m. UTC
This eliminates having an #ifdef returning NULL for the case
when OF is disabled.

Cc: David Brownell <david-b@pacbell.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
Compile tested using linux-next tree.
---
 drivers/rtc/rtc-cmos.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

Comments

Andrew Morton Dec. 19, 2012, 10:27 p.m. UTC | #1
On Wed, 19 Dec 2012 15:34:20 +0530
Sachin Kamat <sachin.kamat@linaro.org> wrote:

> This eliminates having an #ifdef returning NULL for the case
> when OF is disabled.
> 
> ...
>
> -		.of_match_table = of_cmos_match,
> +		.of_match_table = of_match_ptr(of_cmos_match),

Thanks.  I suppose these guys might need the same treatment:

akpm:/usr/src/25> grep of_match_table drivers/rtc/*.c|grep -v of_match_ptr
drivers/rtc/rtc-mpc5121.c:              .of_match_table = mpc5121_rtc_match,
drivers/rtc/rtc-mv.c:static struct of_device_id rtc_mv_of_match_table[] = {
drivers/rtc/rtc-sa1100.c:               .of_match_table = sa1100_rtc_dt_ids,
drivers/rtc/rtc-snvs.c:         .of_match_table = snvs_dt_ids,
drivers/rtc/rtc-stmp3xxx.c:             .of_match_table = rtc_dt_ids,
drivers/rtc/rtc-twl.c:          .of_match_table = twl_rtc_of_match,

It would be nice to have a single patch which addresses all of
drivers/rtc/.  Hint :)

It's unneeded if the driver depends on OF in Kconfig.  But even there,
using of_match_ptr() is OK and keeps things nice and consistent.
Sachin Kamat Dec. 20, 2012, 11:26 a.m. UTC | #2
On 20 December 2012 03:57, Andrew Morton <akpm@linux-foundation.org> wrote:
> On Wed, 19 Dec 2012 15:34:20 +0530
> Sachin Kamat <sachin.kamat@linaro.org> wrote:
>
>> This eliminates having an #ifdef returning NULL for the case
>> when OF is disabled.
>>
>> ...
>>
>> -             .of_match_table = of_cmos_match,
>> +             .of_match_table = of_match_ptr(of_cmos_match),
>
> Thanks.  I suppose these guys might need the same treatment:
>
> akpm:/usr/src/25> grep of_match_table drivers/rtc/*.c|grep -v of_match_ptr
> drivers/rtc/rtc-mpc5121.c:              .of_match_table = mpc5121_rtc_match,
> drivers/rtc/rtc-mv.c:static struct of_device_id rtc_mv_of_match_table[] = {
> drivers/rtc/rtc-sa1100.c:               .of_match_table = sa1100_rtc_dt_ids,
> drivers/rtc/rtc-snvs.c:         .of_match_table = snvs_dt_ids,
> drivers/rtc/rtc-stmp3xxx.c:             .of_match_table = rtc_dt_ids,
> drivers/rtc/rtc-twl.c:          .of_match_table = twl_rtc_of_match,
>
> It would be nice to have a single patch which addresses all of
> drivers/rtc/.  Hint :)

Sure, i will do it.

>
> It's unneeded if the driver depends on OF in Kconfig.  But even there,
> using of_match_ptr() is OK and keeps things nice and consistent.

However, I get a lot of compilation errors when I select rtc-twl
driver both in Linus' tree as well as linux-next (the errors are
mostly in the files drivers/mfd/twl-core.c, drivers/mfd/twl4030-madc.c
and drivers/mfd/twl4030-power.c). Hence I have not done any changes in
drivers/rtc/rtc-twl.c for now.

I will post the patch separately after this mail.
diff mbox

Patch

diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 4267789..2e84a64 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -1101,7 +1101,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
 /*----------------------------------------------------------------*/
 
@@ -1143,7 +1142,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),
 	}
 };