From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751993AbcGRSxl (ORCPT ); Mon, 18 Jul 2016 14:53:41 -0400 Received: from mga02.intel.com ([134.134.136.20]:14273 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751597AbcGRSxi (ORCPT ); Mon, 18 Jul 2016 14:53:38 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,385,1464678000"; d="scan'208";a="1024248082" Date: Mon, 18 Jul 2016 21:53:27 +0300 From: Jarkko Sakkinen To: Jason Gunthorpe Cc: Andrey Pronin , Peter Huewe , Marcel Selhorst , tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, groeck@chromium.org, smbarber@chromium.org, dianders@chromium.org Subject: Re: [PATCH 1/2] tpm_tis_core: add optional max xfer size check Message-ID: <20160718185327.GJ31463@intel.com> References: <1468546745-14646-1-git-send-email-apronin@chromium.org> <1468546745-14646-2-git-send-email-apronin@chromium.org> <20160715031351.GD9347@obsidianresearch.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160715031351.GD9347@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 Thu, Jul 14, 2016 at 09:13:51PM -0600, Jason Gunthorpe wrote: > 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. +1 They add only indirection here with no value. > BTW, I dodn't think || as the start of a line was cannonical kernel > style.. Did checkpatch accept that? > > Jason /Jarkko