Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp8436804rwr; Thu, 11 May 2023 00:55:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ61mXd49WWeP0Ku1+xDx1mCN5Gcxhhqp9QtzROzbOBK2K8wo2hdRzIMIt9wwz34UmzcXdi4 X-Received: by 2002:a05:6a20:430a:b0:101:a435:a38 with SMTP id h10-20020a056a20430a00b00101a4350a38mr8090849pzk.57.1683791758789; Thu, 11 May 2023 00:55:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683791758; cv=none; d=google.com; s=arc-20160816; b=OfeQ1pU5jeINCtLS5GrSxR85Iu8w2A9EXCUAtefonB6bWlPklGM3L180KZO2pMoUXC Hijw+G9I7cdySnLZlCjj5Y8FTE+AZ9LhluIINuUit7Gpp8NMDJq5SUvF2BdaOLJc+xyQ clMaDEYjnawHuasaLaMohpKN50dqXH4rfyxT9IiTMwic95p5m72hwZcd6oxzARD+vhw+ ItWttAa9kxS6gheTQVZqwtYxWHDVIRNxY2teuZPXH1vgsGlEz7dv3UQsSxBVyOcQKYPf wGHFA2iePOs/3yr2dm2IFD8ECQjFYtuf8lO4s/NKrDNrPwAdNJAOXGmTyeMEUkEbGjcj iHwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=rY9JRu57/whQ8EtmgOh0rs57svC3liUmFxTJ/b1aPbE=; b=gIcDDLeTdNaAhF1KdF6izb0532ooXcn1oQ5+mRvIsr6GUOx2LVkPLus+dOu60JsXc/ xw95t8EJPbJ5hcsqeKaga2/xedPAvWUdSRuGJMKoriZQ46LVl8Wmp/fvjNqh1ff3y0xd 2BfyPK1WYwalCjCHSmeK0cjt8yjXbrihs0Kg9lHURLiFMCk7rV9g/kQI3vUNChaAXQLP gy/C9vBu6LwdNnqNu8SHMi8FBncDZ5qvzg+PrcYVZcgwfROmrm1GyWOWbclJoLgLIZzP 4tiFnMCy5CtBP0DWdLuLLbWI/9x8c9Bf+zDAON9YXoOeWzG8wZfm9KNcAEvp+2bvvKgK 9XIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v135-20020a63618d000000b0051b35caf3fesi6157157pgb.239.2023.05.11.00.55.39; Thu, 11 May 2023 00:55:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237329AbjEKHnM (ORCPT + 99 others); Thu, 11 May 2023 03:43:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237535AbjEKHnH (ORCPT ); Thu, 11 May 2023 03:43:07 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 992F210FD; Thu, 11 May 2023 00:43:02 -0700 (PDT) Received: from martin by viti.kaiser.cx with local (Exim 4.89) (envelope-from ) id 1px0x2-0005kb-GR; Thu, 11 May 2023 09:43:00 +0200 Date: Thu, 11 May 2023 09:43:00 +0200 From: Martin Kaiser To: Herbert Xu Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] hwrng: imx-rngc - use bitfield macros to read fifo level Message-ID: <20230511074300.ocfrmynne7e6wdkj@viti.kaiser.cx> References: <20230427185357.923412-1-martin@kaiser.cx> <20230427185357.923412-2-martin@kaiser.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: Martin Kaiser X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Thus wrote Herbert Xu (herbert@gondor.apana.org.au): > On Thu, Apr 27, 2023 at 08:53:55PM +0200, Martin Kaiser wrote: > > @@ -133,9 +133,7 @@ static int imx_rngc_read(struct hwrng *rng, void *data, size_t max, bool wait) > > break; > > /* how many random numbers are in FIFO? [0-16] */ > > - level = (status & RNGC_STATUS_FIFO_LEVEL_MASK) >> > > - RNGC_STATUS_FIFO_LEVEL_SHIFT; > > - > > + level = FIELD_GET(RNGC_STATUS_FIFO_LEVEL, status); > Wouldn't it be simpler to just get rid of the shift? Yes, we're only checking that level > 0, there's no need for the shift. I'll submit a new version of the patch. Thanks, Martin