Skip to contentSkip to conversation

endian: sync {big,little}_endian.h with linux-4.2

PATCH In review Antony Pavlov 2 participants 5 messages Sep 8, 2015 – Sep 10, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 endian: sync {big,little}_endian.h with linux-4.2

---

This patch makes ehci-hcd.c happy on big-endian MIPS by importing __constant_cpu_to_le16()
from linux.git/include/uapi/linux/byteorder/big_endian.h

 include/linux/byteorder/big_endian.h    | 118 +++++++++++++++++++++-----------
 include/linux/byteorder/little_endian.h | 118 +++++++++++++++++++++-----------
 2 files changed, 156 insertions(+), 80 deletions(-)
include/linux/byteorder/big_endian.h +78 -40
index e560ef6..539f710 100644
@@ -9,48 +9,86 @@
 #endif
 #define	__BYTE_ORDER	__BIG_ENDIAN
 
+#include <linux/types.h>
 #include <linux/swab.h>
 
-#define __constant_htonl(x) ((__u32)(x))
-#define __constant_ntohl(x) ((__u32)(x))
-#define __constant_htons(x) ((__u16)(x))
-#define __constant_ntohs(x) ((__u16)(x))
-#define __constant_cpu_to_le64(x) ___swab64((x))
-#define __constant_le64_to_cpu(x) ___swab64((x))
-#define __constant_cpu_to_le32(x) ___swab32((x))
-#define __constant_le32_to_cpu(x) ___swab32((x))
-#define __constant_cpu_to_le16(x) ___swab16((x))
-#define __constant_le16_to_cpu(x) ___swab16((x))
-#define __constant_cpu_to_be64(x) ((__u64)(x))
-#define __constant_be64_to_cpu(x) ((__u64)(x))
-#define __constant_cpu_to_be32(x) ((__u32)(x))
-#define __constant_be32_to_cpu(x) ((__u32)(x))
-#define __constant_cpu_to_be16(x) ((__u16)(x))
-#define __constant_be16_to_cpu(x) ((__u16)(x))
-#define __cpu_to_le64(x) __swab64((x))
-#define __le64_to_cpu(x) __swab64((x))
-#define __cpu_to_le32(x) __swab32((x))
-#define __le32_to_cpu(x) __swab32((x))
-#define __cpu_to_le16(x) __swab16((x))
-#define __le16_to_cpu(x) __swab16((x))
-#define __cpu_to_be64(x) ((__u64)(x))
-#define __be64_to_cpu(x) ((__u64)(x))
-#define __cpu_to_be32(x) ((__u32)(x))
-#define __be32_to_cpu(x) ((__u32)(x))
-#define __cpu_to_be16(x) ((__u16)(x))
-#define __be16_to_cpu(x) ((__u16)(x))
-#define __cpu_to_le64p(x) __swab64p((x))
-#define __le64_to_cpup(x) __swab64p((x))
-#define __cpu_to_le32p(x) __swab32p((x))
-#define __le32_to_cpup(x) __swab32p((x))
-#define __cpu_to_le16p(x) __swab16p((x))
-#define __le16_to_cpup(x) __swab16p((x))
-#define __cpu_to_be64p(x) (*(__u64*)(x))
-#define __be64_to_cpup(x) (*(__u64*)(x))
-#define __cpu_to_be32p(x) (*(__u32*)(x))
-#define __be32_to_cpup(x) (*(__u32*)(x))
-#define __cpu_to_be16p(x) (*(__u16*)(x))
-#define __be16_to_cpup(x) (*(__u16*)(x))
+#define __constant_htonl(x) ((__force __be32)(__u32)(x))
+#define __constant_ntohl(x) ((__force __u32)(__be32)(x))
+#define __constant_htons(x) ((__force __be16)(__u16)(x))
+#define __constant_ntohs(x) ((__force __u16)(__be16)(x))
+#define __constant_cpu_to_le64(x) ((__force __le64)___constant_swab64((x)))
+#define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64)(__le64)(x))
+#define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x)))
+#define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32)(__le32)(x))
+#define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x)))
+#define __constant_le16_to_cpu(x) ___constant_swab16((__force __u16)(__le16)(x))
+#define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x))
+#define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x))
+#define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x))
+#define __constant_be32_to_cpu(x) ((__force __u32)(__be32)(x))
+#define __constant_cpu_to_be16(x) ((__force __be16)(__u16)(x))
+#define __constant_be16_to_cpu(x) ((__force __u16)(__be16)(x))
+#define __cpu_to_le64(x) ((__force __le64)__swab64((x)))
+#define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x))
+#define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
+#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
+#define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
+#define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
+#define __cpu_to_be64(x) ((__force __be64)(__u64)(x))
+#define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
+#define __cpu_to_be32(x) ((__force __be32)(__u32)(x))
+#define __be32_to_cpu(x) ((__force __u32)(__be32)(x))
+#define __cpu_to_be16(x) ((__force __be16)(__u16)(x))
+#define __be16_to_cpu(x) ((__force __u16)(__be16)(x))
+
+static inline __le64 __cpu_to_le64p(const __u64 *p)
+{
+	return (__force __le64)__swab64p(p);
+}
+static inline __u64 __le64_to_cpup(const __le64 *p)
+{
+	return __swab64p((__u64 *)p);
+}
+static inline __le32 __cpu_to_le32p(const __u32 *p)
+{
+	return (__force __le32)__swab32p(p);
+}
+static inline __u32 __le32_to_cpup(const __le32 *p)
+{
+	return __swab32p((__u32 *)p);
+}
+static inline __le16 __cpu_to_le16p(const __u16 *p)
+{
+	return (__force __le16)__swab16p(p);
+}
+static inline __u16 __le16_to_cpup(const __le16 *p)
+{
+	return __swab16p((__u16 *)p);
+}
+static inline __be64 __cpu_to_be64p(const __u64 *p)
+{
+	return (__force __be64)*p;
+}
+static inline __u64 __be64_to_cpup(const __be64 *p)
+{
+	return (__force __u64)*p;
+}
+static inline __be32 __cpu_to_be32p(const __u32 *p)
+{
+	return (__force __be32)*p;
+}
+static inline __u32 __be32_to_cpup(const __be32 *p)
+{
+	return (__force __u32)*p;
+}
+static inline __be16 __cpu_to_be16p(const __u16 *p)
+{
+	return (__force __be16)*p;
+}
+static inline __u16 __be16_to_cpup(const __be16 *p)
+{
+	return (__force __u16)*p;
+}
 #define __cpu_to_le64s(x) __swab64s((x))
 #define __le64_to_cpus(x) __swab64s((x))
 #define __cpu_to_le32s(x) __swab32s((x))
include/linux/byteorder/little_endian.h +78 -40

126 lines not on this page · raw message

Signature · 7 lines
2.5.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

Hi Antony,

Quoted 10 lines · Antony Pavlov

---

This patch makes ehci-hcd.c happy on big-endian MIPS by importing __constant_cpu_to_le16()
from linux.git/include/uapi/linux/byteorder/big_endian.h

 include/linux/byteorder/big_endian.h    | 118 +++++++++++++++++++++-----------
 include/linux/byteorder/little_endian.h | 118 +++++++++++++++++++++-----------
 2 files changed, 156 insertions(+), 80 deletions(-)

Applying: endian: sync {big,little}_endian.h with linux-4.2
error: patch failed: include/linux/byteorder/little_endian.h:9
error: include/linux/byteorder/little_endian.h: patch does not apply

include/linux/byteorder/little_endian.h hasn't been changed since 2011. Do you have other patches in your tree?

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw
Quoted 14 lines · On Wed, 9 Sep 2015 08:44:35 +0200 Sascha Hauer <[email protected]> wrote:

Hi Antony,

Quoted 10 lines · Antony Pavlov

---

This patch makes ehci-hcd.c happy on big-endian MIPS by importing __constant_cpu_to_le16()
from linux.git/include/uapi/linux/byteorder/big_endian.h

 include/linux/byteorder/big_endian.h    | 118 +++++++++++++++++++++-----------
 include/linux/byteorder/little_endian.h | 118 +++++++++++++++++++++-----------
 2 files changed, 156 insertions(+), 80 deletions(-)
Quoted 6 lines

Applying: endian: sync {big,little}_endian.h with linux-4.2
error: patch failed: include/linux/byteorder/little_endian.h:9
error: include/linux/byteorder/little_endian.h: patch does not apply

include/linux/byteorder/little_endian.h hasn't been changed since 2011. Do you have other patches in your tree?

I have no other patches. Here is my 'git log -2' output:

commit 85e356fdff6e02dc7535b0dfcbe4bbf51604407e

Author: Antony Pavlov <[email protected]>
Date:   Wed Dec 3 23:44:54 2014 +0300

endian: sync {big,little}_endian.h with linux-4.2

commit 4d3a2a9b61388af4b27434c57ae3b6ca265830c5
Merge: 9dd0e52 790584b
Author: Sascha Hauer <[email protected]>
Date: Mon Sep 7 07:20:31 2015 +0200

Merge branch 'for-next/usb' into next

I have just pushed my endian-related branch to github:
https://github.com/frantony/barebox/tree/20150908.endian

Quoted 7 lines

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
Signature · 8 lines
-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw
In reply to Sascha Hauer
Quoted 14 lines · On Wed, 9 Sep 2015 08:44:35 +0200 Sascha Hauer <[email protected]> wrote:

Hi Antony,

Quoted 10 lines · Antony Pavlov

---

This patch makes ehci-hcd.c happy on big-endian MIPS by importing __constant_cpu_to_le16()
from linux.git/include/uapi/linux/byteorder/big_endian.h

 include/linux/byteorder/big_endian.h    | 118 +++++++++++++++++++++-----------
 include/linux/byteorder/little_endian.h | 118 +++++++++++++++++++++-----------
 2 files changed, 156 insertions(+), 80 deletions(-)
Quoted 5 lines

Applying: endian: sync {big,little}_endian.h with linux-4.2
error: patch failed: include/linux/byteorder/little_endian.h:9
error: include/linux/byteorder/little_endian.h: patch does not apply

include/linux/byteorder/little_endian.h hasn't been changed since 2011.

Hmm, I see a new endian related patch in pengutronix next branch. Please see below.

Quoted 1 line

Do you have other patches in your tree?

Do you have this patch in you local tree?

commit d192ebe8bb78296d1d86b35cacb7aa3cd5414d7a

Author: David S. Miller <[email protected]>
Date:   Tue Sep 1 15:48:08 2015 +0300

endian: Always evaluate arguments

...

 include/linux/byteorder/big_endian.h    | 12 ++++++------
 include/linux/byteorder/little_endian.h | 12 ++++++------
Quoted 7 lines

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
Signature · 8 lines
-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw
Quoted 25 lines · Antony Pavlov
Quoted 14 lines · On Wed, 9 Sep 2015 08:44:35 +0200 Sascha Hauer <[email protected]> wrote:

Hi Antony,

Quoted 10 lines · Antony Pavlov

---

This patch makes ehci-hcd.c happy on big-endian MIPS by importing __constant_cpu_to_le16()
from linux.git/include/uapi/linux/byteorder/big_endian.h

 include/linux/byteorder/big_endian.h    | 118 +++++++++++++++++++++-----------
 include/linux/byteorder/little_endian.h | 118 +++++++++++++++++++++-----------
 2 files changed, 156 insertions(+), 80 deletions(-)
Quoted 5 lines

Applying: endian: sync {big,little}_endian.h with linux-4.2
error: patch failed: include/linux/byteorder/little_endian.h:9
error: include/linux/byteorder/little_endian.h: patch does not apply

include/linux/byteorder/little_endian.h hasn't been changed since 2011.

Hmm, I see a new endian related patch in pengutronix next branch. Please see below.

Quoted 7 lines
Quoted 1 line

Do you have other patches in your tree?

Do you have this patch in you local tree?

commit d192ebe8bb78296d1d86b35cacb7aa3cd5414d7a

Author: David S. Miller <[email protected]>
Date:   Tue Sep 1 15:48:08 2015 +0300

Oh, your patch is based on this one. I applied it atop of it.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox