From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753586AbcGSMzf (ORCPT ); Tue, 19 Jul 2016 08:55:35 -0400 Received: from mga14.intel.com ([192.55.52.115]:45395 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753548AbcGSMzd (ORCPT ); Tue, 19 Jul 2016 08:55:33 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,389,1464678000"; d="scan'208";a="1009749925" Date: Tue, 19 Jul 2016 15:55:27 +0300 From: Jarkko Sakkinen To: Andrey Pronin Cc: Jason Gunthorpe , Peter Huewe , Marcel Selhorst , tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, groeck@chromium.org, smbarber@chromium.org, dianders@chromium.org, Christophe Ricard Subject: Re: [PATCH 2/2] tpm: add driver for cr50 on SPI Message-ID: <20160719125527.GB5047@intel.com> References: <1468549218-19215-1-git-send-email-apronin@chromium.org> <1468549218-19215-3-git-send-email-apronin@chromium.org> <20160715033236.GH9347@obsidianresearch.com> <20160715034444.GA28128@apronin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160715034444.GA28128@apronin> 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 08:44:44PM -0700, Andrey Pronin wrote: > On Thu, Jul 14, 2016 at 09:32:36PM -0600, Jason Gunthorpe wrote: > > On Thu, Jul 14, 2016 at 07:20:18PM -0700, Andrey Pronin wrote: > > > > > +static int cr50_spi_read16(struct tpm_tis_data *data, u32 addr, u16 *result) > > > +{ > > > + int rc; > > > + > > > + rc = data->phy_ops->read_bytes(data, addr, sizeof(u16), (u8 *)result); > > > + if (!rc) > > > + *result = le16_to_cpu(*result); > > > + return rc; > > > +} > > > > I thought we had core support for this pattern? > > > > Christophe ? > > > > Please change this so this code isn't duplicated. > > > > Jason > > > Hmm, didn't see the support. Would be great if there is. > The pattern itself is copied from tpm_tis_spi as is. > read_bytes/write_bytes were de-dup'ed as they used a lot of common code > (even more for this driver than for tpm_tis_spi). > But as for _readNN/_writeNN, there're only three of these functions, > so it din't seem too bad. If there isn't, please add a separate commit before this that adds an inline function to tpm_tis_core.h. /Jarkko