patch-2.2.18 linux/arch/alpha/lib/csum_partial_copy.c

Next file: linux/arch/alpha/math-emu/Makefile
Previous file: linux/arch/alpha/kernel/time.c
Back to the patch index
Back to the overall index

diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/arch/alpha/lib/csum_partial_copy.c linux/arch/alpha/lib/csum_partial_copy.c
@@ -173,11 +173,11 @@
 {
 	unsigned long carry = 0;
 	unsigned long word;
+	unsigned long second_dest;
 	int err = 0;
 
 	mskql(partial_dest, doff, partial_dest);
 	while (len >= 0) {
-		unsigned long second_dest;
 		err |= __get_user(word, src);
 		len -= 8;
 		insql(word, doff, second_dest);
@@ -189,35 +189,30 @@
 		carry = checksum < word;
 		dst++;
 	}
-	len += doff;
-	checksum += carry;
-	if (len >= 0) {
-		unsigned long second_dest;
+	len += 8;
+	if (len) {
+		checksum += carry;
 		err |= __get_user(word, src);
-		mskql(word, len-doff, word);
+		mskql(word, len, word);
+		len -= 8;
 		checksum += word;
 		insql(word, doff, second_dest);
-		stq_u(partial_dest | second_dest, dst);
+		len += doff;
 		carry = checksum < word;
-		if (len) {
-			ldq_u(second_dest, dst+1);
+		partial_dest |= second_dest;
+		if (len >= 0) {
+			stq_u(partial_dest, dst);
+			if (!len) goto out;
+			dst++;
 			insqh(word, doff, partial_dest);
-			mskqh(second_dest, len, second_dest);
-			stq_u(partial_dest | second_dest, dst+1);
 		}
-		checksum += carry;
-	} else if (len & 7) {
-		unsigned long second_dest;
-		err |= __get_user(word, src);
-		ldq_u(second_dest, dst);
-		mskql(word, len-doff, word);
-		checksum += word;
-		mskqh(second_dest, len, second_dest);
-		carry = checksum < word;
-		insql(word, doff, word);
-		stq_u(partial_dest | word | second_dest, dst);
-		checksum += carry;
+		doff = len;
 	}
+	ldq_u(second_dest, dst);
+	mskqh(second_dest, doff, second_dest);
+	stq_u(partial_dest | second_dest, dst);
+out:
+	checksum += carry;
 	if (err) *errp = err;
 	return checksum;
 }
@@ -283,7 +278,7 @@
 			stq_u(partial_dest | second_dest, dst+1);
 		}
 		checksum += carry;
-	} else if (len & 7) {
+	} else {
 		unsigned long second, word;
 		unsigned long second_dest;
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)