Re: [PATCH] tpm: update to use wait_event calls

Ingo Oeser
2006-04-11T20:42:24Z

Hi Kylene,

On Tuesday, 11. April 2006 22:15, Kylene Jo Hall wrote:
> Signed-off-by: Kylie Hall <kjhall@us.ibm.com>
> ---
> drivers/char/tpm/tpm_tis.c | 15 +++++++++------
> 1 files changed, 9 insertions(+), 6 deletions(-)
>
> --- linux-2.6.17-rc1/drivers/char/tpm/tpm_tis.c 2006-04-11 12:18:35.573996500 -0500
> +++ linux-2.6.16-44/drivers/char/tpm/tpm_tis.c 2006-04-11 14:00:04.341229250 -0500
> @@ -95,10 +95,10 @@ static int request_locality(struct tpm_c
> chip->vendor.iobase + TPM_ACCESS(l));
>
> if (chip->vendor.irq) {
> - interruptible_sleep_on_timeout(&chip->vendor.int_queue,
> - HZ *
> - chip->vendor.timeout_a /
> - 1000);
> + wait_event_interruptible_timeout(chip->vendor.int_queue,
> + (check_locality(chip, l) >= 0),
> + HZ * chip->vendor.timeout_a /
> + 1000);
> if (check_locality(chip, l) >= 0)
> return l;

what about using msecs_to_jiffies(chip->vendor.timeout_a) for this?

>
> @@ -150,7 +150,7 @@ static int get_burstcount(struct tpm_chi
> }
>
> static int wait_for_stat(struct tpm_chip *chip, u8 mask, u32 timeout,
> - wait_queue_head_t * queue)
> + wait_queue_head_t *queue)
> {
> unsigned long stop;
> u8 status;
> @@ -161,7 +161,10 @@ static int wait_for_stat(struct tpm_chip
> return 0;
>
> if (chip->vendor.irq) {
> - interruptible_sleep_on_timeout(queue, HZ * timeout / 1000);
> + wait_event_interruptible_timeout(*queue,
> + ((tpm_tis_status(chip) &
> + mask) == mask),
> + HZ * timeout / 1000);
> status = tpm_tis_status(chip);
> if ((status & mask) == mask)
> return 0;

msecs_to_jiffies(timeout)?

Regards

Ingo Oeser