Skip to content

Commit

Permalink
net/lapb: tuse %*ph to dump buffers
Browse files Browse the repository at this point in the history
Use %*ph specifier to dump small buffers in hex format instead doing this
byte-by-byte.

Signed-off-by: Andy Shevchenko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
andy-shev authored and davem330 committed May 30, 2016
1 parent 6756325 commit 0d08df6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
5 changes: 2 additions & 3 deletions net/lapb/lapb_in.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,9 @@ static void lapb_state3_machine(struct lapb_cb *lapb, struct sk_buff *skb,
break;

case LAPB_FRMR:
lapb_dbg(1, "(%p) S3 RX FRMR(%d) %02X %02X %02X %02X %02X\n",
lapb_dbg(1, "(%p) S3 RX FRMR(%d) %5ph\n",
lapb->dev, frame->pf,
skb->data[0], skb->data[1], skb->data[2],
skb->data[3], skb->data[4]);
skb->data);
lapb_establish_data_link(lapb);
lapb_dbg(0, "(%p) S3 -> S1\n", lapb->dev);
lapb_requeue_frames(lapb);
Expand Down
4 changes: 1 addition & 3 deletions net/lapb/lapb_out.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,7 @@ void lapb_transmit_buffer(struct lapb_cb *lapb, struct sk_buff *skb, int type)
}
}

lapb_dbg(2, "(%p) S%d TX %02X %02X %02X\n",
lapb->dev, lapb->state,
skb->data[0], skb->data[1], skb->data[2]);
lapb_dbg(2, "(%p) S%d TX %3ph\n", lapb->dev, lapb->state, skb->data);

if (!lapb_data_transmit(lapb, skb))
kfree_skb(skb);
Expand Down
14 changes: 5 additions & 9 deletions net/lapb/lapb_subr.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ int lapb_decode(struct lapb_cb *lapb, struct sk_buff *skb,
{
frame->type = LAPB_ILLEGAL;

lapb_dbg(2, "(%p) S%d RX %02X %02X %02X\n",
lapb->dev, lapb->state,
skb->data[0], skb->data[1], skb->data[2]);
lapb_dbg(2, "(%p) S%d RX %3ph\n", lapb->dev, lapb->state, skb->data);

/* We always need to look at 2 bytes, sometimes we need
* to look at 3 and those cases are handled below.
Expand Down Expand Up @@ -284,10 +282,9 @@ void lapb_transmit_frmr(struct lapb_cb *lapb)
dptr++;
*dptr++ = lapb->frmr_type;

lapb_dbg(1, "(%p) S%d TX FRMR %02X %02X %02X %02X %02X\n",
lapb_dbg(1, "(%p) S%d TX FRMR %5ph\n",
lapb->dev, lapb->state,
skb->data[1], skb->data[2], skb->data[3],
skb->data[4], skb->data[5]);
&skb->data[1]);
} else {
dptr = skb_put(skb, 4);
*dptr++ = LAPB_FRMR;
Expand All @@ -299,9 +296,8 @@ void lapb_transmit_frmr(struct lapb_cb *lapb)
dptr++;
*dptr++ = lapb->frmr_type;

lapb_dbg(1, "(%p) S%d TX FRMR %02X %02X %02X\n",
lapb->dev, lapb->state, skb->data[1],
skb->data[2], skb->data[3]);
lapb_dbg(1, "(%p) S%d TX FRMR %3ph\n",
lapb->dev, lapb->state, &skb->data[1]);
}

lapb_transmit_buffer(lapb, skb, LAPB_RESPONSE);
Expand Down

0 comments on commit 0d08df6

Please sign in to comment.