From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752459AbcGODsn (ORCPT ); Thu, 14 Jul 2016 23:48:43 -0400 Received: from mail-qt0-f177.google.com ([209.85.216.177]:36395 "EHLO mail-qt0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751503AbcGODsm (ORCPT ); Thu, 14 Jul 2016 23:48:42 -0400 MIME-Version: 1.0 In-Reply-To: <20160715032517.GB25406@apronin> References: <1468546745-14646-1-git-send-email-apronin@chromium.org> <1468546745-14646-2-git-send-email-apronin@chromium.org> <20160715031351.GD9347@obsidianresearch.com> <20160715032517.GB25406@apronin> From: Guenter Roeck Date: Thu, 14 Jul 2016 20:48:40 -0700 Message-ID: Subject: Re: [PATCH 1/2] tpm_tis_core: add optional max xfer size check To: Andrey Pronin Cc: Jason Gunthorpe , Jarkko Sakkinen , Peter Huewe , Marcel Selhorst , tpmdd-devel@lists.sourceforge.net, linux-kernel , Guenter Roeck , smbarber@chromium.org, Douglas Anderson Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 14, 2016 at 8:25 PM, Andrey Pronin wrote: > 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. >> >> BTW, I dodn't think || as the start of a line was cannonical kernel >> style.. Did checkpatch accept that? >> >> Jason > > You mean completely open code it inside get_burstcount()? Will do. > checkpatch.pl had no problems with it, but I can move it to the end > of the line, if it feels better. > I would suggest to use checkpatch --strict; it will tell you. It will also ask you to align continuation lines with '(' on the previous line. On that, I would suggest to follow the style used in the file(s) you are working on (or follow guidance from the maintainer). Thanks, Guenter