net: dsa: vsc73xx: use read_poll_timeout instead delay loop
authorPawel Dembicki <paweldembicki@gmail.com>
Wed, 17 Apr 2024 20:50:44 +0000 (22:50 +0200)
committerJakub Kicinski <kuba@kernel.org>
Mon, 22 Apr 2024 21:20:13 +0000 (14:20 -0700)
commiteb7e33d01db3aec128590391b2397384bab406b6
tree00359005c8fd303c128ef9d7b9f9eed7f79fa258
parentc51db4ac10d57c366f9a92121e3889bfc6c324cd
net: dsa: vsc73xx: use read_poll_timeout instead delay loop

Switch the delay loop during the Arbiter empty check from
vsc73xx_adjust_link() to use read_poll_timeout(). Functionally,
one msleep() call is eliminated at the end of the loop in the timeout
case.

As Russell King suggested:

"This [change] avoids the issue that on the last iteration, the code reads
the register, tests it, finds the condition that's being waiting for is
false, _then_ waits and end up printing the error message - that last
wait is rather useless, and as the arbiter state isn't checked after
waiting, it could be that we had success during the last wait."

Suggested-by: Russell King <linux@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
Link: https://lore.kernel.org/r/20240417205048.3542839-2-paweldembicki@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/vitesse-vsc73xx-core.c