aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-cmos.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-10-14 19:01:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-14 19:30:14 -0400
commit72f22b1eb6ca5e4676a632a04d40d46cb61d4562 (patch)
treeebd4739577dcac1766d67828feed29e3a0aedb49 /drivers/rtc/rtc-cmos.c
parent758a7f7bb86b520aadc484f23da85e547b3bf3d8 (diff)
rtc-cmos: look for PNP RTC first, then for platform RTC
We shouldn't rely on "pnp_platform_devices" to tell us whether there is a PNP RTC device. I introduced "pnp_platform_devices", but I think it was a mistake. All it tells us is whether we found any PNPBIOS or PNPACPI devices. Many machines have some PNP devices, but do not describe the RTC via PNP. On those machines, we need to do the platform driver probe to find the RTC. We should just register the PNP driver and see whether it claims anything. If we don't find a PNP RTC, fall back to the platform driver probe. This (in conjunction with the arch/x86/kernel/rtc.c patch to add a platform RTC device when PNP doesn't have one) should resolve these issues: http://bugzilla.kernel.org/show_bug.cgi?id=11580 https://bugzilla.redhat.com/show_bug.cgi?id=451188 Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Acked-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: David Brownell <dbrownell@users.sourceforge.net> Reported-by: Rik Theys <rik.theys@esat.kuleuven.be> Reported-by: shr_msn@yahoo.com.tw Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-cmos.c')
-rw-r--r--drivers/rtc/rtc-cmos.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 6778f82bad24..963ad0b6a4e9 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -1120,29 +1120,32 @@ static struct platform_driver cmos_platform_driver = {
1120 1120
1121static int __init cmos_init(void) 1121static int __init cmos_init(void)
1122{ 1122{
1123 int retval = 0;
1124
1123#ifdef CONFIG_PNP 1125#ifdef CONFIG_PNP
1124 if (pnp_platform_devices) 1126 pnp_register_driver(&cmos_pnp_driver);
1125 return pnp_register_driver(&cmos_pnp_driver); 1127#endif
1126 else 1128
1127 return platform_driver_probe(&cmos_platform_driver, 1129 if (!cmos_rtc.dev)
1128 cmos_platform_probe); 1130 retval = platform_driver_probe(&cmos_platform_driver,
1129#else 1131 cmos_platform_probe);
1130 return platform_driver_probe(&cmos_platform_driver, 1132
1131 cmos_platform_probe); 1133 if (retval == 0)
1132#endif /* CONFIG_PNP */ 1134 return 0;
1135
1136#ifdef CONFIG_PNP
1137 pnp_unregister_driver(&cmos_pnp_driver);
1138#endif
1139 return retval;
1133} 1140}
1134module_init(cmos_init); 1141module_init(cmos_init);
1135 1142
1136static void __exit cmos_exit(void) 1143static void __exit cmos_exit(void)
1137{ 1144{
1138#ifdef CONFIG_PNP 1145#ifdef CONFIG_PNP
1139 if (pnp_platform_devices) 1146 pnp_unregister_driver(&cmos_pnp_driver);
1140 pnp_unregister_driver(&cmos_pnp_driver); 1147#endif
1141 else
1142 platform_driver_unregister(&cmos_platform_driver);
1143#else
1144 platform_driver_unregister(&cmos_platform_driver); 1148 platform_driver_unregister(&cmos_platform_driver);
1145#endif /* CONFIG_PNP */
1146} 1149}
1147module_exit(cmos_exit); 1150module_exit(cmos_exit);
1148 1151