net: ks8851: use %*ph to print small buffer
Subsystems (2)
PATCH 1/1 net: ks8851: use %*ph to print small buffer
Use %*ph format to print small buffer as hex string.
Signed-off-by Andy Shevchenko <[email protected]>
--- drivers/net/ethernet/micrel/ks8851_common.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-)
drivers/net/ethernet/micrel/ks8851_common.c +1 -18
@@ -215,22 +215,6 @@ static void ks8851_init_mac(struct ks8851_net *ks, struct device_node *np)ks8851_write_mac_addr (dev); } -/** -* ks8851_dbg_dumpkkt - dump initial packet contents to debug -* @ks: The device state -* @rxpkt: The data for the received packet -* -* Dump the initial data from the packet to dev_dbg(). -*/ -static void ks8851_dbg_dumpkkt (struct ks8851_net *ks,u8 *rxpkt) -{ -netdev_dbg (ks->netdev, -"pkt %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x\n" , - rxpkt[4 ], rxpkt[5 ], rxpkt[6 ], rxpkt[7 ], - rxpkt[8 ], rxpkt[9 ], rxpkt[10 ], rxpkt[11 ], - rxpkt[12 ], rxpkt[13 ], rxpkt[14 ], rxpkt[15 ]); -} -/** * ks8851_rx_pkts - receive packets from the host * @ks: The device information.
@@ -296,8 +280,7 @@ static void ks8851_rx_pkts(struct ks8851_net *ks, struct sk_buff_head *rxq) ks->rdfifo (ks, rxpkt, rxalign +8 ); -if (netif_msg_pktdata (ks)) -ks8851_dbg_dumpkkt (ks, rxpkt); +netif_dbg (ks, pktdata, ks->netdev,"pkt %12ph\n" , &rxpkt[4 ]); skb->protocol =eth_type_trans (skb, ks->netdev);__skb_queue_tail (rxq, skb);
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Simon Horman
reviewerQuoted 1 line · Andy Shevchenko
Use %*ph format to print small buffer as hex string.
Hi Andy,
Perhaps it would be worth mentioning that this patch changes the output format such that there is a space between each byte rather than each 32-bit word.
Or at least, that is what a local hack on my side indicated things would look like :)
Quoted 34 lines
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/net/ethernet/micrel/ks8851_common.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-)drivers/net/ethernet/micrel/ks8851_common.c +0
-16@@ -215,22 +215,6 @@ static void ks8851_init_mac(struct ks8851_net *ks, struct device_node *np)ks8851_write_mac_addr (dev); } -/** -* ks8851_dbg_dumpkkt - dump initial packet contents to debug -* @ks: The device state -* @rxpkt: The data for the received packet -* -* Dump the initial data from the packet to dev_dbg(). -*/ -static void ks8851_dbg_dumpkkt (struct ks8851_net *ks,u8 *rxpkt) -{ -netdev_dbg (ks->netdev, -"pkt %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x\n" , - rxpkt[4 ], rxpkt[5 ], rxpkt[6 ], rxpkt[7 ], - rxpkt[8 ], rxpkt[9 ], rxpkt[10 ], rxpkt[11 ], - rxpkt[12 ], rxpkt[13 ], rxpkt[14 ], rxpkt[15 ]); -} -/** * ks8851_rx_pkts - receive packets from the host * @ks: The device information.
drivers/net/ethernet/micrel/ks8851_common.c static void ks8851_rx_pkts(struct ks8851_net *ks, struct sk_buff_head *rxq) · line 283
Quoted 6 lines
drivers/net/ethernet/micrel/ks8851_common.c +1
-2@@ -296,8 +280,7 @@ static void ks8851_rx_pkts(struct ks8851_net *ks, struct sk_buff_head *rxq) ks->rdfifo (ks, rxpkt, rxalign +8 ); -if (netif_msg_pktdata (ks)) -ks8851_dbg_dumpkkt (ks, rxpkt); +netif_dbg (ks, pktdata, ks->netdev,"pkt %12ph\n" , &rxpkt[4 ]);
nit: I would have line wrapped this so it is <= 80 columns wide.
Quoted 7 lines
drivers/net/ethernet/micrel/ks8851_common.c +0
-0skb->protocol =eth_type_trans (skb, ks->netdev);__skb_queue_tail (rxq, skb);Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac