diff options
author | Kylene Jo Hall <kjhall@us.ibm.com> | 2006-04-22 02:38:19 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-22 09:19:54 -0700 |
commit | 36b20020e537036c4f9eb5b69140c88ead5da7dc (patch) | |
tree | 71a83d0da45630fe3c3a69c446823716164fbcc1 /drivers/char/tpm/tpm.c | |
parent | 27084efee0c3dc0eb15b5ed750aa9f1adb3983c3 (diff) | |
download | kernel_goldelico_gta04-36b20020e537036c4f9eb5b69140c88ead5da7dc.zip kernel_goldelico_gta04-36b20020e537036c4f9eb5b69140c88ead5da7dc.tar.gz kernel_goldelico_gta04-36b20020e537036c4f9eb5b69140c88ead5da7dc.tar.bz2 |
[PATCH] tpm: msecs_to_jiffies cleanups
The timeout and duration values used in the tpm driver are not exposed to
userspace. This patch converts the storage units to jiffies with
msecs_to_jiffies. They were always being used in jiffies so this
simplifies things removing the need for calculation all over the place.
The change necessitated a type change in the tpm_chip struct to hold
jiffies.
Signed-off-by: Kylie Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/tpm/tpm.c')
-rw-r--r-- | drivers/char/tpm/tpm.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 150c86a..160dc08 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c @@ -354,7 +354,7 @@ unsigned long tpm_calc_ordinal_duration(struct tpm_chip *chip, TPM_PROTECTED_ORDINAL_MASK]; if (duration_idx != TPM_UNDEFINED) - duration = chip->vendor.duration[duration_idx] * HZ / 1000; + duration = chip->vendor.duration[duration_idx]; if (duration <= 0) return 2 * 60 * HZ; else @@ -524,19 +524,19 @@ void tpm_get_timeouts(struct tpm_chip *chip) timeout = be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_1_IDX))); if (timeout) - chip->vendor.timeout_a = timeout; + chip->vendor.timeout_a = msecs_to_jiffies(timeout); timeout = be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_2_IDX))); if (timeout) - chip->vendor.timeout_b = timeout; + chip->vendor.timeout_b = msecs_to_jiffies(timeout); timeout = be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_3_IDX))); if (timeout) - chip->vendor.timeout_c = timeout; + chip->vendor.timeout_c = msecs_to_jiffies(timeout); timeout = be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_4_IDX))); if (timeout) - chip->vendor.timeout_d = timeout; + chip->vendor.timeout_d = msecs_to_jiffies(timeout); duration: memcpy(data, tpm_cap, sizeof(tpm_cap)); @@ -553,11 +553,17 @@ duration: return; chip->vendor.duration[TPM_SHORT] = - be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_1_IDX))); + msecs_to_jiffies(be32_to_cpu + (*((__be32 *) (data + + TPM_GET_CAP_RET_UINT32_1_IDX)))); chip->vendor.duration[TPM_MEDIUM] = - be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_2_IDX))); + msecs_to_jiffies(be32_to_cpu + (*((__be32 *) (data + + TPM_GET_CAP_RET_UINT32_2_IDX)))); chip->vendor.duration[TPM_LONG] = - be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_3_IDX))); + msecs_to_jiffies(be32_to_cpu + (*((__be32 *) (data + + TPM_GET_CAP_RET_UINT32_3_IDX)))); } EXPORT_SYMBOL_GPL(tpm_get_timeouts); |