Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6048334iog; Thu, 23 Jun 2022 10:14:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sQqVDW1Ktz+dbr4ReYSodb8Uqn5iWGcVJA3MNiGrT4PsJ+XnZCxEzO8nniWuHZ/B16gpKS X-Received: by 2002:a05:6402:520a:b0:435:965f:e266 with SMTP id s10-20020a056402520a00b00435965fe266mr11889724edd.409.1656004457880; Thu, 23 Jun 2022 10:14:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656004457; cv=none; d=google.com; s=arc-20160816; b=jhrlKqztRFmWa5o8R8SD5nwrgDJhuj+ixIjQ1kpYKk74OtgKpmZv4MP3EVPaaYH6n8 mN755k74g62g7atDcWyCMg4Z2PQjxJ+uNh5irg87Br4pmnAE/hiEZZjJkVIuYcwOpDIQ GrCg6Uwlx9D1UQs+trne4eyRv85XQSA6bUMEgbMLB9iMvBJJiHd5KJeYOh4M7Z7bRG5v +JzgQ3sWaoYSqQpzHNaWqIKgEbSaptJYXw0tdkmaNGG70uVgzrLmfy7iFK40SVa2KcoI kPmgAwDTuEDk1w0JlpYC4SaloIyYJCZkESMRTKfuhuoHyuE9fcv/LgumXUU4+u77fC2E xmrA== 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=+DIUzu6YEp7RgFmMvK+LH+xiycTBaJMirazJNe5NygU=; b=Uz0XnAaGDZ7+FC2224vctdl6U+b2Wm1gvRJt6xVUu+GxFsblzDlt+Uvg2rtLmtUUbV iZhCXLbOz66/aGg58xP4C7WAPtqOzo135OICMsGz6pEp5ABDhq9tS+cSg6xnrZ/8FXkK CILWcrdut+RvY5wlNuqMOD38ZR1kNucccWWK2GmQSW3TWf9aFLez151Vh3LN0cgGmYO/ V+aoWPgAWcp0ESp3b5N4mW5aeFqgz2Uv3m/uctFPoJXC70ZcEq262WuR/bvQc62UdbdM jgBIrTV/9XaKy6+lrpnEJlMs30Vg8elkC+FY1AuyOnpqT5TMVNnB4JTe6TS/WdDlvBDy IIQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LQ7loQct; 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 g10-20020a056402090a00b0042f4ae66c4asi180038edz.148.2022.06.23.10.13.51; Thu, 23 Jun 2022 10:14:17 -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=LQ7loQct; 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 S230333AbiFWQ7g (ORCPT + 99 others); Thu, 23 Jun 2022 12:59:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233212AbiFWQud (ORCPT ); Thu, 23 Jun 2022 12:50:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82AE64EF41; Thu, 23 Jun 2022 09:48:23 -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 B2E4AB8248A; Thu, 23 Jun 2022 16:48:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1ED5EC341C4; Thu, 23 Jun 2022 16:48:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656002900; bh=5sYOrxbCgeW+z65LEhQdLkwXEgONtneuFYAbF8lOtMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LQ7loQctBc0xcMfu4b3yVJeDSC6HVOlxOKtRx6bfXlfcY+TwQoYIZvQnIgMw4wZFA bAjPEiFYARDEowbqc3qty4uEV8uGYqRAziCB0Uq7GSHIzeF5umdFVwfK4BbQjU1kq8 AjGrduq3+VuKVmvXoFCmLdAjqyJo5/A34sQXM+PE= 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.9 063/264] random: convert to ENTROPY_BITS for better code readability Date: Thu, 23 Jun 2022 18:40:56 +0200 Message-Id: <20220623164345.854877029@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164344.053938039@linuxfoundation.org> References: <20220623164344.053938039@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 @@ -763,7 +763,7 @@ retry: if (entropy_bits < 128) return; crng_reseed(&primary_crng, r); - entropy_bits = r->entropy_count >> ENTROPY_SHIFT; + entropy_bits = ENTROPY_BITS(r); } } } @@ -1446,8 +1446,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); }