lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110112000224.GI2131@angua.secretlab.ca>
Date:	Tue, 11 Jan 2011 17:02:24 -0700
From:	Grant Likely <grant.likely@...retlab.ca>
To:	Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc:	linux-kernel@...r.kernel.org, sodaville@...utronix.de,
	x86@...nel.org, dirk.brandewie@...il.com
Subject: Re: [PATCH v2 13/15] x86/rtc: don't register rtc if we the DT blob

On Tue, Jan 04, 2011 at 02:28:46PM +0100, Sebastian Andrzej Siewior wrote:
> or we might end up with two device nodes for the same hardware.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> ---
>  arch/x86/kernel/rtc.c |   18 ++++++++++++++++++
>  1 files changed, 18 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c
> index 1cfbbfc..0cfa138 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,20 @@ static struct platform_device rtc_device = {
>  	.num_resources	= ARRAY_SIZE(rtc_resources),
>  };
>  
> +#ifdef CONFIG_OF
> +static __init int have_DTB(void)
> +{
> +	if (initial_boot_params)
> +		return 1;
> +	return 0;
> +}
> +#else
> +static inline int have_DTB(void)
> +{
> +	return 0;
> +}
> +#endif
> +

Not quite the right test.  For instance, OLPC has real openfirmware so
initial_boot_params will be zero even though there is a fully
populated device tree.  Should test the allnodes value instead.

Also, this test is useful to more than just rtc I'm sure.  It could
easily live in linux/of.h.

Finally one minor nit.  This is more verbose than it needs to be.  It
could instead be:  "return allnodes != NULL;", and the __init is
unnecessary on a static inline.

g.

>  static __init int add_rtc_cmos(void)
>  {
>  #ifdef CONFIG_PNP
> @@ -237,6 +252,9 @@ static __init int add_rtc_cmos(void)
>  	}
>  #endif
>  
> +	if (have_DTB())
> +		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
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ