From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH v2 2/2] hwrng: iproc-rng200 - Add Broadcom IPROC RNG driver Date: Wed, 25 Feb 2015 20:17:42 +0100 Message-ID: <3062825.7b1oYP4yuL@wuerfel> References: <1424888184-22180-3-git-send-email-sbranden@broadcom.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Return-path: In-Reply-To: <1424888184-22180-3-git-send-email-sbranden-dY08KVG/lbpWk0Htik3J/w@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Scott Branden Cc: bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/w@public.gmane.org, Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Matt Mackall , Herbert Xu , Grant Likely , Ray Jui , Jonathan Richardson , Dmitry Torokhov , Anatol Pomazao , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: devicetree@vger.kernel.org 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 > Signed-off-by: Scott Branden 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 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html