Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1443909

Re: [PATCH 1/2] tpm_tis_core: add optional max xfer size check

From Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] tpm_tis_core: add optional max xfer size check
Date 2016-07-15 05:20 +0200
Message-ID <rV1Pr-1AM-7@gated-at.bofh.it> (permalink)
References <rV0gF-qZ-9@gated-at.bofh.it> <rV0gF-qZ-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Jul 14, 2016 at 06:39:04PM -0700, Andrey Pronin wrote:

> +static inline u16 tpm_tis_max_xfer_size(struct tpm_tis_data *data)
> +{
> +	return data->phy_ops->max_xfer_size;
> +}
> +
> +static inline bool tpm_tis_burstcnt_is_valid(struct tpm_tis_data *data,
> +					     u16 burstcnt)
> +{
> +	return (tpm_tis_max_xfer_size(data) == 0)
> +		|| (burstcnt <= tpm_tis_max_xfer_size(data));
> +}

We don't need these accessors, just open code it in the one call
site. That is more clear as the ==0 case is important to understand
that the flow is correct.

BTW, I dodn't think || as the start of a line was cannonical kernel
style.. Did checkpatch accept that?

Jason

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] tpm: add optional max xfer size check Andrey Pronin <apronin@chromium.org> - 2016-07-15 03:40 +0200
  [PATCH 1/2] tpm_tis_core: add optional max xfer size check Andrey Pronin <apronin@chromium.org> - 2016-07-15 03:40 +0200
    Re: [PATCH 1/2] tpm_tis_core: add optional max xfer size check Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-07-15 05:20 +0200
      Re: [PATCH 1/2] tpm_tis_core: add optional max xfer size check Andrey Pronin <apronin@chromium.org> - 2016-07-15 05:30 +0200
        Re: [PATCH 1/2] tpm_tis_core: add optional max xfer size check Guenter Roeck <groeck@google.com> - 2016-07-15 05:50 +0200
      Re: [PATCH 1/2] tpm_tis_core: add optional max xfer size check Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-07-18 21:00 +0200
  [PATCH 2/2] tpm_tis_spi: add max xfer size Andrey Pronin <apronin@chromium.org> - 2016-07-15 03:40 +0200
  [PATCH v2 0/2] tpm: add optional max xfer size check Andrey Pronin <apronin@chromium.org> - 2016-07-20 04:40 +0200
    [PATCH v2 2/2] tpm_tis_spi: add max xfer size Andrey Pronin <apronin@chromium.org> - 2016-07-20 04:40 +0200
    [PATCH v2 1/2] tpm_tis_core: add optional max xfer size check Andrey Pronin <apronin@chromium.org> - 2016-07-20 04:40 +0200
    Re: [PATCH v2 0/2] tpm: add optional max xfer size check Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-07-20 17:20 +0200

csiph-web