Re: is there dummy r/w in mips kernel API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Sun, 2 Jan 2011, loody wrote:
> 
> > Dear all:
> > I am trying porting usb on mips platform.
> > Due to hw limitation, I have to do the dummy read to make sure data
> > has been written to the memory, so I announce an volatile parameter,
> > tmp, such that cpu will read the same address back to me.

Unfortunately that is not of any use, as you noted. The "volatile"
nature of your parameter "tmp" is irrelevant. If you want to prevent
the compiler optimising out the read of what you've just written then
it's what you just wrote that needs to be "volatile". So if the
variable "dummy" is yours, then it should be declared as a
pointer-to-volatile-struct rather than just pointer-to-struct.

The rule we use in my embedded programming day-job is that any variable
that maps a hardware port must be declared volatile, and any pointer
used to access a hardware port must be a pointer-to-volatile.

I'm sure Alan's solution would be fine. I offer the above comments
because the problem may arise outside of an environment where
ACCESS_ONCE is available.

Cheers,
Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux