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


Groups > linux.kernel > #1599670

Re: [tpmdd-devel] [PATCH 2/2] tpm: add sleep only for retry in i2c_nuvoton_write_status()

From Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [tpmdd-devel] [PATCH 2/2] tpm: add sleep only for retry in i2c_nuvoton_write_status()
Date 2017-03-13 19:30 +0100
Message-ID <tkCTf-4s7-1@gated-at.bofh.it> (permalink)
References <tjxLY-7Vp-17@gated-at.bofh.it> <tjxLY-7Vp-19@gated-at.bofh.it> <tkzC1-1Yl-1@gated-at.bofh.it>
Organization Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo

Show all headers | View raw


On Mon, Mar 13, 2017 at 10:54:22AM -0400, Mimi Zohar wrote:
> Hi Jarkko,
> 
> On Fri, 2017-03-10 at 13:45 -0500, Nayna Jain wrote:
> > Currently, there is an unnecessary 1 msec delay added in
> > i2c_nuvoton_write_status() for the successful case. This 
> > function is called multiple times during send() and recv(),
> > which implies adding multiple extra delays for every TPM
> > operation.
> > 
> > This patch calls usleep_range() only if retry is to be done.
> > 
> > Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
> > Cc: stable@vger.kernel.org (linux-4.8)
> > Reviewed-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
> 
> Either Reviewed-by/Acked-by is fine. 
> 
> Can you pick up this patch and replace the original version of "tpm:
> msleep() delays - replace with usleep_range()" with the one Nayna
> posted?
> 
> Thanks!
> 
> Mimi

Yes, sure. I'll try to get that done as soon as possible..

/Jarkko

> 
> > ---
> >  drivers/char/tpm/tpm_i2c_nuvoton.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
> > index 0c98c42..c642877 100644
> > --- a/drivers/char/tpm/tpm_i2c_nuvoton.c
> > +++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
> > @@ -124,8 +124,9 @@ static s32 i2c_nuvoton_write_status(struct i2c_client *client, u8 data)
> >  	/* this causes the current command to be aborted */
> >  	for (i = 0, status = -1; i < TPM_I2C_RETRY_COUNT && status < 0; i++) {
> >  		status = i2c_nuvoton_write_buf(client, TPM_STS, 1, &data);
> > -		usleep_range(TPM_I2C_BUS_DELAY, TPM_I2C_BUS_DELAY
> > -			     + TPM_I2C_DELAY_RANGE);
> > +		if (status < 0)
> > +			usleep_range(TPM_I2C_BUS_DELAY, TPM_I2C_BUS_DELAY
> > +				     + TPM_I2C_DELAY_RANGE);
> >  	}
> >  	return status;
> >  }
> 
> 

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


Thread

[PATCH v1 1/2] tpm: msleep() delays - replace with usleep_range() in i2c nuvoton driver Nayna Jain <nayna@linux.vnet.ibm.com> - 2017-03-10 19:50 +0100
  [PATCH 2/2] tpm: add sleep only for retry in i2c_nuvoton_write_status() Nayna Jain <nayna@linux.vnet.ibm.com> - 2017-03-10 19:50 +0100
    Re: [tpmdd-devel] [PATCH 2/2] tpm: add sleep only for retry in  i2c_nuvoton_write_status() Mimi Zohar <zohar@linux.vnet.ibm.com> - 2017-03-13 16:00 +0100
      Re: [tpmdd-devel] [PATCH 2/2] tpm: add sleep only for retry in  i2c_nuvoton_write_status() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-03-13 19:30 +0100
    Re: [PATCH 2/2] tpm: add sleep only for retry in  i2c_nuvoton_write_status() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-03-17 20:10 +0100
  Re: [PATCH v1 1/2] tpm: msleep() delays - replace with  usleep_range() in i2c nuvoton driver Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-03-15 17:00 +0100
    Re: [PATCH v1 1/2] tpm: msleep() delays - replace with usleep_range()  in i2c nuvoton driver Nayna <nayna@linux.vnet.ibm.com> - 2017-03-15 17:30 +0100
      Re: [PATCH v1 1/2] tpm: msleep() delays - replace with  usleep_range() in i2c nuvoton driver Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-03-15 19:00 +0100
  Re: [PATCH v1 1/2] tpm: msleep() delays - replace with  usleep_range() in i2c nuvoton driver Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-03-17 20:10 +0100

csiph-web