linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ethernet: et131x: Remove redundant register read
@ 2020-07-17 13:21 Mark Einon
  2020-07-17 13:40 ` Andrew Lunn
  2020-07-18  1:48 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Mark Einon @ 2020-07-17 13:21 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-kernel, Mark Einon

Following the removal of an unused variable assignment (remove
unused variable 'pm_csr') the associated register read can also go,
as the read also occurs in the subsequent et1310_in_phy_coma()
call.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
 drivers/net/ethernet/agere/et131x.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ethernet/agere/et131x.c b/drivers/net/ethernet/agere/et131x.c
index 8806e1e4c20f..41f8821f792d 100644
--- a/drivers/net/ethernet/agere/et131x.c
+++ b/drivers/net/ethernet/agere/et131x.c
@@ -983,7 +983,6 @@ static void et1310_setup_device_for_multicast(struct et131x_adapter *adapter)
 	}
 
 	/* Write out the new hash to the device */
-	readl(&adapter->regs->global.pm_csr);
 	if (!et1310_in_phy_coma(adapter)) {
 		writel(hash1, &rxmac->multi_hash1);
 		writel(hash2, &rxmac->multi_hash2);
@@ -1023,7 +1022,6 @@ static void et1310_setup_device_for_unicast(struct et131x_adapter *adapter)
 		  (adapter->addr[4] << ET_RX_UNI_PF_ADDR1_5_SHIFT) |
 		   adapter->addr[5];
 
-	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);
@@ -3444,7 +3442,6 @@ static irqreturn_t et131x_isr(int irq, void *dev_id)
 			/* Tell the device to send a pause packet via the back
 			 * pressure register (bp req and bp xon/xoff)
 			 */
-			readl(&iomem->global.pm_csr);
 			if (!et1310_in_phy_coma(adapter))
 				writel(3, &iomem->txmac.bp_ctrl);
 		}
-- 
2.26.2


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

* Re: [PATCH] net: ethernet: et131x: Remove redundant register read
  2020-07-17 13:21 [PATCH] net: ethernet: et131x: Remove redundant register read Mark Einon
@ 2020-07-17 13:40 ` Andrew Lunn
  2020-07-17 15:21   ` Mark Einon
  2020-07-18  1:48 ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2020-07-17 13:40 UTC (permalink / raw)
  To: Mark Einon; +Cc: davem, netdev, linux-kernel

On Fri, Jul 17, 2020 at 02:21:35PM +0100, Mark Einon wrote:
> Following the removal of an unused variable assignment (remove
> unused variable 'pm_csr') the associated register read can also go,
> as the read also occurs in the subsequent et1310_in_phy_coma()
> call.

Hi Mark

Do you have any hardware documentation which indicates these read are
not required? Have you looked back through the git history to see if
there are any comments about these read?

Hardware reads which appear pointless are sometimes very important to
actually make the hardware work.

	 Andrew

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

* Re: [PATCH] net: ethernet: et131x: Remove redundant register read
  2020-07-17 13:40 ` Andrew Lunn
@ 2020-07-17 15:21   ` Mark Einon
  2020-07-18 14:54     ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Einon @ 2020-07-17 15:21 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: davem, netdev, linux-kernel

On Fri, 2020-07-17 at 15:40 +0200, Andrew Lunn wrote:
> On Fri, Jul 17, 2020 at 02:21:35PM +0100, Mark Einon wrote:
> > Following the removal of an unused variable assignment (remove
> > unused variable 'pm_csr') the associated register read can also go,
> > as the read also occurs in the subsequent 
> > call.
> 
> Hi Mark
> 
> Do you have any hardware documentation which indicates these read are
> not required? Have you looked back through the git history to see if
> there are any comments about these read?
> 
> Hardware reads which appear pointless are sometimes very important to
> actually make the hardware work.
> 
> 	 Andrew

Hi Andrew,

Yes - I'm aware of such effects. In the original vendor driver (
https://gitlab.com/einonm/Legacy-et131x) the read of this register ( 
pm_phy_sw_coma) is not wrapped in a function call and is always called
once when needed.

Also in the current kernel driver et1310_in_phy_coma() is called a few
other times without the removed read being made.

The datasheet I have for a similar device (et1011) doesn't say anything
other than the register should be read/write.

So I think this is a safe thing to do. 

Best regards,

Mark



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

* Re: [PATCH] net: ethernet: et131x: Remove redundant register read
  2020-07-17 13:21 [PATCH] net: ethernet: et131x: Remove redundant register read Mark Einon
  2020-07-17 13:40 ` Andrew Lunn
@ 2020-07-18  1:48 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2020-07-18  1:48 UTC (permalink / raw)
  To: mark.einon; +Cc: netdev, linux-kernel

From: Mark Einon <mark.einon@gmail.com>
Date: Fri, 17 Jul 2020 14:21:35 +0100

> Following the removal of an unused variable assignment (remove
> unused variable 'pm_csr') the associated register read can also go,
> as the read also occurs in the subsequent et1310_in_phy_coma()
> call.
> 
> Signed-off-by: Mark Einon <mark.einon@gmail.com>

Applied to net-next.

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

* Re: [PATCH] net: ethernet: et131x: Remove redundant register read
  2020-07-17 15:21   ` Mark Einon
@ 2020-07-18 14:54     ` Andrew Lunn
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2020-07-18 14:54 UTC (permalink / raw)
  To: Mark Einon; +Cc: davem, netdev, linux-kernel

On Fri, Jul 17, 2020 at 04:21:51PM +0100, Mark Einon wrote:
> On Fri, 2020-07-17 at 15:40 +0200, Andrew Lunn wrote:
> > On Fri, Jul 17, 2020 at 02:21:35PM +0100, Mark Einon wrote:
> > > Following the removal of an unused variable assignment (remove
> > > unused variable 'pm_csr') the associated register read can also go,
> > > as the read also occurs in the subsequent 
> > > call.
> > 
> > Hi Mark
> > 
> > Do you have any hardware documentation which indicates these read are
> > not required? Have you looked back through the git history to see if
> > there are any comments about these read?
> > 
> > Hardware reads which appear pointless are sometimes very important to
> > actually make the hardware work.
> > 
> > 	 Andrew
> 
> Hi Andrew,
> 
> Yes - I'm aware of such effects. In the original vendor driver (
> https://gitlab.com/einonm/Legacy-et131x) the read of this register ( 
> pm_phy_sw_coma) is not wrapped in a function call and is always called
> once when needed.
> 
> Also in the current kernel driver et1310_in_phy_coma() is called a few
> other times without the removed read being made.
> 
> The datasheet I have for a similar device (et1011) doesn't say anything
> other than the register should be read/write.
> 
> So I think this is a safe thing to do. 

Hi Mark

It is good to include this sort of information in the commit
message. It makes it clear you have considered this, and it stops
people like me asking...

	 Andrew

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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17 13:21 [PATCH] net: ethernet: et131x: Remove redundant register read Mark Einon
2020-07-17 13:40 ` Andrew Lunn
2020-07-17 15:21   ` Mark Einon
2020-07-18 14:54     ` Andrew Lunn
2020-07-18  1:48 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).