diff options
author | Andrew Lunn <andrew@lunn.ch> | 2016-08-18 18:01:56 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-08-19 20:14:07 -0400 |
commit | 0f02b4f75245c9f11f38ed983a2f5e21fd780e80 (patch) | |
tree | 76e5686496f0596c937cd1777618af83b2232f47 /drivers/net/dsa | |
parent | 6441e6695acfce66499c186c591f319a3b125de7 (diff) |
dsa: mv88e6xxx: Use mv88e6xx_wait in mv88e6xxx_update()
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>
Diffstat (limited to 'drivers/net/dsa')
-rw-r--r-- | drivers/net/dsa/mv88e6xxx/chip.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index ac8e9af4879f..8c846bce4edf 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c | |||
@@ -333,20 +333,12 @@ static int mv88e6xxx_update(struct mv88e6xxx_chip *chip, int addr, int reg, | |||
333 | u16 update) | 333 | u16 update) |
334 | { | 334 | { |
335 | u16 val; | 335 | u16 val; |
336 | int i, err; | 336 | int err; |
337 | 337 | ||
338 | /* Wait until the previous operation is completed */ | 338 | /* Wait until the previous operation is completed */ |
339 | for (i = 0; i < 16; ++i) { | 339 | err = mv88e6xxx_wait(chip, addr, reg, BIT(15)); |
340 | err = mv88e6xxx_read(chip, addr, reg, &val); | 340 | if (err) |
341 | if (err) | 341 | return err; |
342 | return err; | ||
343 | |||
344 | if (!(val & BIT(15))) | ||
345 | break; | ||
346 | } | ||
347 | |||
348 | if (i == 16) | ||
349 | return -ETIMEDOUT; | ||
350 | 342 | ||
351 | /* Set the Update bit to trigger a write operation */ | 343 | /* Set the Update bit to trigger a write operation */ |
352 | val = BIT(15) | update; | 344 | val = BIT(15) | update; |