public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] cris: introduce asm/swab.h
@ 2009-01-14  3:26 Harvey Harrison
  2009-01-14  3:31 ` Harvey Harrison
  2009-01-24 12:10 ` Jaswinder Singh Rajput
  0 siblings, 2 replies; 4+ messages in thread
From: Harvey Harrison @ 2009-01-14  3:26 UTC (permalink / raw)
  To: Linus Torvalds, Jesper Nilsson; +Cc: LKML

Adjust the arch overrides to the new names as well.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
Jesper, I noticed that my patch was the only one for CRIS this merge
window (at least looking at linux-next), I hope you're OK with me
sending this directly to Linus.  It's just code movement, so I'm
confident it's not going to break anything.

 arch/cris/include/arch-v10/arch/byteorder.h |   26 -----------------------
 arch/cris/include/arch-v10/arch/swab.h      |   30 +++++++++++++++++++++++++++
 arch/cris/include/arch-v32/arch/byteorder.h |   20 ------------------
 arch/cris/include/arch-v32/arch/swab.h      |   24 +++++++++++++++++++++
 arch/cris/include/asm/Kbuild                |    1 +
 arch/cris/include/asm/byteorder.h           |   20 +-----------------
 arch/cris/include/asm/swab.h                |    8 +++++++
 7 files changed, 64 insertions(+), 65 deletions(-)

diff --git a/arch/cris/include/arch-v10/arch/byteorder.h b/arch/cris/include/arch-v10/arch/byteorder.h
deleted file mode 100644
index 255b646..0000000
--- a/arch/cris/include/arch-v10/arch/byteorder.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef _CRIS_ARCH_BYTEORDER_H
-#define _CRIS_ARCH_BYTEORDER_H
-
-#include <asm/types.h>
-#include <linux/compiler.h>
-
-/* we just define these two (as we can do the swap in a single
- * asm instruction in CRIS) and the arch-independent files will put
- * them together into ntohl etc.
- */
-
-static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
-{
-	__asm__ ("swapwb %0" : "=r" (x) : "0" (x));
-  
-	return(x);
-}
-
-static inline __attribute_const__ __u16 ___arch__swab16(__u16 x)
-{
-	__asm__ ("swapb %0" : "=r" (x) : "0" (x));
-	
-	return(x);
-}
-
-#endif
diff --git a/arch/cris/include/arch-v10/arch/swab.h b/arch/cris/include/arch-v10/arch/swab.h
new file mode 100644
index 0000000..e4e847d
--- /dev/null
+++ b/arch/cris/include/arch-v10/arch/swab.h
@@ -0,0 +1,30 @@
+#ifndef _CRIS_ARCH_SWAB_H
+#define _CRIS_ARCH_SWAB_H
+
+#include <asm/types.h>
+#include <linux/compiler.h>
+
+#define __SWAB_64_THRU_32__
+
+/* we just define these two (as we can do the swap in a single
+ * asm instruction in CRIS) and the arch-independent files will put
+ * them together into ntohl etc.
+ */
+
+static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
+{
+	__asm__ ("swapwb %0" : "=r" (x) : "0" (x));
+
+	return(x);
+}
+#define __arch_swab32 __arch_swab32
+
+static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
+{
+	__asm__ ("swapb %0" : "=r" (x) : "0" (x));
+
+	return(x);
+}
+#define __arch_swab16 __arch_swab16
+
+#endif
diff --git a/arch/cris/include/arch-v32/arch/byteorder.h b/arch/cris/include/arch-v32/arch/byteorder.h
deleted file mode 100644
index 6ef8fb4..0000000
--- a/arch/cris/include/arch-v32/arch/byteorder.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _ASM_CRIS_ARCH_BYTEORDER_H
-#define _ASM_CRIS_ARCH_BYTEORDER_H
-
-#include <asm/types.h>
-
-static inline __const__ __u32
-___arch__swab32(__u32 x)
-{
-	__asm__ __volatile__ ("swapwb %0" : "=r" (x) : "0" (x));
-	return (x);
-}
-
-static inline __const__ __u16
-___arch__swab16(__u16 x)
-{
-	__asm__ __volatile__ ("swapb %0" : "=r" (x) : "0" (x));
-	return (x);
-}
-
-#endif /* _ASM_CRIS_ARCH_BYTEORDER_H */
diff --git a/arch/cris/include/arch-v32/arch/swab.h b/arch/cris/include/arch-v32/arch/swab.h
new file mode 100644
index 0000000..1152329
--- /dev/null
+++ b/arch/cris/include/arch-v32/arch/swab.h
@@ -0,0 +1,24 @@
+#ifndef _ASM_CRIS_ARCH_SWAB_H
+#define _ASM_CRIS_ARCH_SWAB_H
+
+#include <asm/types.h>
+
+#define __SWAB_64_THRU_32__
+
+static inline __const__ __u32
+__arch_swab32(__u32 x)
+{
+	__asm__ __volatile__ ("swapwb %0" : "=r" (x) : "0" (x));
+	return (x);
+}
+#define __arch_swab32 __arch_swab32
+
+static inline __const__ __u16
+__arch_swab16(__u16 x)
+{
+	__asm__ __volatile__ ("swapb %0" : "=r" (x) : "0" (x));
+	return (x);
+}
+#define __arch_swab32 __arch_swab32
+
+#endif /* _ASM_CRIS_ARCH_SWAB_H */
diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild
index d5b6319..b79b7c6 100644
--- a/arch/cris/include/asm/Kbuild
+++ b/arch/cris/include/asm/Kbuild
@@ -9,3 +9,4 @@ header-y += sync_serial.h
 
 unifdef-y += etraxgpio.h
 unifdef-y += rs485.h
+unifdef-y += swab.h
diff --git a/arch/cris/include/asm/byteorder.h b/arch/cris/include/asm/byteorder.h
index cc8e418..7678d86 100644
--- a/arch/cris/include/asm/byteorder.h
+++ b/arch/cris/include/asm/byteorder.h
@@ -1,25 +1,7 @@
 #ifndef _CRIS_BYTEORDER_H
 #define _CRIS_BYTEORDER_H
 
-#ifdef __GNUC__
-
-#ifdef __KERNEL__
-#include <arch/byteorder.h>
-
-/* defines are necessary because the other files detect the presence
- * of a defined __arch_swab32, not an inline
- */
-#define __arch__swab32(x) ___arch__swab32(x)
-#define __arch__swab16(x) ___arch__swab16(x)
-#endif /* __KERNEL__ */
-
-#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
-#  define __BYTEORDER_HAS_U64__
-#  define __SWAB_64_THRU_32__
-#endif
-
-#endif /* __GNUC__ */
-
+#include <asm/swab.h>
 #include <linux/byteorder/little_endian.h>
 
 #endif
diff --git a/arch/cris/include/asm/swab.h b/arch/cris/include/asm/swab.h
new file mode 100644
index 0000000..80668e8
--- /dev/null
+++ b/arch/cris/include/asm/swab.h
@@ -0,0 +1,8 @@
+#ifndef _CRIS_SWAB_H
+#define _CRIS_SWAB_H
+
+#ifdef __KERNEL__
+#include <arch/swab.h>
+#endif /* __KERNEL__ */
+
+#endif /* _CRIS_SWAB_H */
-- 
1.6.1.212.g4b3ec



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] cris: introduce asm/swab.h
  2009-01-14  3:26 [PATCH 1/2] cris: introduce asm/swab.h Harvey Harrison
@ 2009-01-14  3:31 ` Harvey Harrison
  2009-01-24 12:10 ` Jaswinder Singh Rajput
  1 sibling, 0 replies; 4+ messages in thread
From: Harvey Harrison @ 2009-01-14  3:31 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Jesper Nilsson, LKML

Adjust the arch overrides to the new names as well.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
Sorry, _this_ is the one that won't break anything.  Previous patch
was incorrect in the defines in arch-v32/swab.h

 arch/cris/include/arch-v10/arch/byteorder.h |   26 -----------------------
 arch/cris/include/arch-v10/arch/swab.h      |   30 +++++++++++++++++++++++++++
 arch/cris/include/arch-v32/arch/byteorder.h |   20 ------------------
 arch/cris/include/arch-v32/arch/swab.h      |   24 +++++++++++++++++++++
 arch/cris/include/asm/Kbuild                |    1 +
 arch/cris/include/asm/byteorder.h           |   20 +-----------------
 arch/cris/include/asm/swab.h                |    8 +++++++
 7 files changed, 64 insertions(+), 65 deletions(-)

diff --git a/arch/cris/include/arch-v10/arch/byteorder.h b/arch/cris/include/arch-v10/arch/byteorder.h
deleted file mode 100644
index 255b646..0000000
--- a/arch/cris/include/arch-v10/arch/byteorder.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef _CRIS_ARCH_BYTEORDER_H
-#define _CRIS_ARCH_BYTEORDER_H
-
-#include <asm/types.h>
-#include <linux/compiler.h>
-
-/* we just define these two (as we can do the swap in a single
- * asm instruction in CRIS) and the arch-independent files will put
- * them together into ntohl etc.
- */
-
-static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
-{
-	__asm__ ("swapwb %0" : "=r" (x) : "0" (x));
-  
-	return(x);
-}
-
-static inline __attribute_const__ __u16 ___arch__swab16(__u16 x)
-{
-	__asm__ ("swapb %0" : "=r" (x) : "0" (x));
-	
-	return(x);
-}
-
-#endif
diff --git a/arch/cris/include/arch-v10/arch/swab.h b/arch/cris/include/arch-v10/arch/swab.h
new file mode 100644
index 0000000..e4e847d
--- /dev/null
+++ b/arch/cris/include/arch-v10/arch/swab.h
@@ -0,0 +1,30 @@
+#ifndef _CRIS_ARCH_SWAB_H
+#define _CRIS_ARCH_SWAB_H
+
+#include <asm/types.h>
+#include <linux/compiler.h>
+
+#define __SWAB_64_THRU_32__
+
+/* we just define these two (as we can do the swap in a single
+ * asm instruction in CRIS) and the arch-independent files will put
+ * them together into ntohl etc.
+ */
+
+static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
+{
+	__asm__ ("swapwb %0" : "=r" (x) : "0" (x));
+
+	return(x);
+}
+#define __arch_swab32 __arch_swab32
+
+static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
+{
+	__asm__ ("swapb %0" : "=r" (x) : "0" (x));
+
+	return(x);
+}
+#define __arch_swab16 __arch_swab16
+
+#endif
diff --git a/arch/cris/include/arch-v32/arch/byteorder.h b/arch/cris/include/arch-v32/arch/byteorder.h
deleted file mode 100644
index 6ef8fb4..0000000
--- a/arch/cris/include/arch-v32/arch/byteorder.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _ASM_CRIS_ARCH_BYTEORDER_H
-#define _ASM_CRIS_ARCH_BYTEORDER_H
-
-#include <asm/types.h>
-
-static inline __const__ __u32
-___arch__swab32(__u32 x)
-{
-	__asm__ __volatile__ ("swapwb %0" : "=r" (x) : "0" (x));
-	return (x);
-}
-
-static inline __const__ __u16
-___arch__swab16(__u16 x)
-{
-	__asm__ __volatile__ ("swapb %0" : "=r" (x) : "0" (x));
-	return (x);
-}
-
-#endif /* _ASM_CRIS_ARCH_BYTEORDER_H */
diff --git a/arch/cris/include/arch-v32/arch/swab.h b/arch/cris/include/arch-v32/arch/swab.h
new file mode 100644
index 0000000..9a4ea5e
--- /dev/null
+++ b/arch/cris/include/arch-v32/arch/swab.h
@@ -0,0 +1,24 @@
+#ifndef _ASM_CRIS_ARCH_SWAB_H
+#define _ASM_CRIS_ARCH_SWAB_H
+
+#include <asm/types.h>
+
+#define __SWAB_64_THRU_32__
+
+static inline __const__ __u32
+__arch_swab32(__u32 x)
+{
+	__asm__ __volatile__ ("swapwb %0" : "=r" (x) : "0" (x));
+	return (x);
+}
+#define __arch_swab32 __arch_swab32
+
+static inline __const__ __u16
+__arch_swab16(__u16 x)
+{
+	__asm__ __volatile__ ("swapb %0" : "=r" (x) : "0" (x));
+	return (x);
+}
+#define __arch_swab16 __arch_swab16
+
+#endif /* _ASM_CRIS_ARCH_SWAB_H */
diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild
index d5b6319..b79b7c6 100644
--- a/arch/cris/include/asm/Kbuild
+++ b/arch/cris/include/asm/Kbuild
@@ -9,3 +9,4 @@ header-y += sync_serial.h
 
 unifdef-y += etraxgpio.h
 unifdef-y += rs485.h
+unifdef-y += swab.h
diff --git a/arch/cris/include/asm/byteorder.h b/arch/cris/include/asm/byteorder.h
index cc8e418..7678d86 100644
--- a/arch/cris/include/asm/byteorder.h
+++ b/arch/cris/include/asm/byteorder.h
@@ -1,25 +1,7 @@
 #ifndef _CRIS_BYTEORDER_H
 #define _CRIS_BYTEORDER_H
 
-#ifdef __GNUC__
-
-#ifdef __KERNEL__
-#include <arch/byteorder.h>
-
-/* defines are necessary because the other files detect the presence
- * of a defined __arch_swab32, not an inline
- */
-#define __arch__swab32(x) ___arch__swab32(x)
-#define __arch__swab16(x) ___arch__swab16(x)
-#endif /* __KERNEL__ */
-
-#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
-#  define __BYTEORDER_HAS_U64__
-#  define __SWAB_64_THRU_32__
-#endif
-
-#endif /* __GNUC__ */
-
+#include <asm/swab.h>
 #include <linux/byteorder/little_endian.h>
 
 #endif
diff --git a/arch/cris/include/asm/swab.h b/arch/cris/include/asm/swab.h
new file mode 100644
index 0000000..80668e8
--- /dev/null
+++ b/arch/cris/include/asm/swab.h
@@ -0,0 +1,8 @@
+#ifndef _CRIS_SWAB_H
+#define _CRIS_SWAB_H
+
+#ifdef __KERNEL__
+#include <arch/swab.h>
+#endif /* __KERNEL__ */
+
+#endif /* _CRIS_SWAB_H */
-- 
1.6.1.212.g4b3ec




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] cris: introduce asm/swab.h
  2009-01-14  3:26 [PATCH 1/2] cris: introduce asm/swab.h Harvey Harrison
  2009-01-14  3:31 ` Harvey Harrison
@ 2009-01-24 12:10 ` Jaswinder Singh Rajput
  2009-01-24 20:10   ` Harvey Harrison
  1 sibling, 1 reply; 4+ messages in thread
From: Jaswinder Singh Rajput @ 2009-01-24 12:10 UTC (permalink / raw)
  To: Harvey Harrison; +Cc: Linus Torvalds, Jesper Nilsson, LKML, Sam Ravnborg

On Wed, Jan 14, 2009 at 8:56 AM, Harvey Harrison
<harvey.harrison@gmail.com> wrote:
> Adjust the arch overrides to the new names as well.
>
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> ---
> Jesper, I noticed that my patch was the only one for CRIS this merge
> window (at least looking at linux-next), I hope you're OK with me
> sending this directly to Linus.  It's just code movement, so I'm
> confident it's not going to break anything.
>
>  arch/cris/include/arch-v10/arch/byteorder.h |   26 -----------------------
>  arch/cris/include/arch-v10/arch/swab.h      |   30 +++++++++++++++++++++++++++
>  arch/cris/include/arch-v32/arch/byteorder.h |   20 ------------------
>  arch/cris/include/arch-v32/arch/swab.h      |   24 +++++++++++++++++++++
>  arch/cris/include/asm/Kbuild                |    1 +
>  arch/cris/include/asm/byteorder.h           |   20 +-----------------
>  arch/cris/include/asm/swab.h                |    8 +++++++
>  7 files changed, 64 insertions(+), 65 deletions(-)
>
> diff --git a/arch/cris/include/arch-v10/arch/swab.h b/arch/cris/include/arch-v10/arch/swab.h
> new file mode 100644
> index 0000000..e4e847d
> --- /dev/null
> +++ b/arch/cris/include/arch-v10/arch/swab.h
> @@ -0,0 +1,30 @@
> +#ifndef _CRIS_ARCH_SWAB_H
> +#define _CRIS_ARCH_SWAB_H
> +
> +#include <asm/types.h>

Please replace #include <asm/types.h> with #include <linux/types.h>
otherwise you will get following 'make headers_check' warnings:
  usr/include/asm/swab.h:4: include of <linux/types.h> is preferred
over <asm/types.h>
  usr/include/asm/swab.h:14: found __[us]{8,16,32,64} type without
#include <linux/types.h>

> diff --git a/arch/cris/include/arch-v32/arch/swab.h b/arch/cris/include/arch-v32/arch/swab.h
> new file mode 100644
> index 0000000..1152329
> --- /dev/null
> +++ b/arch/cris/include/arch-v32/arch/swab.h
> @@ -0,0 +1,24 @@
> +#ifndef _ASM_CRIS_ARCH_SWAB_H
> +#define _ASM_CRIS_ARCH_SWAB_H
> +
> +#include <asm/types.h>

ditto.

If possible, please also fix your other patches which are in queue.

--
JSR

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] cris: introduce asm/swab.h
  2009-01-24 12:10 ` Jaswinder Singh Rajput
@ 2009-01-24 20:10   ` Harvey Harrison
  0 siblings, 0 replies; 4+ messages in thread
From: Harvey Harrison @ 2009-01-24 20:10 UTC (permalink / raw)
  To: Jaswinder Singh Rajput; +Cc: Linus Torvalds, Jesper Nilsson, LKML, Sam Ravnborg

On Sat, 2009-01-24 at 17:40 +0530, Jaswinder Singh Rajput wrote:
> On Wed, Jan 14, 2009 at 8:56 AM, Harvey Harrison
> <harvey.harrison@gmail.com> wrote:
> > Adjust the arch overrides to the new names as well.
> >
> > --- /dev/null
> > +++ b/arch/cris/include/arch-v10/arch/swab.h
> > @@ -0,0 +1,30 @@
> > +#ifndef _CRIS_ARCH_SWAB_H
> > +#define _CRIS_ARCH_SWAB_H
> > +
> > +#include <asm/types.h>
> 
> Please replace #include <asm/types.h> with #include <linux/types.h>
> otherwise you will get following 'make headers_check' warnings:
>   usr/include/asm/swab.h:4: include of <linux/types.h> is preferred
> over <asm/types.h>
>   usr/include/asm/swab.h:14: found __[us]{8,16,32,64} type without
> #include <linux/types.h>
> 

1) I sent this patch bypassing the arch maintainer, so I made it as
simple as possible, just moved the byteorder.h's and changed the
names of the arch-overrides.

2) If you'd care to check, this file is not exported to userspace, so
I can't possible trigger that warning.

3) It's already in Linus' tree, so it's a bit hard for me to change it
now ;-)

Harvey


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-01-24 20:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-14  3:26 [PATCH 1/2] cris: introduce asm/swab.h Harvey Harrison
2009-01-14  3:31 ` Harvey Harrison
2009-01-24 12:10 ` Jaswinder Singh Rajput
2009-01-24 20:10   ` Harvey Harrison

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox