linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitriy Cherkasov <dmitriy@oss-tech.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devel@driverdev.osuosl.org, Oleg Drokin <oleg.drokin@intel.com>,
	Andreas Dilger <andreas.dilger@intel.com>,
	James Simmons <jsimmons@infradead.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Lustre Development List <lustre-devel@lists.lustre.org>,
	Dmitriy Cherkasov <dmitriy@oss-tech.org>
Subject: [PATCH v3] staging: lustre: lnet: remove dead code and crc32_le() wrapper
Date: Fri, 30 Jun 2017 03:52:46 +0000	[thread overview]
Message-ID: <1498794766-12298-1-git-send-email-dmitriy@oss-tech.org> (raw)
In-Reply-To: <1498793366-10539-1-git-send-email-dmitriy@oss-tech.org>

After removing code which was premanently disabled with ifdefs, the
function ksocknal_csum() becomes just a wrapper for crc32_le(). Remove
this useless wrapper and instead call crc32_le() directly.

This also resolves the following checkpatch warning which was
triggered by the dead code:

WARNING: space prohibited before semicolon

Signed-off-by: Dmitriy Cherkasov <dmitriy@oss-tech.org>
---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h     | 11 -----------
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c | 14 +++++++-------
 2 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
index 5540de6..9eb169d 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
@@ -519,17 +519,6 @@ struct ksock_proto {
 #define CPU_MASK_NONE   0UL
 #endif
 
-static inline __u32 ksocknal_csum(__u32 crc, unsigned char const *p, size_t len)
-{
-#if 1
-	return crc32_le(crc, p, len);
-#else
-	while (len-- > 0)
-		crc = ((crc + 0x100) & ~0xff) | ((crc + *p++) & 0xff) ;
-	return crc;
-#endif
-}
-
 static inline int
 ksocknal_route_mask(void)
 {
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
index 8a036f4..5e7e4e1 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
@@ -201,7 +201,7 @@
 			if (fragnob > sum)
 				fragnob = sum;
 
-			conn->ksnc_rx_csum = ksocknal_csum(conn->ksnc_rx_csum,
+			conn->ksnc_rx_csum = crc32_le(conn->ksnc_rx_csum,
 							   iov[i].iov_base,
 							   fragnob);
 		}
@@ -243,7 +243,7 @@
 			if (fragnob > sum)
 				fragnob = sum;
 
-			conn->ksnc_rx_csum = ksocknal_csum(conn->ksnc_rx_csum,
+			conn->ksnc_rx_csum = crc32_le(conn->ksnc_rx_csum,
 							   base, fragnob);
 
 			kunmap(kiov[i].bv_page);
@@ -265,22 +265,22 @@
 
 	tx->tx_msg.ksm_csum = 0;
 
-	csum = ksocknal_csum(~0, tx->tx_iov[0].iov_base,
-			     tx->tx_iov[0].iov_len);
+	csum = crc32_le(~0, tx->tx_iov[0].iov_base,
+			tx->tx_iov[0].iov_len);
 
 	if (tx->tx_kiov) {
 		for (i = 0; i < tx->tx_nkiov; i++) {
 			base = kmap(tx->tx_kiov[i].bv_page) +
 			       tx->tx_kiov[i].bv_offset;
 
-			csum = ksocknal_csum(csum, base, tx->tx_kiov[i].bv_len);
+			csum = crc32_le(csum, base, tx->tx_kiov[i].bv_len);
 
 			kunmap(tx->tx_kiov[i].bv_page);
 		}
 	} else {
 		for (i = 1; i < tx->tx_niov; i++)
-			csum = ksocknal_csum(csum, tx->tx_iov[i].iov_base,
-					     tx->tx_iov[i].iov_len);
+			csum = crc32_le(csum, tx->tx_iov[i].iov_base,
+					tx->tx_iov[i].iov_len);
 	}
 
 	if (*ksocknal_tunables.ksnd_inject_csum_error) {
-- 
1.9.1

  parent reply	other threads:[~2017-06-30  4:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-29  4:42 [PATCH] staging: lustre: lnet: remove dead code Dmitriy Cherkasov
2017-06-29 14:32 ` Greg Kroah-Hartman
2017-06-30  3:29 ` [PATCH v2] staging: lustre: lnet: remove dead code and crc32_le() wrapper Dmitriy Cherkasov
2017-06-30  3:37   ` Joe Perches
2017-06-30  3:54     ` Dmitriy Cherkasov
2017-06-30  3:52   ` Dmitriy Cherkasov [this message]
2017-06-30  5:50     ` [PATCH v4] " Dmitriy Cherkasov
2017-07-06 19:14       ` Dmitriy Cherkasov
2017-07-07 23:03       ` [PATCH v5] staging: lustre: lnet: remove dead code and useless wrapper Dmitriy Cherkasov
2017-07-13  0:27         ` Dilger, Andreas
2017-07-13  0:27         ` Dilger, Andreas
2017-06-30  6:01     ` [PATCH v3] staging: lustre: lnet: remove dead code and crc32_le() wrapper Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1498794766-12298-1-git-send-email-dmitriy@oss-tech.org \
    --to=dmitriy@oss-tech.org \
    --cc=andreas.dilger@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jsimmons@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-devel@lists.lustre.org \
    --cc=oleg.drokin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).