Skip to content

Commit

Permalink
dsa: mv88e6xxx: Use mv88e6xx_wait in mv88e6xxx_update()
Browse files Browse the repository at this point in the history
Now that mv88e6xx_wait() iterated on a counter than a fixed time
interval, it implements the same mechanism as mv88e6xxx_update() uses.
So use it in mv88e6xx_wait().

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Andrew Lunn authored and David S. Miller committed Aug 20, 2016
1 parent 6441e66 commit 0f02b4f
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions drivers/net/dsa/mv88e6xxx/chip.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,20 +333,12 @@ static int mv88e6xxx_update(struct mv88e6xxx_chip *chip, int addr, int reg,
u16 update)
{
u16 val;
int i, err;
int err;

/* Wait until the previous operation is completed */
for (i = 0; i < 16; ++i) {
err = mv88e6xxx_read(chip, addr, reg, &val);
if (err)
return err;

if (!(val & BIT(15)))
break;
}

if (i == 16)
return -ETIMEDOUT;
err = mv88e6xxx_wait(chip, addr, reg, BIT(15));
if (err)
return err;

/* Set the Update bit to trigger a write operation */
val = BIT(15) | update;
Expand Down

0 comments on commit 0f02b4f

Please sign in to comment.