public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcel Selhorst <tpm@selhorst.net>
To: Marcin Obara <marcin_obara@users.sourceforge.net>
Cc: tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tpm:correct tpm timeouts to jiffies conversion
Date: Wed, 02 Jul 2008 13:35:57 +0200	[thread overview]
Message-ID: <486B681D.5030605@selhorst.net> (raw)
In-Reply-To: <alpine.DEB.0.99.0806052204440.8295@ip-195-3-221-75.vnet.pl>

Acked-by: Marcel Selhorst <tpm@selhorst.net>

Marcin Obara schrieb:
> This patch fixes timeouts conversion to jiffies,
> by replacing msecs_to_jiffies() calls with usecs_to_jiffies().
> According to TCG TPM Specification Version 1.2 Revision 103 (pages 166, 167)
> TPM timeouts and durations are returned in microseconds (usec)
> not in miliseconds (msec).
> 
> Signed-off-by: Marcin Obara <marcin_obara@users.sourceforge.net>
> 
> --- linux/drivers/char/tpm/tpm.c	2008-06-05 20:57:06.000000000 +0200
> +++ linux_tpm/drivers/char/tpm/tpm.c	2008-06-05 20:54:52.000000000 +0200
> @@ -524,19 +524,19 @@ void tpm_get_timeouts(struct tpm_chip *c
>  	timeout =
>  	    be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_1_IDX)));
>  	if (timeout)
> -		chip->vendor.timeout_a = msecs_to_jiffies(timeout);
> +		chip->vendor.timeout_a = usecs_to_jiffies(timeout);
>  	timeout =
>  	    be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_2_IDX)));
>  	if (timeout)
> -		chip->vendor.timeout_b = msecs_to_jiffies(timeout);
> +		chip->vendor.timeout_b = usecs_to_jiffies(timeout);
>  	timeout =
>  	    be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_3_IDX)));
>  	if (timeout)
> -		chip->vendor.timeout_c = msecs_to_jiffies(timeout);
> +		chip->vendor.timeout_c = usecs_to_jiffies(timeout);
>  	timeout =
>  	    be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_4_IDX)));
>  	if (timeout)
> -		chip->vendor.timeout_d = msecs_to_jiffies(timeout);
> +		chip->vendor.timeout_d = usecs_to_jiffies(timeout);
>  
>  duration:
>  	memcpy(data, tpm_cap, sizeof(tpm_cap));
> @@ -553,15 +553,15 @@ duration:
>  		return;
>  
>  	chip->vendor.duration[TPM_SHORT] =
> -	    msecs_to_jiffies(be32_to_cpu
> +	    usecs_to_jiffies(be32_to_cpu
>  			     (*((__be32 *) (data +
>  					    TPM_GET_CAP_RET_UINT32_1_IDX))));
>  	chip->vendor.duration[TPM_MEDIUM] =
> -	    msecs_to_jiffies(be32_to_cpu
> +	    usecs_to_jiffies(be32_to_cpu
>  			     (*((__be32 *) (data +
>  					    TPM_GET_CAP_RET_UINT32_2_IDX))));
>  	chip->vendor.duration[TPM_LONG] =
> -	    msecs_to_jiffies(be32_to_cpu
> +	    usecs_to_jiffies(be32_to_cpu
>  			     (*((__be32 *) (data +
>  					    TPM_GET_CAP_RET_UINT32_3_IDX))));
>  }
> 

      reply	other threads:[~2008-07-02 11:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-05 20:19 [PATCH] tpm:correct tpm timeouts to jiffies conversion Marcin Obara
2008-07-02 11:35 ` Marcel Selhorst [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=486B681D.5030605@selhorst.net \
    --to=tpm@selhorst.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcin_obara@users.sourceforge.net \
    --cc=tpmdd-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox