summaryrefslogtreecommitdiffstats
path: root/arch/blackfin/include/uapi/asm/swab.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-18 10:54:27 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-18 10:54:27 -0800
commit4351654e3ddf86a04966163dce4def586303e5cc (patch)
treeeeb683133e78fbe522c80d0895f94ce4ca699a23 /arch/blackfin/include/uapi/asm/swab.h
parent3d9de1909b339f967f1b37367df233a0dcfc10cf (diff)
parent86794b43569c9b8936dff2e8eed503393379af6e (diff)
downloadtalos-op-linux-4351654e3ddf86a04966163dce4def586303e5cc.tar.gz
talos-op-linux-4351654e3ddf86a04966163dce4def586303e5cc.zip
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lliubbo/blackfin
Pull blackfin update from Bob Liu. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lliubbo/blackfin: blackfin: SEC: clean up SEC interrupt initialization blackfin: kgdb: call generic_exec_single() directly blackfin: anomaly: add anomaly 16000030 for bf5xx Blackfin: dpmc: use module_platform_driver macro Blackfin: remove unused is_in_rom() Blackfin: remove unnecessary prototype for kobjsize() Blackfin: twi: Add missing __iomem annotation Blackfin: Annotate strnlen_user and strlen_user 'src' parameter with __user Blackfin: Annotate clear_user 'to' parameter with __user Blackfin: Add missing __user annotations to put_user Blackfin: Annotate strncpy_from_user src parameter with __user blackfin: Use Kbuild infrastructure for kvm_para.h UAPI: (Scripted) Disintegrate arch/blackfin/include/asm
Diffstat (limited to 'arch/blackfin/include/uapi/asm/swab.h')
-rw-r--r--arch/blackfin/include/uapi/asm/swab.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/arch/blackfin/include/uapi/asm/swab.h b/arch/blackfin/include/uapi/asm/swab.h
new file mode 100644
index 000000000000..89de6507ca2b
--- /dev/null
+++ b/arch/blackfin/include/uapi/asm/swab.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2009 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#ifndef _BLACKFIN_SWAB_H
+#define _BLACKFIN_SWAB_H
+
+#include <linux/types.h>
+#include <asm-generic/swab.h>
+
+#ifdef __GNUC__
+
+static __inline__ __attribute_const__ __u32 __arch_swahb32(__u32 xx)
+{
+ __u32 tmp;
+ __asm__("%1 = %0 >> 8 (V);\n\t"
+ "%0 = %0 << 8 (V);\n\t"
+ "%0 = %0 | %1;\n\t"
+ : "+d"(xx), "=&d"(tmp));
+ return xx;
+}
+#define __arch_swahb32 __arch_swahb32
+
+static __inline__ __attribute_const__ __u32 __arch_swahw32(__u32 xx)
+{
+ __u32 rv;
+ __asm__("%0 = PACK(%1.L, %1.H);\n\t": "=d"(rv): "d"(xx));
+ return rv;
+}
+#define __arch_swahw32 __arch_swahw32
+
+static __inline__ __attribute_const__ __u32 __arch_swab32(__u32 xx)
+{
+ return __arch_swahb32(__arch_swahw32(xx));
+}
+#define __arch_swab32 __arch_swab32
+
+static __inline__ __attribute_const__ __u16 __arch_swab16(__u16 xx)
+{
+ __u32 xw = xx;
+ __asm__("%0 <<= 8;\n %0.L = %0.L + %0.H (NS);\n": "+d"(xw));
+ return (__u16)xw;
+}
+#define __arch_swab16 __arch_swab16
+
+#endif /* __GNUC__ */
+
+#endif /* _BLACKFIN_SWAB_H */
OpenPOWER on IntegriCloud