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

From: Alan Cox
Date: Fri Dec 10 2004 - 16:53:43 EST


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


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/