Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6140304iog; Thu, 23 Jun 2022 12:11:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1syPXqTLUa9mwt/ZF9s7OkiEOSb+Uto/sqcdvif51kzSDDc/3s+bXLr7MLsae6fQGy4d+n5 X-Received: by 2002:a17:907:1b0c:b0:6fe:25bf:b3e5 with SMTP id mp12-20020a1709071b0c00b006fe25bfb3e5mr9645801ejc.689.1656011460057; Thu, 23 Jun 2022 12:11:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656011460; cv=none; d=google.com; s=arc-20160816; b=zRrEFDA/DA/iFInHPNnOmo2g4PCN1K4HQt4GU1l2dF7lGg0WYjJlNLuF+Pa+6cohad LWkmFkjGFJzNoLxGoBVY0tEIX5YmuKCHe9TnTHpNzQgC7vT2HpJP961JPK4t/gEH74Od TCc77EbHVOtBxSsr9rwt+Rxl0i9w6BeFULj1MOB1gAeQq0sNhmVdGUnfhEbSkmY0xIzC uWU5i39hx7tFbQBOHtCGBWYyCjURfass0fZRzb9xNddba3ZR4Pcmbyze362kGWQ2HueZ qLimvfG8rxWO2QgPWBxWs2CqCasS8PUg63coW9r+nDX6LJKP7PhdQH/s+CpH5IWgo2Rl 1otw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iihuw3RzXFQ3L7DQu6JGXNyhalJwB/urSOr8qg+k4g4=; b=OFQhvSkBw8aB9t8VndBI6TbBlvPQ/Hg5Xs52WiP11doe3USqVKYi8rvkJKT+M4IaGn KQpcRzYodZRY+CLEpuaLTCCxnHPZFZVx76ufjlFdIjfOMC4i9zxZ2HrlIphRWHrGuvKJ yXwMUxmhrqPfU0tY4leQ9aUyKIrPFdiflFTWp0Mi/aCBLSgPZXEVfiVDNJJm2QRwOCqo S1BYsdoc4jABmlO/qXKiwmVqw90ijglDcv2j5IpoKzKHn0LblL/JwTMVt9qGbNue9jPt Grz/GnL7G5xZDVo6D9m7C/9gL+VSqBDwugbSQZKiYIyTRlILd/N8+yeATzusb8oHBivi WO5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BBedXAKR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l11-20020a50d6cb000000b0042dd4c1954fsi405254edj.98.2022.06.23.12.10.35; Thu, 23 Jun 2022 12:11:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BBedXAKR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235406AbiFWRzq (ORCPT + 99 others); Thu, 23 Jun 2022 13:55:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235488AbiFWRwq (ORCPT ); Thu, 23 Jun 2022 13:52:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8183D5675F; Thu, 23 Jun 2022 10:13:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C9D1CB82498; Thu, 23 Jun 2022 17:13:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3595BC341C4; Thu, 23 Jun 2022 17:13:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656004411; bh=EG8DbuFAy3wSg2q98S5uSLWwJle4ufkndXArKGOdL5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BBedXAKRbvJ1jnrCSwwKwK2qliR90ou4QJW4x7vRIH+8ji3oT7C+Lf1tU4YYTme6B BfzJ1Y8IJZ5UKarRRJg9ADUqMA67fmqx7Qg4on8nn8Zq5vYivkbKUtOdcoS79uMcnt eE/sg7V6VfLnICKoOiw/po0sMNoixvJsu/RRwtM0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yangtao Li , Theodore Tso , "Jason A. Donenfeld" Subject: [PATCH 4.19 029/234] random: convert to ENTROPY_BITS for better code readability Date: Thu, 23 Jun 2022 18:41:36 +0200 Message-Id: <20220623164343.889685406@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164343.042598055@linuxfoundation.org> References: <20220623164343.042598055@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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-kernel@vger.kernel.org From: Yangtao Li commit 12faac30d157970fdbfa171bbeb1fb88350303b1 upstream. Signed-off-by: Yangtao Li Link: https://lore.kernel.org/r/20190607182517.28266-2-tiny.windzz@gmail.com Signed-off-by: Theodore Ts'o Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- drivers/char/random.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -762,7 +762,7 @@ retry: if (entropy_bits < 128) return; crng_reseed(&primary_crng, r); - entropy_bits = r->entropy_count >> ENTROPY_SHIFT; + entropy_bits = ENTROPY_BITS(r); } } } @@ -1397,8 +1397,7 @@ retry: goto retry; trace_debit_entropy(r->name, 8 * ibytes); - if (ibytes && - (r->entropy_count >> ENTROPY_SHIFT) < random_write_wakeup_bits) { + if (ibytes && ENTROPY_BITS(r) < random_write_wakeup_bits) { wake_up_interruptible(&random_write_wait); kill_fasync(&fasync, SIGIO, POLL_OUT); }