All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IB/srp: introduce print_hex_dump()
@ 2010-07-29 15:56 Bart Van Assche
       [not found] ` <201007291756.37672.bvanassche-HInyCGIudOg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Van Assche @ 2010-07-29 15:56 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Roland Dreier

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

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index ed3f9eb..a072719 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] IB/srp: introduce print_hex_dump()
       [not found] ` <201007291756.37672.bvanassche-HInyCGIudOg@public.gmane.org>
@ 2010-07-30  0:57   ` David Dillow
  2010-08-04 18:25   ` Roland Dreier
  1 sibling, 0 replies; 3+ messages in thread
From: David Dillow @ 2010-07-30  0:57 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Roland Dreier

On Thu, 2010-07-29 at 17:56 +0200, Bart Van Assche wrote:
> 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] IB/srp: introduce print_hex_dump()
       [not found] ` <201007291756.37672.bvanassche-HInyCGIudOg@public.gmane.org>
  2010-07-30  0:57   ` David Dillow
@ 2010-08-04 18:25   ` Roland Dreier
  1 sibling, 0 replies; 3+ messages in thread
From: Roland Dreier @ 2010-08-04 18:25 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Roland Dreier

Thanks, applied
(you forgot a signed-off-by line in this submission)
-- 
Roland Dreier <rolandd-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org> || 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-04 18:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-29 15:56 [PATCH] IB/srp: introduce print_hex_dump() Bart Van Assche
     [not found] ` <201007291756.37672.bvanassche-HInyCGIudOg@public.gmane.org>
2010-07-30  0:57   ` David Dillow
2010-08-04 18:25   ` Roland Dreier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.