diff mbox series

[net-next,v1,1/1] net: ks8851: use %*ph to print small buffer

Message ID 20240911193630.2884828-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v1,1/1] net: ks8851: use %*ph to print small buffer | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 3 maintainers not CCed: ronald.wahl@raritan.com marex@denx.de horms@kernel.org
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 16 this patch: 16
netdev/checkpatch warning WARNING: line length of 93 exceeds 80 columns
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 9 this patch: 9
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-09-12--00-00 (tests: 764)

Commit Message

Andy Shevchenko Sept. 11, 2024, 7:36 p.m. UTC
Use %*ph format to print small buffer as hex string.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/net/ethernet/micrel/ks8851_common.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

Comments

Simon Horman Sept. 12, 2024, 12:06 p.m. UTC | #1
On Wed, Sep 11, 2024 at 10:36:30PM +0300, Andy Shevchenko wrote:
> 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 :)

> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/net/ethernet/micrel/ks8851_common.c | 19 +------------------
>  1 file changed, 1 insertion(+), 18 deletions(-)
> 
> diff --git a/drivers/net/ethernet/micrel/ks8851_common.c b/drivers/net/ethernet/micrel/ks8851_common.c
> index 7fa1820db9cc..a07ffc53da64 100644
> --- a/drivers/net/ethernet/micrel/ks8851_common.c
> +++ b/drivers/net/ethernet/micrel/ks8851_common.c
> @@ -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]);

nit: I would have line wrapped this so it is <= 80 columns wide.

>  
>  				skb->protocol = eth_type_trans(skb, ks->netdev);
>  				__skb_queue_tail(rxq, skb);
> -- 
> 2.43.0.rc1.1336.g36b5255a03ac
> 
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/micrel/ks8851_common.c b/drivers/net/ethernet/micrel/ks8851_common.c
index 7fa1820db9cc..a07ffc53da64 100644
--- a/drivers/net/ethernet/micrel/ks8851_common.c
+++ b/drivers/net/ethernet/micrel/ks8851_common.c
@@ -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);