> === after conversion
> struct bus_master_interface *interface;
> while (interface->ack != OK) { 
>         delay(a short while);
>         rmb(); 
>         [ after X loops device changes interface->ack by dma ]
> };
> 
> All I need is for the read of interface->ack in the loop not to be optimised 
> away - is rmb() the appropriate incantation to achieve this?

Yes - ish.  You want the equivalent of 

        do {
                rmb();
                if (interface->ack == OK)
                        break;
        } while(1);

(eg putting another rmb before the while in your case)

You want a barrier before the *first* read in case the
compiler has managed to cache the value before you enter the loop.


> struct bus_master_interface *interface;
> interface->cmd = command;
> wmb();
> iowrite(device_interrupt, 1);

Yes.

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

Reply via email to