linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
To: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: Peter Huewe <peterhuewe@gmx.de>,
	Marcel Selhorst <tpmdd@selhorst.net>,
	"moderated list:TPM DEVICE DRIVER" 
	<tpmdd-devel@lists.sourceforge.net>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tpm: fix invalid constant expressions in tpm.h
Date: Mon, 29 Aug 2016 21:45:36 -0600	[thread overview]
Message-ID: <20160830034536.GA29261@obsidianresearch.com> (raw)
In-Reply-To: <1472520498-24173-1-git-send-email-jarkko.sakkinen@linux.intel.com>

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..

>  #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

> +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 <jgunthorpe@obsidianresearch.com>

Jason

  reply	other threads:[~2016-08-30  3:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-30  1:28 [PATCH] tpm: fix invalid constant expressions in tpm.h Jarkko Sakkinen
2016-08-30  3:45 ` Jason Gunthorpe [this message]
2016-08-30  6:31   ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160830034536.GA29261@obsidianresearch.com \
    --to=jgunthorpe@obsidianresearch.com \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=tpmdd-devel@lists.sourceforge.net \
    --cc=tpmdd@selhorst.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).