[NET]: FRV checksum annotations.

* sanitize prototypes and annotate
* collapse csum_partial_copy

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Al Viro
2006-11-14 21:15:40 -08:00
committed by David S. Miller
parent 3532010bcf
commit 8042c44b8a
2 changed files with 31 additions and 34 deletions
+12 -12
View File
@@ -104,15 +104,15 @@ out:
*
* it's best to have buff aligned on a 32-bit boundary
*/
unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
__wsum csum_partial(const void *buff, int len, __wsum sum)
{
unsigned int result = do_csum(buff, len);
/* add in old sum, and carry.. */
result += sum;
if (sum > result)
result += (__force u32)sum;
if ((__force u32)sum > result)
result += 1;
return result;
return (__force __wsum)result;
}
EXPORT_SYMBOL(csum_partial);
@@ -121,9 +121,9 @@ EXPORT_SYMBOL(csum_partial);
* this routine is used for miscellaneous IP-like checksums, mainly
* in icmp.c
*/
unsigned short ip_compute_csum(const unsigned char * buff, int len)
__sum16 ip_compute_csum(const void *buff, int len)
{
return ~do_csum(buff, len);
return (__force __sum16)~do_csum(buff, len);
}
EXPORT_SYMBOL(ip_compute_csum);
@@ -131,9 +131,9 @@ EXPORT_SYMBOL(ip_compute_csum);
/*
* copy from fs while checksumming, otherwise like csum_partial
*/
unsigned int
csum_partial_copy_from_user(const char __user *src, char *dst,
int len, int sum, int *csum_err)
__wsum
csum_partial_copy_from_user(const void __user *src, void *dst,
int len, __wsum sum, int *csum_err)
{
int rem;
@@ -156,11 +156,11 @@ EXPORT_SYMBOL(csum_partial_copy_from_user);
/*
* copy from ds while checksumming, otherwise like csum_partial
*/
unsigned int
csum_partial_copy(const char *src, char *dst, int len, int sum)
__wsum
csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
{
memcpy(dst, src, len);
return csum_partial(dst, len, sum);
}
EXPORT_SYMBOL(csum_partial_copy);
EXPORT_SYMBOL(csum_partial_copy_nocheck);