public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Aravamudan <nacc@us.ibm.com>
To: Kylene Jo Hall <kjhall@us.ibm.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	akpm@osdl.org,
	TPM Device Driver List <tpmdd-devel@lists.sourceforge.net>,
	Leendert Van Doorn <leendert@us.ibm.com>
Subject: Re: [PATCH 7/7] tpm: Driver for next generation TPM chips
Date: Tue, 11 Apr 2006 16:05:05 -0700	[thread overview]
Message-ID: <20060411230505.GB21210@us.ibm.com> (raw)
In-Reply-To: <1144679848.4917.15.camel@localhost.localdomain>

On 10.04.2006 [09:37:28 -0500], Kylene Jo Hall wrote:
> This patch contains the driver for the next generation of TPM chips
> version 1.2 including support for interrupts.  The Trusted Computing
> Group has written the TPM Interface Specification (TIS) which defines a
> common interface for all manufacturer's 1.2 TPM's thus the name
> tpm_tis.
> 
> This updated version of the patch uses the new sysfs files that came
> about from the comments and changes in patch 6/7.  It replaces the 7/7
> patch from the original set.

<snip>

> +static int request_locality(struct tpm_chip *chip, int l)
> +{
> +	unsigned long stop;
> +
> +	if (check_locality(chip, l) >= 0)
> +		return l;
> +
> +	iowrite8(TPM_ACCESS_REQUEST_USE,
> +		 chip->vendor.iobase + TPM_ACCESS(l));
> +
> +	if (chip->vendor.irq) {
> +		interruptible_sleep_on_timeout(&chip->vendor.int_queue,
> +					       HZ *
> +					       chip->vendor.timeout_a /
> +					       1000);
> +		if (check_locality(chip, l) >= 0)
> +			return l;
> +
> +	} else {
> +		/* wait for burstcount */
> +		stop = jiffies + (HZ * chip->vendor.timeout_a / 1000);
> +		do {
> +			if (check_locality(chip, l) >= 0)
> +				return l;
> +			msleep(TPM_TIMEOUT);
> +		}
> +		while (time_before(jiffies, stop));
> +	}

This looks like it could take the msecs_to_jiffies() conversion as well.
Might as well cache it before the if/else, as both clauses use it?
Really, it is just wait_event*() without the wait-queue. Well, this is
at least one more consumer potentially of the poll_event*() API I had
written a while back, I'll dust it off again if I have the time.

<snip>

> +static int get_burstcount(struct tpm_chip *chip)
> +{
> +	unsigned long stop;
> +	int burstcnt;
> +
> +	/* wait for burstcount */
> +	/* which timeout value, spec has 2 answers (c & d) */
> +	stop = jiffies + (HZ * chip->vendor.timeout_d / 1000);

msecs_to_jiffies().

<snip>

With the changes you've already made, that should clean up the sleeping
code a bit, at least.

-- 
Nishanth Aravamudan <nacc@us.ibm.com>
IBM Linux Technology Center

  parent reply	other threads:[~2006-04-11 23:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-10 14:37 [PATCH 7/7] tpm: Driver for next generation TPM chips Kylene Jo Hall
2006-04-10 22:03 ` Andrew Morton
2006-04-11 20:15   ` [PATCH] tpm: update to use wait_event calls Kylene Jo Hall
2006-04-11 20:31     ` Nish Aravamudan
2006-04-11 22:32       ` [PATCH] tpm: use wait_event return code and msecs_to_jiffies Kylene Jo Hall
2006-04-11 20:40     ` [PATCH] tpm: update to use wait_event calls Ingo Oeser
2006-04-11 23:05 ` Nishanth Aravamudan [this message]
2006-04-12 17:29   ` [PATCH 7/7] tpm: Driver for next generation TPM chips Kylene Jo Hall
2006-04-12 17:32     ` Nishanth Aravamudan
2006-04-12 21:48       ` [PATCH] tpm: msecs_to_jiffies cleanups Kylene Jo Hall
  -- strict thread matches above, loose matches on Subject: below --
2006-04-05 19:48 [PATCH 7/7] tpm: Driver for next generation TPM chips Kylene Jo Hall
2006-04-03 16:42 Kylene Jo Hall

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=20060411230505.GB21210@us.ibm.com \
    --to=nacc@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=kjhall@us.ibm.com \
    --cc=leendert@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --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