[PATCH 13/15] x86/rtc: don't register rtc if we have an OF node for it

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Sebastian Andrzej Siewior
Date: Friday, December 17, 2010 - 8:33 am

or we end up with two of those things.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 arch/x86/kernel/rtc.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c
index 1cfbbfc..382c6cb 100644
--- a/arch/x86/kernel/rtc.c
+++ b/arch/x86/kernel/rtc.c
@@ -6,6 +6,7 @@
 #include <linux/acpi.h>
 #include <linux/bcd.h>
 #include <linux/pnp.h>
+#include <linux/of.h>
 
 #include <asm/vsyscall.h>
 #include <asm/x86_init.h>
@@ -218,6 +219,25 @@ static struct platform_device rtc_device = {
 	.num_resources	= ARRAY_SIZE(rtc_resources),
 };
 
+#ifdef CONFIG_OF
+static __init int have_rtc_of_node(void)
+{
+	struct device_node *n;
+
+	n = of_find_compatible_node(NULL, NULL, "motorola,mc146818");
+	if (n) {
+		of_node_put(n);
+		return 1;
+	}
+	return 0;
+}
+#else
+static inline int have_rtc_of_node(void)
+{
+	return 0;
+}
+#endif
+
 static __init int add_rtc_cmos(void)
 {
 #ifdef CONFIG_PNP
@@ -237,6 +257,9 @@ static __init int add_rtc_cmos(void)
 	}
 #endif
 
+	if (have_rtc_of_node())
+		return 0;
+
 	platform_device_register(&rtc_device);
 	dev_info(&rtc_device.dev,
 		 "registered platform RTC device (no PNP device found)\n");
-- 
1.7.3.2

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Add device tree support for x86, v2, Sebastian Andrzej Si ..., (Fri Dec 17, 8:33 am)
[PATCH 01/15] x86/e820: remove conditional early mapping i ..., Sebastian Andrzej Si ..., (Fri Dec 17, 8:33 am)
[PATCH 02/15] x86: Add device tree support, Sebastian Andrzej Si ..., (Fri Dec 17, 8:33 am)
[PATCH 03/15] x86/dtb: Add a device tree for CE4100, Sebastian Andrzej Si ..., (Fri Dec 17, 8:33 am)
[PATCH 04/15] x86/dtb: add irq domain abstraction, Sebastian Andrzej Si ..., (Fri Dec 17, 8:33 am)
[PATCH 05/15] x86/dtb: add early parsing of APIC and IO APIC, Sebastian Andrzej Si ..., (Fri Dec 17, 8:33 am)
[PATCH 06/15] x86/dtb: add support hpet, Sebastian Andrzej Si ..., (Fri Dec 17, 8:33 am)
[PATCH 07/15] of: move of_irq_map_pci() into generic code, Sebastian Andrzej Si ..., (Fri Dec 17, 8:33 am)
[PATCH 08/15] x86/dtb: add support for PCI devices backed ..., Sebastian Andrzej Si ..., (Fri Dec 17, 8:33 am)
[PATCH 09/15] x86/dtb: Add generic bus probe, Sebastian Andrzej Si ..., (Fri Dec 17, 8:33 am)
[PATCH 10/15] x86/ioapic: Add OF bindings for IO-APIC, Sebastian Andrzej Si ..., (Fri Dec 17, 8:33 am)
[PATCH 11/15] x86/ce4100: use OF for ioapic, Sebastian Andrzej Si ..., (Fri Dec 17, 8:33 am)
[PATCH 12/15] of/address: use propper endianess in get_flags, Sebastian Andrzej Si ..., (Fri Dec 17, 8:33 am)
[PATCH 13/15] x86/rtc: don't register rtc if we have an OF ..., Sebastian Andrzej Si ..., (Fri Dec 17, 8:33 am)
[PATCH 14/15] rtc/cmos: add OF bindings, Sebastian Andrzej Si ..., (Fri Dec 17, 8:33 am)
[PATCH 15/15] x86/pci: remove warning, Sebastian Andrzej Si ..., (Fri Dec 17, 8:33 am)
Re: [PATCH 07/15] of: move of_irq_map_pci() into generic code, Benjamin Herrenschmidt, (Fri Dec 17, 2:16 pm)
Re: [PATCH 02/15] x86: Add device tree support, Grant Likely, (Thu Dec 30, 1:43 am)
Re: [PATCH 03/15] x86/dtb: Add a device tree for CE4100, Grant Likely, (Thu Dec 30, 1:51 am)
Re: [PATCH 02/15] x86: Add device tree support, Grant Likely, (Thu Dec 30, 2:01 pm)
Re: [PATCH 02/15] x86: Add device tree support, H. Peter Anvin, (Sat Jan 1, 5:40 pm)
Re: [PATCH 03/15] x86/dtb: Add a device tree for CE4100, Sebastian Andrzej Si ..., (Mon Jan 3, 4:28 am)
Re: [PATCH 02/15] x86: Add device tree support, Sebastian Andrzej Si ..., (Mon Jan 3, 5:20 am)
Re: [PATCH 03/15] x86/dtb: Add a device tree for CE4100, Grant Likely, (Mon Jan 3, 10:45 am)
Re: [sodaville] [PATCH 02/15] x86: Add device tree support, H. Peter Anvin, (Mon Jan 3, 11:05 am)
[PATCH v2 01/15] x86/e820: remove conditional early mappin ..., Sebastian Andrzej Si ..., (Tue Jan 4, 6:08 am)
[PATCH v2 05/15] x86/dtb: add early parsing of APIC and IO ..., Sebastian Andrzej Si ..., (Tue Jan 4, 6:23 am)
[PATCH v2 13/15] x86/rtc: don't register rtc if we the DT blob, Sebastian Andrzej Si ..., (Tue Jan 4, 6:28 am)
[PATCH v2 07/15] of: move of_irq_map_pci() into generic code, Sebastian Andrzej Si ..., (Tue Jan 4, 7:27 am)