Skip to contentSkip to conversation

cris: introduce asm/swab.h

PATCH In review Harvey Harrison 3 participants 6 messages Jan 6, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 3/23 cris: introduce asm/swab.h

cris holds its arch overrides in an arch/ folder, rename these byteorder.h files to swab.h and include them from asm/swab.h

---
 arch/cris/include/arch-v10/arch/byteorder.h |   28 ---------------------------
 arch/cris/include/arch-v10/arch/swab.h      |   28 +++++++++++++++++++++++++++
 arch/cris/include/arch-v32/arch/byteorder.h |   22 ---------------------
 arch/cris/include/arch-v32/arch/swab.h      |   22 +++++++++++++++++++++
 arch/cris/include/asm/Kbuild                |    1 +
 arch/cris/include/asm/byteorder.h           |   10 +-------
 arch/cris/include/asm/swab.h                |   12 +++++++++++
 7 files changed, 65 insertions(+), 58 deletions(-)
arch/cris/include/arch-v10/arch/byteorder.h deleted +0 -28
deleted file mode 100644
index ffbd667..0000000
@@ -1,28 +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);
-}
-#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
arch/cris/include/arch-v10/arch/swab.h new file +28 -0
new file mode 100644
index 0000000..3eb0993
@@ -0,0 +1,28 @@
+#ifndef _CRIS_ARCH_SWAB_H
+#define _CRIS_ARCH_SWAB_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);
+}
+#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
arch/cris/include/arch-v32/arch/byteorder.h deleted +0 -22
deleted file mode 100644
index fb76087..0000000
@@ -1,22 +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);
-}
-#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_BYTEORDER_H */
arch/cris/include/arch-v32/arch/swab.h new file +22 -0
new file mode 100644
index 0000000..ed1f280
@@ -0,0 +1,22 @@
+#ifndef _ASM_CRIS_ARCH_SWAB_H
+#define _ASM_CRIS_ARCH_SWAB_H
+
+#include <asm/types.h>
+
+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 */
arch/cris/include/asm/Kbuild +1 -0
index d5b6319..b79b7c6 100644
@@ -9,3 +9,4 @@ header-y += sync_serial.h
 
 unifdef-y += etraxgpio.h
 unifdef-y += rs485.h
+unifdef-y += swab.h
arch/cris/include/asm/byteorder.h +2 -8
index 420c030..7678d86 100644
@@ -1,14 +1,8 @@
 #ifndef _CRIS_BYTEORDER_H
 #define _CRIS_BYTEORDER_H
 
-#define __LITTLE_ENDIAN
-#define __SWAB_64_THRU_32__
-
-#ifdef __KERNEL__
-# include <arch/byteorder.h>
-#endif
-
-#include <linux/byteorder.h>
+#include <asm/swab.h>
+#include <linux/byteorder/little_endian.h>
 
 #endif
 
arch/cris/include/asm/swab.h new file +12 -0
new file mode 100644
index 0000000..9a0ad25
@@ -0,0 +1,12 @@
+#ifndef _CRIS_SWAB_H
+#define _CRIS_SWAB_H
+
+#define __SWAB_64_THRU_32__
+
+#ifdef __KERNEL__
+# include <arch/swab.h>
+#endif
+
+#endif
+
+
Signature · 1 line
1.6.1.94.g9388
#1 lore raw
Quoted 10 lines · Harvey Harrison

cris holds its arch overrides in an arch/ folder, rename these byteorder.h files to swab.h and include them from asm/swab.h

---
 arch/cris/include/arch-v10/arch/byteorder.h |   28 ---------------------------
 arch/cris/include/arch-v10/arch/swab.h      |   28 +++++++++++++++++++++++++++
 arch/cris/include/arch-v32/arch/byteorder.h |   22 ---------------------
 arch/cris/include/arch-v32/arch/swab.h      |   22 +++++++++++++++++++++

Since you'e a git user, and you're basically renaming files while then putting a new name in place, can you please send patches done with both the "-M" flag (rename detection) _and_ the "-B" flag (which breaks associations of files even if the name stays the same)?

It's rare that this is needed, but it really helps. Now the patches look like a big delete/create event, and it's not at all obvious that the code is actually the same before and after.

Linus

#2 lore raw
Quoted 14 lines · Linus Torvalds
Quoted 10 lines · Harvey Harrison

cris holds its arch overrides in an arch/ folder, rename these byteorder.h files to swab.h and include them from asm/swab.h

---
 arch/cris/include/arch-v10/arch/byteorder.h |   28 ---------------------------
 arch/cris/include/arch-v10/arch/swab.h      |   28 +++++++++++++++++++++++++++
 arch/cris/include/arch-v32/arch/byteorder.h |   22 ---------------------
 arch/cris/include/arch-v32/arch/swab.h      |   22 +++++++++++++++++++++
Quoted 8 lines

Since you'e a git user, and you're basically renaming files while then putting a new name in place, can you please send patches done with both the "-M" flag (rename detection) _and_ the "-B" flag (which breaks associations of files even if the name stays the same)?

It's rare that this is needed, but it really helps. Now the patches look like a big delete/create event, and it's not at all obvious that the code is actually the same before and after.

Sure, I sent regular patches as a courtesy to Andrew in case he slurped it up, but I can resend with -M -B if you're going to take it directly, should I wait until I see the remaining 4 arches hit your tree, or will you worry about the timing?

Harvey

#3 lore raw
Quoted 5 lines · Harvey Harrison

Sure, I sent regular patches as a courtesy to Andrew in case he slurped it up, but I can resend with -M -B if you're going to take it directly, should I wait until I see the remaining 4 arches hit your tree, or will you worry about the timing?

I'm not sure worrying about the timing makes much sense, since the bigger worry is wanting to merge things in time for -rc1 - and that means having a few days to catch any gotcha's. If parisc/xtensa/cris is broken for a day or two, I don't consider that a problem.

Linus

#4 lore raw
Quoted 9 lines · Linus Torvalds
Quoted 5 lines · Harvey Harrison

Sure, I sent regular patches as a courtesy to Andrew in case he slurped it up, but I can resend with -M -B if you're going to take it directly, should I wait until I see the remaining 4 arches hit your tree, or will you worry about the timing?

Quoted 4 lines

I'm not sure worrying about the timing makes much sense, since the bigger worry is wanting to merge things in time for -rc1 - and that means having a few days to catch any gotcha's. If parisc/xtensa/cris is broken for a day or two, I don't consider that a problem.

mn10300, frv and maybe h8300 are waiting for these patches to hit mainline before they move their headers to arch/$ARCH/include

So sooner is better so we can get the rest fixed in this respect.

For m68k I have sent a patch to unify the headers for m68k and m68knommu in arch/m68k/include/...

I really hope it is heading towards you soon.

Sam

#5 lore raw
In reply to Linus Torvalds
Quoted 8 lines · Linus Torvalds
Quoted 5 lines · Harvey Harrison

Sure, I sent regular patches as a courtesy to Andrew in case he slurped it up, but I can resend with -M -B if you're going to take it directly, should I wait until I see the remaining 4 arches hit your tree, or will you worry about the timing?

Quoted 4 lines

I'm not sure worrying about the timing makes much sense, since the bigger worry is wanting to merge things in time for -rc1 - and that means having a few days to catch any gotcha's. If parisc/xtensa/cris is broken for a day or two, I don't consider that a problem.

I've seen the sparc pull request go by and will assume it will be in your tree.

I will not send cris, xtensa, parisc and the removal patches (22-23) so these arches don't get broken even for a few days and will send those three and the removal patch as soon as they merged.

Cheers,

Harvey