lkml.org 
[lkml]   [2016]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] tpm_tis_core: add optional max xfer size check
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

\
 
 \ /
  Last update: 2016-07-18 21:41    [W:0.212 / U:0.552 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site