rpms/kernel/F-9 linux-2.6-rtc-cmos-look-for-pnp-rtc-first.patch, NONE, 1.1 linux-2.6-x86-register-platform-rtc-if-pnp-doesnt-describe-it.patch, NONE, 1.1 kernel.spec, 1.803, 1.804

Chuck Ebbert cebbert at fedoraproject.org
Thu Oct 16 17:56:28 UTC 2008


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv1255

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-rtc-cmos-look-for-pnp-rtc-first.patch 
	linux-2.6-x86-register-platform-rtc-if-pnp-doesnt-describe-it.patch 
Log Message:
Fix RTC on systems that don't describe it in PnP (#451188)

linux-2.6-rtc-cmos-look-for-pnp-rtc-first.patch:

--- NEW FILE linux-2.6-rtc-cmos-look-for-pnp-rtc-first.patch ---
From: Bjorn Helgaas <bjorn.helgaas at hp.com>
Date: Tue, 14 Oct 2008 23:01:59 +0000 (-0600)
Subject: rtc-cmos: look for PNP RTC first, then for platform RTC
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=72f22b1eb6ca5e4676a632a04d40d46cb61d4562

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 at hp.com>
Acked-by: Rafael J. Wysocki <rjw at sisk.pl>
Acked-by: David Brownell <dbrownell at users.sourceforge.net>
Reported-by: Rik Theys <rik.theys at esat.kuleuven.be>
Reported-by: shr_msn at yahoo.com.tw
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---

diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 6778f82..963ad0b 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -1120,29 +1120,32 @@ static struct platform_driver cmos_platform_driver = {
 
 static int __init cmos_init(void)
 {
+	int retval = 0;
+
 #ifdef	CONFIG_PNP
-	if (pnp_platform_devices)
-		return pnp_register_driver(&cmos_pnp_driver);
-	else
-		return platform_driver_probe(&cmos_platform_driver,
-			cmos_platform_probe);
-#else
-	return platform_driver_probe(&cmos_platform_driver,
-			cmos_platform_probe);
-#endif /* CONFIG_PNP */
+	pnp_register_driver(&cmos_pnp_driver);
+#endif
+
+	if (!cmos_rtc.dev)
+		retval = platform_driver_probe(&cmos_platform_driver,
+					       cmos_platform_probe);
+
+	if (retval == 0)
+		return 0;
+
+#ifdef	CONFIG_PNP
+	pnp_unregister_driver(&cmos_pnp_driver);
+#endif
+	return retval;
 }
 module_init(cmos_init);
 
 static void __exit cmos_exit(void)
 {
 #ifdef	CONFIG_PNP
-	if (pnp_platform_devices)
-		pnp_unregister_driver(&cmos_pnp_driver);
-	else
-		platform_driver_unregister(&cmos_platform_driver);
-#else
+	pnp_unregister_driver(&cmos_pnp_driver);
+#endif
 	platform_driver_unregister(&cmos_platform_driver);
-#endif /* CONFIG_PNP */
 }
 module_exit(cmos_exit);
 

linux-2.6-x86-register-platform-rtc-if-pnp-doesnt-describe-it.patch:

--- NEW FILE linux-2.6-x86-register-platform-rtc-if-pnp-doesnt-describe-it.patch ---
From: Bjorn Helgaas <bjorn.helgaas at hp.com>
Date: Tue, 14 Oct 2008 23:01:03 +0000 (-0600)
Subject: x86: register a platform RTC device if PNP doesn't describe it
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=758a7f7bb86b520aadc484f23da85e547b3bf3d8

x86: register a platform RTC device if PNP doesn't describe it

Most if not all x86 platforms have an RTC device, but sometimes the RTC
is not exposed as a PNP0b00/PNP0b01/PNP0b02 device in PNPBIOS or ACPI:

    http://bugzilla.kernel.org/show_bug.cgi?id=11580
    https://bugzilla.redhat.com/show_bug.cgi?id=451188

It's best if we can discover the RTC via PNP because then we know
which flavor of device it is, where it lives, and which IRQ it uses.

But if we can't, we should register a platform device using the
compiled-in RTC_PORT/RTC_IRQ resource assumptions.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas at hp.com>
Acked-by: Rafael J. Wysocki <rjw at sisk.pl>
Acked-by: David Brownell <dbrownell at users.sourceforge.net>
Reported-by: Rik Theys <rik.theys at esat.kuleuven.be>
Reported-by: shr_msn at yahoo.com.tw
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---

diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c
index 05191bb..0a23b57 100644
--- a/arch/x86/kernel/rtc.c
+++ b/arch/x86/kernel/rtc.c
@@ -223,11 +223,25 @@ static struct platform_device rtc_device = {
 static __init int add_rtc_cmos(void)
 {
 #ifdef CONFIG_PNP
-	if (!pnp_platform_devices)
-		platform_device_register(&rtc_device);
-#else
+	static const char *ids[] __initconst =
+	    { "PNP0b00", "PNP0b01", "PNP0b02", };
+	struct pnp_dev *dev;
+	struct pnp_id *id;
+	int i;
+
+	pnp_for_each_dev(dev) {
+		for (id = dev->id; id; id = id->next) {
+			for (i = 0; i < ARRAY_SIZE(ids); i++) {
+				if (compare_pnp_id(id, ids[i]) != 0)
+					return 0;
+			}
+		}
+	}
+#endif
+
 	platform_device_register(&rtc_device);
-#endif /* CONFIG_PNP */
+	dev_info(&rtc_device.dev,
+		 "registered platform RTC device (no PNP device found)\n");
 	return 0;
 }
 device_initcall(add_rtc_cmos);


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-9/kernel.spec,v
retrieving revision 1.803
retrieving revision 1.804
diff -u -r1.803 -r1.804
--- kernel.spec	15 Oct 2008 20:47:41 -0000	1.803
+++ kernel.spec	16 Oct 2008 17:55:58 -0000	1.804
@@ -737,6 +737,10 @@
 Patch2802: linux-2.6-warn-Turn-the-netdev-timeout-WARN_ON-into-WARN.patch
 Patch2803: linux-2.6-warn-rename-WARN-to-WARNING.patch
 
+# fix RTC
+Patch2900: linux-2.6-rtc-cmos-look-for-pnp-rtc-first.patch
+Patch2910: linux-2.6-x86-register-platform-rtc-if-pnp-doesnt-describe-it.patch
+
 # backported version of http://git.kernel.org/?p=linux/kernel/git/davem/sparc-2.6.git;a=commitdiff;h=73ccefab8a6590bb3d5b44c046010139108ab7ca
 # needed to build sparc64 kernel
 Patch2900: linux-sparc-tracehook-syscall.patch
@@ -1345,6 +1349,10 @@
 ApplyPatch linux-2.6-warn-Turn-the-netdev-timeout-WARN_ON-into-WARN.patch
 ApplyPatch linux-2.6-warn-rename-WARN-to-WARNING.patch
 
+# fix RTC
+ApplyPatch linux-2.6-rtc-cmos-look-for-pnp-rtc-first.patch
+ApplyPatch linux-2.6-x86-register-platform-rtc-if-pnp-doesnt-describe-it.patch
+
 # backport syscall tracing to use the new tracehook.h entry points.
 ApplyPatch linux-sparc-tracehook-syscall.patch
 # END OF PATCH APPLICATIONS
@@ -1940,6 +1948,9 @@
 %kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL}.xen -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.xen.conf %{with_xen} xen
 
 %changelog
+* Thu Oct 16 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.26.6-77
+- Fix RTC on systems that don't describe it in PnP (#451188)
+
 * Wed Oct 15 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.26.6-76
 - Actually apply the syscall_get_arguments() fix.
 




More information about the scm-commits mailing list