Thread (15 messages) 15 messages, 5 authors, 2015-03-03

[PATCH v2 2/2] hwrng: iproc-rng200 - Add Broadcom IPROC RNG driver

From: sbranden@broadcom.com (Scott Branden)
Date: 2015-02-26 19:37:38
Also in: linux-devicetree, lkml

Response inline.

On 15-02-25 11:17 AM, Arnd Bergmann wrote:
On Wednesday 25 February 2015 10:16:24 Scott Branden wrote:
quoted
This adds a driver for random number generator present on Broadcom
IPROC devices.

Reviewed-by: Ray Jui <rjui@broadcom.com>
Signed-off-by: Scott Branden <sbranden@broadcom.com>
The driver looks reasonable overall, I have just one question about
something that sticks out:
quoted
+	while ((num_remaining > 0) && time_before(jiffies, idle_endtime)) {
...
quoted
+
+		/* Are there any random numbers available? */
+		if ((ioread32(rng_base + RNG_FIFO_COUNT_OFFSET) &
+				RNG_FIFO_COUNT_RNG_FIFO_COUNT_MASK) > 0) {
...
quoted
+		} else {
+			if (!wait)
+				/* Cannot wait, return immediately */
+				return max - num_remaining;
+
+			/* Can wait, give others chance to run */
+			cpu_relax();
+		}
+	}
+
It looks like you do a busy-loop around cpu_relax here if asked to wait.
Is this intentional? I would normally expect either cond_resched() or
some msleep() instead.
This code was following examples of other open source drivers - bcm2835 
and exynos both use cpu_relax.  I'll have to look into this more to 
understand.
	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