From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752591AbcH3Gbh (ORCPT ); Tue, 30 Aug 2016 02:31:37 -0400 Received: from mga02.intel.com ([134.134.136.20]:25810 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750998AbcH3Gbg (ORCPT ); Tue, 30 Aug 2016 02:31:36 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,255,1470726000"; d="scan'208";a="162335800" Date: Tue, 30 Aug 2016 09:31:03 +0300 From: Jarkko Sakkinen To: Jason Gunthorpe Cc: Peter Huewe , Marcel Selhorst , "moderated list:TPM DEVICE DRIVER" , open list Subject: Re: [PATCH] tpm: fix invalid constant expressions in tpm.h Message-ID: <20160830063103.GA4352@intel.com> References: <1472520498-24173-1-git-send-email-jarkko.sakkinen@linux.intel.com> <20160830034536.GA29261@obsidianresearch.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160830034536.GA29261@obsidianresearch.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 29, 2016 at 09:45:36PM -0600, Jason Gunthorpe wrote: > On Tue, Aug 30, 2016 at 04:28:17AM +0300, Jarkko Sakkinen wrote: > > The enums tpm_capabilities and tpm_sub_capabilities do not contain legit > > constant expressions. This commit makes cap_id a separate parameter > > in > > I wonder if this is a bug in sparse? the macro uses gcc magic to > expand to a constexpr. > > You could also use __constant_cpu_to_be32 and similar instead. > > But I admit I never liked the use of no-host endian in the constants.. It's too much magic for me, be it way or another :) > > #define TPM_ORD_STARTUP cpu_to_be32(153) > > #define TPM_ST_CLEAR cpu_to_be16(1) > > Would be nice to see these fixed into an enum someday too (putting note into my backlog text file) > > +enum tpm1_capabilities { > > + TPM1_CAP_FLAG = 0x04, > > + TPM1_CAP_PROP = 0x05, > > + TPM1_CAP_VERSION_1_1 = 0x06, > > + TPM1_CAP_VERSION_1_2 = 0x1A, > > I usually discourage the extra horizontal whitespace, just causes patch churn to > keep it up (and clang-format won't do it automatically). Not sure if > there is a consensus on that though. > > But looks fine to me. > > Reviewed-by: Jason Gunthorpe Thanks! > Jason /Jarkko