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

Alan Cox
2004-12-10T21:50:25Z

On Iau, 2004-12-09 at 15:48, Arjan van de Ven wrote:
> > + /* wait for status */
> > + add_timer(&status_timer);
> > + do {
> > + schedule();
> > + status = inb(chip->base + NSC_STATUS);
> > + if (status & NSC_STATUS_OBF)
> > + status = inb(chip->base + NSC_DATA);
> > + if (status & NSC_STATUS_RDY) {
> > + del_singleshot_timer_sync(&status_timer);
> > + return 0;
> > + }
> > + } while (!expired);
>
> same comment. Also the timer handling looks suspect... can you guarantee
> 100% sure that the timer is gone when the while falls through ?

Yes but you can't be sure it ever will - needs an "rmb()" barrier so
that the compiler doesn't sneak off and optimise expired