Re: [PATCH 1/1] driver: Tpm hardware enablement

Nish Aravamudan
2004-12-11T08:32:00Z

On Thu, 09 Dec 2004 11:06:27 -0600, Kylie Hall <kjhall@us.ibm.com> wrote:
> On Thu, 2004-12-09 at 09:48, Arjan van de Ven wrote:
>
>
> > On Thu, 2004-12-09 at 09:25 -0600, Kylene Hall wrote:
> > > + /* wait for status */
> > > + add_timer(&status_timer);
> > > + do {
> > > + schedule();
> > > + *data = inb(chip->base + 1);
> > > + if ((*data & mask) == val) {
> > > + del_singleshot_timer_sync(&status_timer);
> > > + return 0;
> > > + }
> > > + } while (!expired);
> >
> > this is busy waiting. Can't you do it with msleep() or some such ?
> > Or like 100 iterations without delays (in case the chip returns fast),
> > and then start sleeping, but please do sleep for a real time, not just
> > yield the cpu. Powermanagement and lots of other things really like to
> > see that.
> I don't see a problem with changing the schedule to an msleep. I'll
> change it.

Keep in mind that msleep() will ignore all signals & waitqueue events
(the latter doesn't apply here, I don't think) until the specified
number of milliseconds has gone by. msleep_interruptible() may be
preferrable, as you will then receive signals (but still not waitqueue
events). I'm actually not sure if either of these will do what you
need as the existing code does. You may just want to use
schedule_timeout() appropriately, with the remaining time you wish to
sleep for.

-Nish