aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-10-25 11:55:06 +0200
committerTakashi Iwai <tiwai@suse.de>2013-10-25 11:55:06 +0200
commite88f53074274d5187078c2cc31ff7ab2eb40bad1 (patch)
tree5c1e9e5fff1623d8d1cbf38eef85ba56dc75492d
parente3d4389748001e9f56c524741ffb0dae9ad3532f (diff)
downloadhda-emu-e88f53074274d5187078c2cc31ff7ab2eb40bad1.tar.gz
Add put_unaligned*() and copy_from/to_user() wrappers
Just simplistic ones, not portable at all. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--include/asm/unaligned.h6
-rw-r--r--include/wrapper.h12
2 files changed, 18 insertions, 0 deletions
diff --git a/include/asm/unaligned.h b/include/asm/unaligned.h
index 4297ce6..ed815db 100644
--- a/include/asm/unaligned.h
+++ b/include/asm/unaligned.h
@@ -1,3 +1,9 @@
+/* FIXME: this is no portable at all */
+
#define get_unaligned_le16(ptr) *((u16*)(ptr))
#define get_unaligned_le32(ptr) *((u32*)(ptr))
#define get_unaligned_le64(ptr) *((u64*)(ptr))
+
+#define put_unaligned_le16(val, dst) (*(u16 *)(dst) = (u16)(val))
+#define put_unaligned_le32(val, dst) (*(u32 *)(dst) = (u32)(val))
+#define put_unaligned_le64(val, dst) (*(u64 *)(dst) = (u64)(val))
diff --git a/include/wrapper.h b/include/wrapper.h
index 940022d..f7dd65d 100644
--- a/include/wrapper.h
+++ b/include/wrapper.h
@@ -242,4 +242,16 @@ void mylock_write_unlock(int *lock, const char *file, int line);
#define symbol_request(x) NULL
#define symbol_put(x)
+static inline long copy_from_user(void *to, const void __user *from, unsigned long n)
+{
+ memcpy(to, from, n);
+ return 0;
+}
+
+static inline long copy_to_user(void __user *to, const void *from, unsigned long n)
+{
+ memcpy(to, from, n);
+ return 0;
+}
+
#endif /* __HDA_WRAPPER_H */