Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754160AbbBZThi (ORCPT ); Thu, 26 Feb 2015 14:37:38 -0500 Received: from mail-gw2-out.broadcom.com ([216.31.210.63]:22276 "EHLO mail-gw2-out.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753844AbbBZThg (ORCPT ); Thu, 26 Feb 2015 14:37:36 -0500 X-IronPort-AV: E=Sophos;i="5.09,654,1418112000"; d="scan'208";a="58118269" Message-ID: <54EF75F0.7000901@broadcom.com> Date: Thu, 26 Feb 2015 11:37:20 -0800 From: Scott Branden User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Arnd Bergmann CC: , Rob Herring , Pawel Moll , Mark Rutland , "Ian Campbell" , Kumar Gala , Matt Mackall , Herbert Xu , Grant Likely , Ray Jui , Jonathan Richardson , Dmitry Torokhov , Anatol Pomazao , , , Subject: Re: [PATCH v2 2/2] hwrng: iproc-rng200 - Add Broadcom IPROC RNG driver References: <1424888184-22180-3-git-send-email-sbranden@broadcom.com> <3062825.7b1oYP4yuL@wuerfel> In-Reply-To: <3062825.7b1oYP4yuL@wuerfel> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1463 Lines: 48 Response inline. On 15-02-25 11:17 AM, Arnd Bergmann wrote: > 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. 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 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/