From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752014AbdJYThU (ORCPT ); Wed, 25 Oct 2017 15:37:20 -0400 Received: from quartz.orcorp.ca ([184.70.90.242]:49231 "EHLO quartz.orcorp.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751522AbdJYThS (ORCPT ); Wed, 25 Oct 2017 15:37:18 -0400 Date: Wed, 25 Oct 2017 13:37:07 -0600 From: Jason Gunthorpe To: Jarkko Sakkinen Cc: PrasannaKumar Muralidharan , Stefan Berger , linux-integrity@vger.kernel.org, David Howells , Herbert Xu , Dmitry Kasatkin , open list , linux-security-module@vger.kernel.org, "open list:KEYS-TRUSTED" , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , James Morris , Matt Mackall , David Safford , Mimi Zohar , "Serge E. Hallyn" Subject: Re: [PATCH] tpm: Move Linux RNG connection to hwrng Message-ID: <20171025193707.GA998@obsidianresearch.com> References: <20171024184235.GC1806@obsidianresearch.com> <20171025185817.hoalqzud3646yuy7@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171025185817.hoalqzud3646yuy7@linux.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 25, 2017 at 08:58:17PM +0200, Jarkko Sakkinen wrote: > On Wed, Oct 25, 2017 at 08:15:09PM +0530, PrasannaKumar Muralidharan wrote: > > > + if (!IS_ENABLED(CONFIG_HW_RANDOM_TPM)) > > > + return 0; > > > > Can #ifndef CONFIG_HW_RANDOM_TPM be used instead? That way an if > > condition can be avoided. > > Nope. There is no reason to avoid the if-condition. Compiler will take > care of it. IS_ENABLED() macro is available just for the purpose Jason > is using it. > > > > + char tpm_hwrng_name[64]; > > > + struct hwrng tpm_hwrng; > > > + > > > > Can this also be put inside the #ifdef? > > Yes. It should be inside #ifdef. Then we need #idefs in the .c code, IS_ENABLED is not enough :\ I don't think the few bytes matters enough to bother. Jason