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. > > Below is what I try to do in usb driver: > wmb (); > 389c: 0000000f sync > dummy->hw_token = token; > 38a0: ae740008 sw s4,8(s3) > tmp = dummy->hw_token; > 38a4: afb40010 sw s4,16(sp) > as you can see, the compiler is so smart that he read the register > content instead of re-read the memory for accelerating the read speed. > unfortunately, that isn't I want. Is there already exist kernel API can help me? > appreciate your help, You can try doing: tmp = ACCESS_ONCE(dummy->hw_token); Alan Stern -- 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