Skip to contentSkip to conversation

IB/srp: introduce print_hex_dump()

PATCH Applied Bart Van Assche 3 participants 3 messages Jul 29, 2010 – Aug 4, 2010 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IB/srp: introduce print_hex_dump()

Reduces the number of source code lines in ib_srp.c by replacing an explicit loop by a call to print_hex_dump().

drivers/infiniband/ulp/srp/ib_srp.c +2 -13
index ed3f9eb..a072719 100644
@@ -879,21 +879,10 @@ static void srp_handle_recv(struct srp_target_port *target, struct ib_wc *wc)
 	opcode = *(u8 *) iu->buf;
 
 	if (0) {
-		int i;
-
 		shost_printk(KERN_ERR, target->scsi_host,
 			     PFX "recv completion, opcode 0x%02x\n", opcode);
-
-		for (i = 0; i < wc->byte_len; ++i) {
-			if (i % 8 == 0)
-				printk(KERN_ERR "  [%02x] ", i);
-			printk(" %02x", ((u8 *) iu->buf)[i]);
-			if ((i + 1) % 8 == 0)
-				printk("\n");
-		}
-
-		if (wc->byte_len % 8)
-			printk("\n");
+		print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 8, 1,
+			       iu->buf, wc->byte_len, true);
 	}
 
 	switch (opcode) {

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 2 lines · Bart Van Assche

Reduces the number of source code lines in ib_srp.c by replacing an explicit loop by a call to print_hex_dump().

I like the idea, minor nit in that we loose the SCSI prefix that tells use which host device printed it. Then again it's a debugging aid, so I don't know that it matters all that much.

Easily solvable with s/""/dev_name(target->scsi_host.shost_gendev)/

Hmm, that may be more ugly than it is worth.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to a message not in the archive

Thanks, applied
(you forgot a signed-off-by line in this submission)

Signature · 6 lines
Roland Dreier <[email protected]> || For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/index.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html