diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-11-15 00:19:44 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:23:13 -0500 |
commit | 9d3d41955845939cb41b87affb039db0bae03b65 (patch) | |
tree | 468f7564a834edb54a30e49dd678e583568c6933 /arch/v850/lib | |
parent | abf419b809bed2333267e4b23dd2b3b4f10da88c (diff) |
[NET]: V850 checksum annotations and cleanups.
* sanitize prototypes, annotate
* collapse csum_partial_copy
* usual ntohs->shift
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/v850/lib')
-rw-r--r-- | arch/v850/lib/checksum.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/arch/v850/lib/checksum.c b/arch/v850/lib/checksum.c index fa5872633075..042158dfe17a 100644 --- a/arch/v850/lib/checksum.c +++ b/arch/v850/lib/checksum.c | |||
@@ -88,32 +88,32 @@ out: | |||
88 | * This is a version of ip_compute_csum() optimized for IP headers, | 88 | * This is a version of ip_compute_csum() optimized for IP headers, |
89 | * which always checksum on 4 octet boundaries. | 89 | * which always checksum on 4 octet boundaries. |
90 | */ | 90 | */ |
91 | unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl) | 91 | __sum16 ip_fast_csum(const void *iph, unsigned int ihl) |
92 | { | 92 | { |
93 | return ~do_csum(iph,ihl*4); | 93 | return (__force __sum16)~do_csum(iph,ihl*4); |
94 | } | 94 | } |
95 | 95 | ||
96 | /* | 96 | /* |
97 | * this routine is used for miscellaneous IP-like checksums, mainly | 97 | * this routine is used for miscellaneous IP-like checksums, mainly |
98 | * in icmp.c | 98 | * in icmp.c |
99 | */ | 99 | */ |
100 | unsigned short ip_compute_csum(const unsigned char * buff, int len) | 100 | __sum16 ip_compute_csum(const void *buff, int len) |
101 | { | 101 | { |
102 | return ~do_csum(buff,len); | 102 | return (__force __sum16)~do_csum(buff,len); |
103 | } | 103 | } |
104 | 104 | ||
105 | /* | 105 | /* |
106 | * computes a partial checksum, e.g. for TCP/UDP fragments | 106 | * computes a partial checksum, e.g. for TCP/UDP fragments |
107 | */ | 107 | */ |
108 | unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum) | 108 | __wsum csum_partial(const void *buff, int len, __wsum sum) |
109 | { | 109 | { |
110 | unsigned int result = do_csum(buff, len); | 110 | unsigned int result = do_csum(buff, len); |
111 | 111 | ||
112 | /* add in old sum, and carry.. */ | 112 | /* add in old sum, and carry.. */ |
113 | result += sum; | 113 | result += (__force u32)sum; |
114 | if(sum > result) | 114 | if ((__force u32)sum > result) |
115 | result += 1; | 115 | result += 1; |
116 | return result; | 116 | return (__force __wsum)result; |
117 | } | 117 | } |
118 | 118 | ||
119 | EXPORT_SYMBOL(csum_partial); | 119 | EXPORT_SYMBOL(csum_partial); |
@@ -121,8 +121,8 @@ EXPORT_SYMBOL(csum_partial); | |||
121 | /* | 121 | /* |
122 | * copy while checksumming, otherwise like csum_partial | 122 | * copy while checksumming, otherwise like csum_partial |
123 | */ | 123 | */ |
124 | unsigned int csum_partial_copy(const unsigned char *src, unsigned char *dst, | 124 | __wsum csum_partial_copy_nocheck(const void *src, void *dst, |
125 | int len, unsigned int sum) | 125 | int len, __wsum sum) |
126 | { | 126 | { |
127 | /* | 127 | /* |
128 | * It's 2:30 am and I don't feel like doing it real ... | 128 | * It's 2:30 am and I don't feel like doing it real ... |
@@ -138,9 +138,9 @@ unsigned int csum_partial_copy(const unsigned char *src, unsigned char *dst, | |||
138 | * Copy from userspace and compute checksum. If we catch an exception | 138 | * Copy from userspace and compute checksum. If we catch an exception |
139 | * then zero the rest of the buffer. | 139 | * then zero the rest of the buffer. |
140 | */ | 140 | */ |
141 | unsigned int csum_partial_copy_from_user (const unsigned char *src, | 141 | __wsum csum_partial_copy_from_user (const void *src, |
142 | unsigned char *dst, | 142 | void *dst, |
143 | int len, unsigned int sum, | 143 | int len, __wsum sum, |
144 | int *err_ptr) | 144 | int *err_ptr) |
145 | { | 145 | { |
146 | int missing; | 146 | int missing; |