This source file includes following definitions.
- copy_to_user_fromio
- copy_from_user_toio
1
2
3
4
5
6
7
8 #include <linux/export.h>
9 #include <linux/io.h>
10 #include <linux/uaccess.h>
11 #include <sound/core.h>
12
13
14
15
16
17
18
19
20
21
22
23 int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count)
24 {
25 #if defined(__i386__) || defined(CONFIG_SPARC32)
26 return copy_to_user(dst, (const void __force*)src, count) ? -EFAULT : 0;
27 #else
28 char buf[256];
29 while (count) {
30 size_t c = count;
31 if (c > sizeof(buf))
32 c = sizeof(buf);
33 memcpy_fromio(buf, (void __iomem *)src, c);
34 if (copy_to_user(dst, buf, c))
35 return -EFAULT;
36 count -= c;
37 dst += c;
38 src += c;
39 }
40 return 0;
41 #endif
42 }
43 EXPORT_SYMBOL(copy_to_user_fromio);
44
45
46
47
48
49
50
51
52
53
54
55 int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count)
56 {
57 #if defined(__i386__) || defined(CONFIG_SPARC32)
58 return copy_from_user((void __force *)dst, src, count) ? -EFAULT : 0;
59 #else
60 char buf[256];
61 while (count) {
62 size_t c = count;
63 if (c > sizeof(buf))
64 c = sizeof(buf);
65 if (copy_from_user(buf, src, c))
66 return -EFAULT;
67 memcpy_toio(dst, buf, c);
68 count -= c;
69 dst += c;
70 src += c;
71 }
72 return 0;
73 #endif
74 }
75 EXPORT_SYMBOL(copy_from_user_toio);