Re: [PATCH] icplus: mdio_write(), remove unnecessary for loop
From: David Miller <davem@davemloft.net>
Date: 2011-11-29 23:49:15
From: David Miller <davem@davemloft.net>
Date: 2011-11-29 23:49:15
From: Patrick Kelle <redacted> Date: Thu, 24 Nov 2011 16:39:05 +0100
At this point the variable j is always set to 7 and the code within the loop has to run only once anyway. Signed-off-by: Patrick Kelle <redacted>
You can simply this even further since p[7] is what is used here, and this means len is one, the inner loop therefore executes only once, and the p[7].field value is not used (it's zero in the table) and the write to it is completely thrown away. It all reduces to something like: ipg_write_phy_ctl(ioaddr, IPG_PC_MGMTCLK_LO | polarity); ipg_r8(PHY_CTRL); ipg_write_phy_ctl(ioaddr, IPG_PC_MGMTCLK_HI | polarity); Which is just asserting the management clock low, then high, and doing a PHY_CTRL read in between to force the write out, the read data is not used at all.