Skip to content

Commit d7d7596

Browse files
pkelledavem330
authored andcommitted
icplus: mdio_write(), remove unnecessary for loop
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>
1 parent b536db9 commit d7d7596

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

  • drivers/net/ethernet/icplus

‎drivers/net/ethernet/icplus/ipg.c‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -371,16 +371,9 @@ static void mdio_write(struct net_device *dev, int phy_id, int phy_reg, int val)
371371
}
372372

373373
/* The last cycle is a tri-state, so read from the PHY. */
374-
for (j = 7; j < 8; j++) {
375-
for (i = 0; i < p[j].len; i++) {
376-
ipg_write_phy_ctl(ioaddr, IPG_PC_MGMTCLK_LO | polarity);
377-
378-
p[j].field |= ((ipg_r8(PHY_CTRL) &
379-
IPG_PC_MGMTDATA) >> 1) << (p[j].len - 1 - i);
380-
381-
ipg_write_phy_ctl(ioaddr, IPG_PC_MGMTCLK_HI | polarity);
382-
}
383-
}
374+
ipg_write_phy_ctl(ioaddr, IPG_PC_MGMTCLK_LO | polarity);
375+
ipg_r8(PHY_CTRL);
376+
ipg_write_phy_ctl(ioaddr, IPG_PC_MGMTCLK_HI | polarity);
384377
}
385378

386379
static void ipg_set_led_mode(struct net_device *dev)

0 commit comments

Comments
 (0)