aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm.c
diff options
context:
space:
mode:
authorKylene Jo Hall <kjhall@us.ibm.com>2006-04-22 05:38:19 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-22 12:19:54 -0400
commit36b20020e537036c4f9eb5b69140c88ead5da7dc (patch)
tree71a83d0da45630fe3c3a69c446823716164fbcc1 /drivers/char/tpm/tpm.c
parent27084efee0c3dc0eb15b5ed750aa9f1adb3983c3 (diff)
[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.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 150c86af7809..160dc080d580 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,
354 TPM_PROTECTED_ORDINAL_MASK]; 354 TPM_PROTECTED_ORDINAL_MASK];
355 355
356 if (duration_idx != TPM_UNDEFINED) 356 if (duration_idx != TPM_UNDEFINED)
357 duration = chip->vendor.duration[duration_idx] * HZ / 1000; 357 duration = chip->vendor.duration[duration_idx];
358 if (duration <= 0) 358 if (duration <= 0)
359 return 2 * 60 * HZ; 359 return 2 * 60 * HZ;
360 else 360 else
@@ -524,19 +524,19 @@ void tpm_get_timeouts(struct tpm_chip *chip)
524 timeout = 524 timeout =
525 be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_1_IDX))); 525 be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_1_IDX)));
526 if (timeout) 526 if (timeout)
527 chip->vendor.timeout_a = timeout; 527 chip->vendor.timeout_a = msecs_to_jiffies(timeout);
528 timeout = 528 timeout =
529 be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_2_IDX))); 529 be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_2_IDX)));
530 if (timeout) 530 if (timeout)
531 chip->vendor.timeout_b = timeout; 531 chip->vendor.timeout_b = msecs_to_jiffies(timeout);
532 timeout = 532 timeout =
533 be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_3_IDX))); 533 be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_3_IDX)));
534 if (timeout) 534 if (timeout)
535 chip->vendor.timeout_c = timeout; 535 chip->vendor.timeout_c = msecs_to_jiffies(timeout);
536 timeout = 536 timeout =
537 be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_4_IDX))); 537 be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_4_IDX)));
538 if (timeout) 538 if (timeout)
539 chip->vendor.timeout_d = timeout; 539 chip->vendor.timeout_d = msecs_to_jiffies(timeout);
540 540
541duration: 541duration:
542 memcpy(data, tpm_cap, sizeof(tpm_cap)); 542 memcpy(data, tpm_cap, sizeof(tpm_cap));
@@ -553,11 +553,17 @@ duration:
553 return; 553 return;
554 554
555 chip->vendor.duration[TPM_SHORT] = 555 chip->vendor.duration[TPM_SHORT] =
556 be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_1_IDX))); 556 msecs_to_jiffies(be32_to_cpu
557 (*((__be32 *) (data +
558 TPM_GET_CAP_RET_UINT32_1_IDX))));
557 chip->vendor.duration[TPM_MEDIUM] = 559 chip->vendor.duration[TPM_MEDIUM] =
558 be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_2_IDX))); 560 msecs_to_jiffies(be32_to_cpu
561 (*((__be32 *) (data +
562 TPM_GET_CAP_RET_UINT32_2_IDX))));
559 chip->vendor.duration[TPM_LONG] = 563 chip->vendor.duration[TPM_LONG] =
560 be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_3_IDX))); 564 msecs_to_jiffies(be32_to_cpu
565 (*((__be32 *) (data +
566 TPM_GET_CAP_RET_UINT32_3_IDX))));
561} 567}
562EXPORT_SYMBOL_GPL(tpm_get_timeouts); 568EXPORT_SYMBOL_GPL(tpm_get_timeouts);
563 569