From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753284AbbJFPXc (ORCPT ); Tue, 6 Oct 2015 11:23:32 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:35643 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752671AbbJFPXb (ORCPT ); Tue, 6 Oct 2015 11:23:31 -0400 Date: Tue, 6 Oct 2015 16:23:26 +0100 From: Lee Jones To: Daniel Thompson Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@stlinux.com, herbert@gondor.apana.org.au, peter@korsgaard.com, festevam@gmail.com, pankaj.dev@st.com Subject: Re: [PATCH 2/3] hwrng: st: Report correct FIFO size Message-ID: <20151006152326.GE17172@x1> References: <1444142640-14721-1-git-send-email-lee.jones@linaro.org> <1444142640-14721-2-git-send-email-lee.jones@linaro.org> <5613ED47.1040608@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5613ED47.1040608@linaro.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 06 Oct 2015, Daniel Thompson wrote: > On 06/10/15 15:43, Lee Jones wrote: > >The values supplied to the 'read random data from FIFO' arithmetic > >are not correct. The value fed in to initialise the iterator > >describes the FIFO depth, but then the iterator is treated in > >Bytes and subsequently increased by 2 in value for every read > >word. This means only 4 of the 8 available values are being read > >during each invocation of .read(). > > > >This change increased the device bandwidth by a factor of 2. > > > >Reported-by: Daniel Thompson > >Signed-off-by: Lee Jones > >--- > > drivers/char/hw_random/st-rng.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > >diff --git a/drivers/char/hw_random/st-rng.c b/drivers/char/hw_random/st-rng.c > >index 8c8a435..44480fe 100644 > >--- a/drivers/char/hw_random/st-rng.c > >+++ b/drivers/char/hw_random/st-rng.c > >@@ -29,8 +29,9 @@ > > #define ST_RNG_STATUS_BAD_ALTERNANCE BIT(1) > > #define ST_RNG_STATUS_FIFO_FULL BIT(5) > > > >-#define ST_RNG_FIFO_SIZE 8 > > #define ST_RNG_SAMPLE_SIZE 2 /* 2 Byte (16bit) samples */ > >+#define ST_RNG_FIFO_DEPTH 8 > >+#define ST_RNG_FIFO_SIZE (ST_RNG_FIFO_DEPTH * ST_RNG_SAMPLE_SIZE) > > > > /* Samples are available every 0.667us, which we round to 1us */ > > #define ST_RNG_FILL_FIFO_TIMEOUT (1 * (ST_RNG_FIFO_SIZE / ST_RNG_SAMPLE_SIZE)) > > This change doubles the timeout and doesn't mention it in the > changelog. The next patch renders this point moot. > Changing the order of 2/3 and 3/3 would avoid this. Right, if this is a real concern the patches can be applied in a different order. > Other than that: > > Reviewed-by: Daniel Thompson Thanking you. -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog