All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] amd-xgbe: remove h from printk format specifier
@ 2020-12-23 19:43 trix
  2020-12-23 20:14 ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: trix @ 2020-12-23 19:43 UTC (permalink / raw)
  To: thomas.lendacky, davem, kuba; +Cc: netdev, linux-kernel, Tom Rix

From: Tom Rix <trix@redhat.com>

This change fixes the checkpatch warning described in this commit
commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi]")

Standard integer promotion is already done and %hx and %hhx is useless
so do not encourage the use of %hh[xudi] or %h[xudi].

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
index 61f39a0e04f9..3c18f26bf2a5 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
@@ -339,14 +339,14 @@ static int xgbe_set_link_ksettings(struct net_device *netdev,
 	speed = cmd->base.speed;
 
 	if (cmd->base.phy_address != pdata->phy.address) {
-		netdev_err(netdev, "invalid phy address %hhu\n",
+		netdev_err(netdev, "invalid phy address %u\n",
 			   cmd->base.phy_address);
 		return -EINVAL;
 	}
 
 	if ((cmd->base.autoneg != AUTONEG_ENABLE) &&
 	    (cmd->base.autoneg != AUTONEG_DISABLE)) {
-		netdev_err(netdev, "unsupported autoneg %hhu\n",
+		netdev_err(netdev, "unsupported autoneg %u\n",
 			   cmd->base.autoneg);
 		return -EINVAL;
 	}
@@ -358,7 +358,7 @@ static int xgbe_set_link_ksettings(struct net_device *netdev,
 		}
 
 		if (cmd->base.duplex != DUPLEX_FULL) {
-			netdev_err(netdev, "unsupported duplex %hhu\n",
+			netdev_err(netdev, "unsupported duplex %u\n",
 				   cmd->base.duplex);
 			return -EINVAL;
 		}
-- 
2.27.0


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

* Re: [PATCH] amd-xgbe: remove h from printk format specifier
  2020-12-23 19:43 [PATCH] amd-xgbe: remove h from printk format specifier trix
@ 2020-12-23 20:14 ` Joe Perches
  2020-12-23 20:33   ` Tom Rix
  0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2020-12-23 20:14 UTC (permalink / raw)
  To: trix, thomas.lendacky, davem, kuba; +Cc: netdev, linux-kernel

On Wed, 2020-12-23 at 11:43 -0800, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
> 
> This change fixes the checkpatch warning described in this commit
> commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi]")
> 
> Standard integer promotion is already done and %hx and %hhx is useless
> so do not encourage the use of %hh[xudi] or %h[xudi].

Why only xgbe-ethtool?

Perhaps your script only converts direct uses of functions
marked with __printf and not any uses of the same functions
via macros.

$ git grep -P '%[\w\d\.]*h\w' drivers/net/ethernet/amd/xgbe/
drivers/net/ethernet/amd/xgbe/xgbe-dcb.c:                         "TC%u: tx_bw=%hhu, rx_bw=%hhu, tsa=%hhu\n", i,
drivers/net/ethernet/amd/xgbe/xgbe-dcb.c:               netif_dbg(pdata, drv, netdev, "PRIO%u: TC=%hhu\n", i,
drivers/net/ethernet/amd/xgbe/xgbe-dcb.c:                                 "unsupported TSA algorithm (%hhu)\n",
drivers/net/ethernet/amd/xgbe/xgbe-dcb.c:                 "cap=%hhu, en=%#hhx, mbc=%hhu, delay=%hhu\n",
drivers/net/ethernet/amd/xgbe/xgbe-dev.c:       netif_dbg(pdata, drv, pdata->netdev, "VXLAN tunnel id set to %hx\n",
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c:           netdev_err(netdev, "invalid phy address %hhu\n",
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c:           netdev_err(netdev, "unsupported autoneg %hhu\n",
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c:                   netdev_err(netdev, "unsupported duplex %hhu\n",

> 
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>  drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
> index 61f39a0e04f9..3c18f26bf2a5 100644
> --- a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
> +++ b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
> @@ -339,14 +339,14 @@ static int xgbe_set_link_ksettings(struct net_device *netdev,
>  	speed = cmd->base.speed;
>  
> 
>  	if (cmd->base.phy_address != pdata->phy.address) {
> -		netdev_err(netdev, "invalid phy address %hhu\n",
> +		netdev_err(netdev, "invalid phy address %u\n",
>  			   cmd->base.phy_address);
>  		return -EINVAL;
>  	}
>  
> 
>  	if ((cmd->base.autoneg != AUTONEG_ENABLE) &&
>  	    (cmd->base.autoneg != AUTONEG_DISABLE)) {
> -		netdev_err(netdev, "unsupported autoneg %hhu\n",
> +		netdev_err(netdev, "unsupported autoneg %u\n",
>  			   cmd->base.autoneg);
>  		return -EINVAL;
>  	}
> @@ -358,7 +358,7 @@ static int xgbe_set_link_ksettings(struct net_device *netdev,
>  		}
>  
> 
>  		if (cmd->base.duplex != DUPLEX_FULL) {
> -			netdev_err(netdev, "unsupported duplex %hhu\n",
> +			netdev_err(netdev, "unsupported duplex %u\n",
>  				   cmd->base.duplex);
>  			return -EINVAL;
>  		}



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

* Re: [PATCH] amd-xgbe: remove h from printk format specifier
  2020-12-23 20:14 ` Joe Perches
@ 2020-12-23 20:33   ` Tom Rix
  2020-12-23 20:53     ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Rix @ 2020-12-23 20:33 UTC (permalink / raw)
  To: Joe Perches, thomas.lendacky, davem, kuba; +Cc: netdev, linux-kernel


On 12/23/20 12:14 PM, Joe Perches wrote:
> On Wed, 2020-12-23 at 11:43 -0800, trix@redhat.com wrote:
>> From: Tom Rix <trix@redhat.com>
>>
>> This change fixes the checkpatch warning described in this commit
>> commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi]")
>>
>> Standard integer promotion is already done and %hx and %hhx is useless
>> so do not encourage the use of %hh[xudi] or %h[xudi].
> Why only xgbe-ethtool?
>
> Perhaps your script only converts direct uses of functions
> marked with __printf and not any uses of the same functions
> via macros.

The fixer may have issues.

A works as designed by not desired is it only fixes what it compiles and if a

macro is #if-def away then it will not do the fix.  This is troublesome for the

the *_debug() routines.  So I am rejecting files with partial fixes.

It is also likely I missed adding __printf attributes.

There will be enough changes for this pass through to count as my feat of strength for today.

Tom

> $ git grep -P '%[\w\d\.]*h\w' drivers/net/ethernet/amd/xgbe/
> drivers/net/ethernet/amd/xgbe/xgbe-dcb.c:                         "TC%u: tx_bw=%hhu, rx_bw=%hhu, tsa=%hhu\n", i,
> drivers/net/ethernet/amd/xgbe/xgbe-dcb.c:               netif_dbg(pdata, drv, netdev, "PRIO%u: TC=%hhu\n", i,
> drivers/net/ethernet/amd/xgbe/xgbe-dcb.c:                                 "unsupported TSA algorithm (%hhu)\n",
> drivers/net/ethernet/amd/xgbe/xgbe-dcb.c:                 "cap=%hhu, en=%#hhx, mbc=%hhu, delay=%hhu\n",
> drivers/net/ethernet/amd/xgbe/xgbe-dev.c:       netif_dbg(pdata, drv, pdata->netdev, "VXLAN tunnel id set to %hx\n",
> drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c:           netdev_err(netdev, "invalid phy address %hhu\n",
> drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c:           netdev_err(netdev, "unsupported autoneg %hhu\n",
> drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c:                   netdev_err(netdev, "unsupported duplex %hhu\n",
>
>> Signed-off-by: Tom Rix <trix@redhat.com>
>> ---
>>  drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
>> index 61f39a0e04f9..3c18f26bf2a5 100644
>> --- a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
>> +++ b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
>> @@ -339,14 +339,14 @@ static int xgbe_set_link_ksettings(struct net_device *netdev,
>>  	speed = cmd->base.speed;
>>  
>>
>>  	if (cmd->base.phy_address != pdata->phy.address) {
>> -		netdev_err(netdev, "invalid phy address %hhu\n",
>> +		netdev_err(netdev, "invalid phy address %u\n",
>>  			   cmd->base.phy_address);
>>  		return -EINVAL;
>>  	}
>>  
>>
>>  	if ((cmd->base.autoneg != AUTONEG_ENABLE) &&
>>  	    (cmd->base.autoneg != AUTONEG_DISABLE)) {
>> -		netdev_err(netdev, "unsupported autoneg %hhu\n",
>> +		netdev_err(netdev, "unsupported autoneg %u\n",
>>  			   cmd->base.autoneg);
>>  		return -EINVAL;
>>  	}
>> @@ -358,7 +358,7 @@ static int xgbe_set_link_ksettings(struct net_device *netdev,
>>  		}
>>  
>>
>>  		if (cmd->base.duplex != DUPLEX_FULL) {
>> -			netdev_err(netdev, "unsupported duplex %hhu\n",
>> +			netdev_err(netdev, "unsupported duplex %u\n",
>>  				   cmd->base.duplex);
>>  			return -EINVAL;
>>  		}
>


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

* Re: [PATCH] amd-xgbe: remove h from printk format specifier
  2020-12-23 20:33   ` Tom Rix
@ 2020-12-23 20:53     ` Joe Perches
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2020-12-23 20:53 UTC (permalink / raw)
  To: Tom Rix, thomas.lendacky, davem, kuba; +Cc: netdev, linux-kernel

On Wed, 2020-12-23 at 12:33 -0800, Tom Rix wrote:
> On 12/23/20 12:14 PM, Joe Perches wrote:
> > On Wed, 2020-12-23 at 11:43 -0800, trix@redhat.com wrote:
> > > From: Tom Rix <trix@redhat.com>
> > > 
> > > This change fixes the checkpatch warning described in this commit
> > > commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi]")
> > > 
> > > Standard integer promotion is already done and %hx and %hhx is useless
> > > so do not encourage the use of %hh[xudi] or %h[xudi].
> > Why only xgbe-ethtool?
> > 
> > Perhaps your script only converts direct uses of functions
> > marked with __printf and not any uses of the same functions
> > via macros.
> 
> The fixer may have issues.

Perhaps until the fixer is fixed, it'd be more
complete coverage to use checkpatch like:

$ git ls-files <path> | \
  xargs ./scripts/checkpatch.pl -f --fix-inplace --types=unnecessary_modifier

e.g.:

$ git ls-files drivers/net/ethernet/amd/xgbe | \
  xargs ./scripts/checkpatch.pl -f --fix-inplace --types=unnecessary_modifier

$ git diff -U0 drivers/net/ethernet/amd/xgbe/
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dcb.c b/drivers/net/ethernet/amd/xgbe/xgbe-dcb.c
index 895d35639129..dcd2a181d43a 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-dcb.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-dcb.c
@@ -155 +155 @@ static int xgbe_dcb_ieee_setets(struct net_device *netdev,
-                         "TC%u: tx_bw=%hhu, rx_bw=%hhu, tsa=%hhu\n", i,
+                         "TC%u: tx_bw=%u, rx_bw=%u, tsa=%u\n", i,
@@ -158 +158 @@ static int xgbe_dcb_ieee_setets(struct net_device *netdev,
-               netif_dbg(pdata, drv, netdev, "PRIO%u: TC=%hhu\n", i,
+               netif_dbg(pdata, drv, netdev, "PRIO%u: TC=%u\n", i,
@@ -233 +233 @@ static int xgbe_dcb_ieee_setpfc(struct net_device *netdev,
-                 "cap=%hhu, en=%#hhx, mbc=%hhu, delay=%hhu\n",
+                 "cap=%u, en=%#x, mbc=%u, delay=%u\n",
@@ -267 +267 @@ static u8 xgbe_dcb_setdcbx(struct net_device *netdev, u8 dcbx)
-       netif_dbg(pdata, drv, netdev, "DCBX=%#hhx\n", dcbx);
+       netif_dbg(pdata, drv, netdev, "DCBX=%#x\n", dcbx);
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
index d5fd49dd25f3..ff0cd94bb91a 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
@@ -488 +488 @@ static void xgbe_set_vxlan_id(struct xgbe_prv_data *pdata)
-       netif_dbg(pdata, drv, pdata->netdev, "VXLAN tunnel id set to %hx\n",
+       netif_dbg(pdata, drv, pdata->netdev, "VXLAN tunnel id set to %x\n",
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
index 2709a2db5657..0ae16bc87833 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
@@ -2781 +2781 @@ void xgbe_print_pkt(struct net_device *netdev, struct sk_buff *skb, bool tx_rx)
-       netdev_dbg(netdev, "Protocol: %#06hx\n", ntohs(eth->h_proto));
+       netdev_dbg(netdev, "Protocol: %#06x\n", ntohs(eth->h_proto));
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
index 61f39a0e04f9..3c18f26bf2a5 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
@@ -342 +342 @@ static int xgbe_set_link_ksettings(struct net_device *netdev,
-               netdev_err(netdev, "invalid phy address %hhu\n",
+               netdev_err(netdev, "invalid phy address %u\n",
@@ -349 +349 @@ static int xgbe_set_link_ksettings(struct net_device *netdev,
-               netdev_err(netdev, "unsupported autoneg %hhu\n",
+               netdev_err(netdev, "unsupported autoneg %u\n",
@@ -361 +361 @@ static int xgbe_set_link_ksettings(struct net_device *netdev,
-                       netdev_err(netdev, "unsupported duplex %hhu\n",
+                       netdev_err(netdev, "unsupported duplex %u\n",



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

end of thread, other threads:[~2020-12-23 20:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-23 19:43 [PATCH] amd-xgbe: remove h from printk format specifier trix
2020-12-23 20:14 ` Joe Perches
2020-12-23 20:33   ` Tom Rix
2020-12-23 20:53     ` Joe Perches

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.