[PATCH 3/5] include: Add foreign endianess adding functions from kernel

Sascha Hauer s.hauer at pengutronix.de
Tue Jul 15 06:49:31 PDT 2014


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 include/linux/byteorder/generic.h | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h
index 2d68d99..e59ba45 100644
--- a/include/linux/byteorder/generic.h
+++ b/include/linux/byteorder/generic.h
@@ -175,5 +175,34 @@ extern unsigned short int	htons(unsigned short int);
 
 #endif /* OPTIMIZE */
 
+static inline void le16_add_cpu(__le16 *var, u16 val)
+{
+	*var = cpu_to_le16(le16_to_cpu(*var) + val);
+}
+
+static inline void le32_add_cpu(__le32 *var, u32 val)
+{
+	*var = cpu_to_le32(le32_to_cpu(*var) + val);
+}
+
+static inline void le64_add_cpu(__le64 *var, u64 val)
+{
+	*var = cpu_to_le64(le64_to_cpu(*var) + val);
+}
+
+static inline void be16_add_cpu(__be16 *var, u16 val)
+{
+	*var = cpu_to_be16(be16_to_cpu(*var) + val);
+}
+
+static inline void be32_add_cpu(__be32 *var, u32 val)
+{
+	*var = cpu_to_be32(be32_to_cpu(*var) + val);
+}
+
+static inline void be64_add_cpu(__be64 *var, u64 val)
+{
+	*var = cpu_to_be64(be64_to_cpu(*var) + val);
+}
 
 #endif /* _LINUX_BYTEORDER_GENERIC_H */
-- 
2.0.1




More information about the barebox mailing list