lkml.org 
[lkml]   [2015]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2 2/2] hwrng: iproc-rng200 - Add Broadcom IPROC RNG driver
Date
On Wednesday 25 February 2015 10:16:24 Scott Branden wrote:
> 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:

> + while ((num_remaining > 0) && time_before(jiffies, idle_endtime)) {
...
> +
> + /* Are there any random numbers available? */
> + if ((ioread32(rng_base + RNG_FIFO_COUNT_OFFSET) &
> + RNG_FIFO_COUNT_RNG_FIFO_COUNT_MASK) > 0) {
...
> + } 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.

Arnd


\
 
 \ /
  Last update: 2015-02-25 20:41    [W:0.194 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site