* about __BITS_PER_LONG
@ 2011-04-11 7:34 Guan Xuetao
2011-04-11 7:34 ` Guan Xuetao
2011-04-11 15:24 ` Arnd Bergmann
0 siblings, 2 replies; 4+ messages in thread
From: Guan Xuetao @ 2011-04-11 7:34 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linux-kernel, linux-arch
Hi, Arnd:
When using asm-generic/bitsperlong.h, I think that __BITS_PER_LONG could be the
same as BITS_PER_LONG if-not-defined. And this could avoid the duplicated macros
in almost all architectures.
Regards.
Guan Xuetao
---
diff --git a/include/asm-generic/bitsperlong.h b/include/asm-generic/bitsperlong.h
index 4ae54e0..31d032a 100644
--- a/include/asm-generic/bitsperlong.h
+++ b/include/asm-generic/bitsperlong.h
@@ -9,7 +9,11 @@
* to decide it, but rather check a compiler provided macro.
*/
#ifndef __BITS_PER_LONG
-#define __BITS_PER_LONG 32
+# ifdef CONFIG_64BIT
+# define __BITS_PER_LONG 64
+# else
+# define __BITS_PER_LONG 32
+# endif /* CONFIG_64BIT */
#endif
#ifdef __KERNEL__
^ permalink raw reply related [flat|nested] 4+ messages in thread
* about __BITS_PER_LONG
2011-04-11 7:34 about __BITS_PER_LONG Guan Xuetao
@ 2011-04-11 7:34 ` Guan Xuetao
2011-04-11 15:24 ` Arnd Bergmann
1 sibling, 0 replies; 4+ messages in thread
From: Guan Xuetao @ 2011-04-11 7:34 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linux-kernel, linux-arch
Hi, Arnd:
When using asm-generic/bitsperlong.h, I think that __BITS_PER_LONG could be the
same as BITS_PER_LONG if-not-defined. And this could avoid the duplicated macros
in almost all architectures.
Regards.
Guan Xuetao
---
diff --git a/include/asm-generic/bitsperlong.h b/include/asm-generic/bitsperlong.h
index 4ae54e0..31d032a 100644
--- a/include/asm-generic/bitsperlong.h
+++ b/include/asm-generic/bitsperlong.h
@@ -9,7 +9,11 @@
* to decide it, but rather check a compiler provided macro.
*/
#ifndef __BITS_PER_LONG
-#define __BITS_PER_LONG 32
+# ifdef CONFIG_64BIT
+# define __BITS_PER_LONG 64
+# else
+# define __BITS_PER_LONG 32
+# endif /* CONFIG_64BIT */
#endif
#ifdef __KERNEL__
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: about __BITS_PER_LONG
2011-04-11 7:34 about __BITS_PER_LONG Guan Xuetao
2011-04-11 7:34 ` Guan Xuetao
@ 2011-04-11 15:24 ` Arnd Bergmann
2011-04-12 1:24 ` Guan Xuetao
1 sibling, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2011-04-11 15:24 UTC (permalink / raw)
To: Guan Xuetao; +Cc: linux-kernel, linux-arch
On Monday 11 April 2011, Guan Xuetao wrote:
> --- a/include/asm-generic/bitsperlong.h
> +++ b/include/asm-generic/bitsperlong.h
> @@ -9,7 +9,11 @@
> * to decide it, but rather check a compiler provided macro.
> */
> #ifndef __BITS_PER_LONG
> -#define __BITS_PER_LONG 32
> +# ifdef CONFIG_64BIT
> +# define __BITS_PER_LONG 64
> +# else
> +# define __BITS_PER_LONG 32
> +# endif /* CONFIG_64BIT */
> #endif
>
Unfortunately, this does not work, because the __BITS_PER_LONG definition is meant
for user space. You have to make this depend on a preprocessor macro that
is provided by the compiler based on the command line switches (e.g. -m64) that
a use could pass to the compiler.
In user space, the CONFIG_* symbols are meaningless.
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: about __BITS_PER_LONG
2011-04-11 15:24 ` Arnd Bergmann
@ 2011-04-12 1:24 ` Guan Xuetao
0 siblings, 0 replies; 4+ messages in thread
From: Guan Xuetao @ 2011-04-12 1:24 UTC (permalink / raw)
To: 'Arnd Bergmann'; +Cc: linux-kernel, linux-arch
> -----Original Message-----
> From: Arnd Bergmann [mailto:arnd@arndb.de]
> Sent: Monday, April 11, 2011 11:25 PM
> To: Guan Xuetao
> Cc: linux-kernel@vger.kernel.org; linux-arch@vger.kernel.org
> Subject: Re: about __BITS_PER_LONG
>
> On Monday 11 April 2011, Guan Xuetao wrote:
> > --- a/include/asm-generic/bitsperlong.h
> > +++ b/include/asm-generic/bitsperlong.h
> > @@ -9,7 +9,11 @@
> > * to decide it, but rather check a compiler provided macro.
> > */
> > #ifndef __BITS_PER_LONG
> > -#define __BITS_PER_LONG 32
> > +# ifdef CONFIG_64BIT
> > +# define __BITS_PER_LONG 64
> > +# else
> > +# define __BITS_PER_LONG 32
> > +# endif /* CONFIG_64BIT */
> > #endif
> >
>
> Unfortunately, this does not work, because the __BITS_PER_LONG definition is meant
> for user space. You have to make this depend on a preprocessor macro that
> is provided by the compiler based on the command line switches (e.g. -m64) that
> a use could pass to the compiler.
However, there is no conflict between the definition depending on a preprocessor macro and
the definition of asm-generic header.
>
> In user space, the CONFIG_* symbols are meaningless.
Yes, that's the problem. I have not notice it before.
So, only one value can be reserved in such circumstances.
>
> Arnd
Thanks & Regards.
Guan Xuetao
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-04-12 1:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-11 7:34 about __BITS_PER_LONG Guan Xuetao
2011-04-11 7:34 ` Guan Xuetao
2011-04-11 15:24 ` Arnd Bergmann
2011-04-12 1:24 ` Guan Xuetao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).