All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: ethernet: et131x: Remove unused variable 'pm_csr'
@ 2020-07-17 10:33 Zhang Changzhong
  2020-07-17 12:57 ` Mark Einon
  2020-07-18  1:43 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Zhang Changzhong @ 2020-07-17 10:33 UTC (permalink / raw)
  To: mark.einon, davem, kuba; +Cc: netdev, linux-kernel

Gcc report warning as follows:

drivers/net/ethernet/agere/et131x.c:953:6: warning:
 variable 'pm_csr' set but not used [-Wunused-but-set-variable]
  953 |  u32 pm_csr;
      |      ^~~~~~
drivers/net/ethernet/agere/et131x.c:1002:6:warning:
 variable 'pm_csr' set but not used [-Wunused-but-set-variable]
 1002 |  u32 pm_csr;
      |      ^~~~~~
drivers/net/ethernet/agere/et131x.c:3446:8: warning:
 variable 'pm_csr' set but not used [-Wunused-but-set-variable]
 3446 |    u32 pm_csr;
      |        ^~~~~~

After commit 38df6492eb51 ("et131x: Add PCIe gigabit ethernet driver
et131x to drivers/net"), 'pm_csr' is never used in these functions,
so removing it to avoid build warning.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
---
 drivers/net/ethernet/agere/et131x.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/agere/et131x.c b/drivers/net/ethernet/agere/et131x.c
index 865892c..8806e1e 100644
--- a/drivers/net/ethernet/agere/et131x.c
+++ b/drivers/net/ethernet/agere/et131x.c
@@ -950,7 +950,6 @@ static void et1310_setup_device_for_multicast(struct et131x_adapter *adapter)
 	u32 hash2 = 0;
 	u32 hash3 = 0;
 	u32 hash4 = 0;
-	u32 pm_csr;
 
 	/* If ET131X_PACKET_TYPE_MULTICAST is specified, then we provision
 	 * the multi-cast LIST.  If it is NOT specified, (and "ALL" is not
@@ -984,7 +983,7 @@ static void et1310_setup_device_for_multicast(struct et131x_adapter *adapter)
 	}
 
 	/* Write out the new hash to the device */
-	pm_csr = readl(&adapter->regs->global.pm_csr);
+	readl(&adapter->regs->global.pm_csr);
 	if (!et1310_in_phy_coma(adapter)) {
 		writel(hash1, &rxmac->multi_hash1);
 		writel(hash2, &rxmac->multi_hash2);
@@ -999,7 +998,6 @@ static void et1310_setup_device_for_unicast(struct et131x_adapter *adapter)
 	u32 uni_pf1;
 	u32 uni_pf2;
 	u32 uni_pf3;
-	u32 pm_csr;
 
 	/* Set up unicast packet filter reg 3 to be the first two octets of
 	 * the MAC address for both address
@@ -1025,7 +1023,7 @@ static void et1310_setup_device_for_unicast(struct et131x_adapter *adapter)
 		  (adapter->addr[4] << ET_RX_UNI_PF_ADDR1_5_SHIFT) |
 		   adapter->addr[5];
 
-	pm_csr = readl(&adapter->regs->global.pm_csr);
+	readl(&adapter->regs->global.pm_csr);
 	if (!et1310_in_phy_coma(adapter)) {
 		writel(uni_pf1, &rxmac->uni_pf_addr1);
 		writel(uni_pf2, &rxmac->uni_pf_addr2);
@@ -3443,12 +3441,10 @@ static irqreturn_t et131x_isr(int irq, void *dev_id)
 		 * send a pause packet, otherwise just exit
 		 */
 		if (adapter->flow == FLOW_TXONLY || adapter->flow == FLOW_BOTH) {
-			u32 pm_csr;
-
 			/* Tell the device to send a pause packet via the back
 			 * pressure register (bp req and bp xon/xoff)
 			 */
-			pm_csr = readl(&iomem->global.pm_csr);
+			readl(&iomem->global.pm_csr);
 			if (!et1310_in_phy_coma(adapter))
 				writel(3, &iomem->txmac.bp_ctrl);
 		}
-- 
1.8.3.1


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

* Re: [PATCH net-next] net: ethernet: et131x: Remove unused variable 'pm_csr'
  2020-07-17 10:33 [PATCH net-next] net: ethernet: et131x: Remove unused variable 'pm_csr' Zhang Changzhong
@ 2020-07-17 12:57 ` Mark Einon
  2020-07-18  1:43 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Einon @ 2020-07-17 12:57 UTC (permalink / raw)
  To: Zhang Changzhong, davem, kuba; +Cc: netdev, linux-kernel

Hi Zhang,

On Fri, 2020-07-17 at 18:33 +0800, Zhang Changzhong wrote:
> Gcc report warning as follows:
> 
> drivers/net/ethernet/agere/et131x.c:953:6: warning:
>  variable 'pm_csr' set but not used [-Wunused-but-set-variable]
>   953 |  u32 pm_csr;
>       |      ^~~~~~
> drivers/net/ethernet/agere/et131x.c:1002:6:warning:
>  variable 'pm_csr' set but not used [-Wunused-but-set-variable]
>  1002 |  u32 pm_csr;
>       |      ^~~~~~
> drivers/net/ethernet/agere/et131x.c:3446:8: warning:
>  variable 'pm_csr' set but not used [-Wunused-but-set-variable]
>  3446 |    u32 pm_csr;
>       |        ^~~~~~
> 
> After commit 38df6492eb51 ("et131x: Add PCIe gigabit ethernet driver
> et131x to drivers/net"), 'pm_csr' is never used in these functions,
> so removing it to avoid build warning.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
> ---
>  drivers/net/ethernet/agere/et131x.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 

This makes sense, thanks.

The readl() line modified here is also redundant as it gets called from
the subsequent et1310_in_phy_coma() call. A patch to fix this is on it's
way.

Acked-by: Mark Einon <mark.einon@gmail.com>

Cheers,

Mark

> diff --git a/drivers/net/ethernet/agere/et131x.c
> b/drivers/net/ethernet/agere/et131x.c
> index 865892c..8806e1e 100644
> --- a/drivers/net/ethernet/agere/et131x.c
> +++ b/drivers/net/ethernet/agere/et131x.c
> @@ -950,7 +950,6 @@ static void
> et1310_setup_device_for_multicast(struct et131x_adapter *adapter)
>  	u32 hash2 = 0;
>  	u32 hash3 = 0;
>  	u32 hash4 = 0;
> -	u32 pm_csr;
>  
>  	/* If ET131X_PACKET_TYPE_MULTICAST is specified, then we
> provision
>  	 * the multi-cast LIST.  If it is NOT specified, (and "ALL" is
> not
> @@ -984,7 +983,7 @@ static void
> et1310_setup_device_for_multicast(struct et131x_adapter *adapter)
>  	}
>  
>  	/* Write out the new hash to the device */
> -	pm_csr = readl(&adapter->regs->global.pm_csr);
> +	readl(&adapter->regs->global.pm_csr);
>  	if (!et1310_in_phy_coma(adapter)) {
>  		writel(hash1, &rxmac->multi_hash1);
>  		writel(hash2, &rxmac->multi_hash2);
> @@ -999,7 +998,6 @@ static void et1310_setup_device_for_unicast(struct
> et131x_adapter *adapter)
>  	u32 uni_pf1;
>  	u32 uni_pf2;
>  	u32 uni_pf3;
> -	u32 pm_csr;
>  
>  	/* Set up unicast packet filter reg 3 to be the first two octets
> of
>  	 * the MAC address for both address
> @@ -1025,7 +1023,7 @@ static void
> et1310_setup_device_for_unicast(struct et131x_adapter *adapter)
>  		  (adapter->addr[4] << ET_RX_UNI_PF_ADDR1_5_SHIFT) |
>  		   adapter->addr[5];
>  
> -	pm_csr = readl(&adapter->regs->global.pm_csr);
> +	readl(&adapter->regs->global.pm_csr);
>  	if (!et1310_in_phy_coma(adapter)) {
>  		writel(uni_pf1, &rxmac->uni_pf_addr1);
>  		writel(uni_pf2, &rxmac->uni_pf_addr2);
> @@ -3443,12 +3441,10 @@ static irqreturn_t et131x_isr(int irq, void
> *dev_id)
>  		 * send a pause packet, otherwise just exit
>  		 */
>  		if (adapter->flow == FLOW_TXONLY || adapter->flow ==
> FLOW_BOTH) {
> -			u32 pm_csr;
> -
>  			/* Tell the device to send a pause packet via
> the back
>  			 * pressure register (bp req and bp xon/xoff)
>  			 */
> -			pm_csr = readl(&iomem->global.pm_csr);
> +			readl(&iomem->global.pm_csr);
>  			if (!et1310_in_phy_coma(adapter))
>  				writel(3, &iomem->txmac.bp_ctrl);
>  		}



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

* Re: [PATCH net-next] net: ethernet: et131x: Remove unused variable 'pm_csr'
  2020-07-17 10:33 [PATCH net-next] net: ethernet: et131x: Remove unused variable 'pm_csr' Zhang Changzhong
  2020-07-17 12:57 ` Mark Einon
@ 2020-07-18  1:43 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-07-18  1:43 UTC (permalink / raw)
  To: zhangchangzhong; +Cc: mark.einon, kuba, netdev, linux-kernel

From: Zhang Changzhong <zhangchangzhong@huawei.com>
Date: Fri, 17 Jul 2020 18:33:30 +0800

> Gcc report warning as follows:
> 
> drivers/net/ethernet/agere/et131x.c:953:6: warning:
>  variable 'pm_csr' set but not used [-Wunused-but-set-variable]
>   953 |  u32 pm_csr;
>       |      ^~~~~~
> drivers/net/ethernet/agere/et131x.c:1002:6:warning:
>  variable 'pm_csr' set but not used [-Wunused-but-set-variable]
>  1002 |  u32 pm_csr;
>       |      ^~~~~~
> drivers/net/ethernet/agere/et131x.c:3446:8: warning:
>  variable 'pm_csr' set but not used [-Wunused-but-set-variable]
>  3446 |    u32 pm_csr;
>       |        ^~~~~~
> 
> After commit 38df6492eb51 ("et131x: Add PCIe gigabit ethernet driver
> et131x to drivers/net"), 'pm_csr' is never used in these functions,
> so removing it to avoid build warning.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>

Applied.

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

end of thread, other threads:[~2020-07-18  1:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17 10:33 [PATCH net-next] net: ethernet: et131x: Remove unused variable 'pm_csr' Zhang Changzhong
2020-07-17 12:57 ` Mark Einon
2020-07-18  1:43 ` David Miller

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.