Thread (20 messages) 20 messages, 3 authors, 2018-10-11

Re: [PATCH v9 02/15] octeontx2-af: Reset all RVU blocks

flat view

From: Arnd Bergmann <arnd@arndb.de>
Date: 2018-10-10 21:01:36

quoted hunk ↗ jump to hunk
+	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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help