diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-11-15 00:17:56 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:23:08 -0500 |
commit | 59ed05a7e891d694a43df96ac613f7e8e164eb95 (patch) | |
tree | 90132f4879dcbec3cdd8b04c10fd16b2bce40422 /arch/m68knommu/lib | |
parent | 2061acaaae0e165f0104ec9d327a02addbcabd62 (diff) |
[NET]: M68Knommu checksum annotations and cleanups.
* sanitize prototypes, annotated
* collapsed csum_partial_copy()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/m68knommu/lib')
-rw-r--r-- | arch/m68knommu/lib/checksum.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/arch/m68knommu/lib/checksum.c b/arch/m68knommu/lib/checksum.c index 7bec6fdee34b..269d83bfbbe1 100644 --- a/arch/m68knommu/lib/checksum.c +++ b/arch/m68knommu/lib/checksum.c | |||
@@ -96,9 +96,9 @@ out: | |||
96 | * This is a version of ip_compute_csum() optimized for IP headers, | 96 | * This is a version of ip_compute_csum() optimized for IP headers, |
97 | * which always checksum on 4 octet boundaries. | 97 | * which always checksum on 4 octet boundaries. |
98 | */ | 98 | */ |
99 | unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl) | 99 | __sum16 ip_fast_csum(const void *iph, unsigned int ihl) |
100 | { | 100 | { |
101 | return ~do_csum(iph,ihl*4); | 101 | return (__force __sum16)~do_csum(iph,ihl*4); |
102 | } | 102 | } |
103 | 103 | ||
104 | /* | 104 | /* |
@@ -113,15 +113,15 @@ unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl) | |||
113 | * | 113 | * |
114 | * it's best to have buff aligned on a 32-bit boundary | 114 | * it's best to have buff aligned on a 32-bit boundary |
115 | */ | 115 | */ |
116 | unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum) | 116 | __wsum csum_partial(const void *buff, int len, __wsum sum) |
117 | { | 117 | { |
118 | unsigned int result = do_csum(buff, len); | 118 | unsigned int result = do_csum(buff, len); |
119 | 119 | ||
120 | /* add in old sum, and carry.. */ | 120 | /* add in old sum, and carry.. */ |
121 | result += sum; | 121 | result += (__force u32)sum; |
122 | if (sum > result) | 122 | if ((__force u32)sum > result) |
123 | result += 1; | 123 | result += 1; |
124 | return result; | 124 | return (__force __wsum)result; |
125 | } | 125 | } |
126 | 126 | ||
127 | EXPORT_SYMBOL(csum_partial); | 127 | EXPORT_SYMBOL(csum_partial); |
@@ -130,21 +130,21 @@ EXPORT_SYMBOL(csum_partial); | |||
130 | * this routine is used for miscellaneous IP-like checksums, mainly | 130 | * this routine is used for miscellaneous IP-like checksums, mainly |
131 | * in icmp.c | 131 | * in icmp.c |
132 | */ | 132 | */ |
133 | unsigned short ip_compute_csum(const unsigned char * buff, int len) | 133 | __sum16 ip_compute_csum(const void *buff, int len) |
134 | { | 134 | { |
135 | return ~do_csum(buff,len); | 135 | return (__force __sum16)~do_csum(buff,len); |
136 | } | 136 | } |
137 | 137 | ||
138 | /* | 138 | /* |
139 | * copy from fs while checksumming, otherwise like csum_partial | 139 | * copy from fs while checksumming, otherwise like csum_partial |
140 | */ | 140 | */ |
141 | 141 | ||
142 | unsigned int | 142 | __wsum |
143 | csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst, | 143 | csum_partial_copy_from_user(const void __user *src, void *dst, |
144 | int len, int sum, int *csum_err) | 144 | int len, __wsum sum, int *csum_err) |
145 | { | 145 | { |
146 | if (csum_err) *csum_err = 0; | 146 | if (csum_err) *csum_err = 0; |
147 | memcpy(dst, src, len); | 147 | memcpy(dst, (__force const void *)src, len); |
148 | return csum_partial(dst, len, sum); | 148 | return csum_partial(dst, len, sum); |
149 | } | 149 | } |
150 | 150 | ||
@@ -152,8 +152,8 @@ csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst, | |||
152 | * copy from ds while checksumming, otherwise like csum_partial | 152 | * copy from ds while checksumming, otherwise like csum_partial |
153 | */ | 153 | */ |
154 | 154 | ||
155 | unsigned int | 155 | __wsum |
156 | csum_partial_copy(const unsigned char *src, unsigned char *dst, int len, int sum) | 156 | csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum) |
157 | { | 157 | { |
158 | memcpy(dst, src, len); | 158 | memcpy(dst, src, len); |
159 | return csum_partial(dst, len, sum); | 159 | return csum_partial(dst, len, sum); |