[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 10 Oct 2018 15:39:21 +0200
From: Arnd Bergmann <arnd@...db.de>
To: sunil.kovvuri@...il.com
Cc: netdev@...r.kernel.org, davem@...emloft.net,
linux-soc@...r.kernel.org, Sunil Goutham <sgoutham@...vell.com>
Subject: Re: [PATCH v9 02/15] octeontx2-af: Reset all RVU blocks
> + void __iomem *reg;
> + int timeout = 100;
> + u64 reg_val;
> +
> + reg = rvu->afreg_base + ((block << 28) | offset);
> + while (timeout) {
> + reg_val = readq(reg);
> + if (zero && !(reg_val & mask))
> + return 0;
> + if (!zero && (reg_val & mask))
> + return 0;
> + usleep_range(1, 2);
> + timeout--;
> + }
One more clarification here: if you loop around a usleep_range(),
I would suggest using 'while (time_before(jiffies, end))'
or 'ktime_before(ktime_get(), end)' as the loop condition, otherwise
the maximum timeout can be fairly large depending on the
actual configuration and presence of timers. Then you can
also make the range much wider, e.g. 'usleep_range(1, 10)'
Aside from that, this looks much better than the delay loop
you had before.
Arnd
Powered by blists - more mailing lists