icplus: mdio_write(), remove unnecessary for loop
authorPatrick Kelle <patrick.kelle81@gmail.com>
Thu, 1 Dec 2011 17:54:46 +0000 (12:54 -0500)
committerDavid S. Miller <davem@davemloft.net>
Thu, 1 Dec 2011 17:54:46 +0000 (12:54 -0500)
At this point the variable j is always set to 7 and the code within
the loop has to run only once anyway.

As suggested by David Miller:
"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."

Signed-off-by: Patrick Kelle <patrick.kelle81@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/icplus/ipg.c

index 8fd80a00b898333af18d76aa0c44bc4f22b3b8f5..075451d0207d8d8e6c7af10272a6df61785aa540 100644 (file)
@@ -371,16 +371,9 @@ static void mdio_write(struct net_device *dev, int phy_id, int phy_reg, int val)
        }
 
        /* The last cycle is a tri-state, so read from the PHY. */
-       for (j = 7; j < 8; j++) {
-               for (i = 0; i < p[j].len; i++) {
-                       ipg_write_phy_ctl(ioaddr, IPG_PC_MGMTCLK_LO | polarity);
-
-                       p[j].field |= ((ipg_r8(PHY_CTRL) &
-                               IPG_PC_MGMTDATA) >> 1) << (p[j].len - 1 - i);
-
-                       ipg_write_phy_ctl(ioaddr, IPG_PC_MGMTCLK_HI | polarity);
-               }
-       }
+       ipg_write_phy_ctl(ioaddr, IPG_PC_MGMTCLK_LO | polarity);
+       ipg_r8(PHY_CTRL);
+       ipg_write_phy_ctl(ioaddr, IPG_PC_MGMTCLK_HI | polarity);
 }
 
 static void ipg_set_led_mode(struct net_device *dev)