From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Andrzej Siewior Subject: [PATCH] x86/rtc: don't register rtc if we have an OF node for it Date: Thu, 2 Dec 2010 14:38:50 +0100 Message-ID: <20101202133850.GB10365@www.tglx.de> References: <20101201101756.GA31624@www.tglx.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org To: Grant Likely Cc: Alessandro Zummo , rtc-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org, Sebastian Andrzej Siewior , x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, sodaville-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org List-Id: devicetree@vger.kernel.org or the rtc driver will probe for two devices: the static platform device the OF device. Signed-off-by: Sebastian Andrzej Siewior --- 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 #include #include +#include #include #include @@ -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