USB2 patches

M. Warner Losh imp at bsdimp.com
Sun Feb 1 11:57:36 PST 2009


In message: <20090201191851.GE32503 at citylink.fud.org.nz>
            Andrew Thompson <thompsa at freebsd.org> writes:
: > > xxx_set_channel()
: > > {
: > > 	ieee80211_channel c = wlan->curchan;
: > >
: > > 	hw_reg = array1[c];
: > > 	write USB register;
: > > 	hw_reg = array2[c];
: > > 	write USB register;
: > > }
: > 
: > And don't forget "volatile" ...
: 
: I dont understand this. c is a pointer to a valid net80211 channel which
: will never disappear.

"volatile" would be a bug here.  There's no reason to use it at all,
since wlan->curchan doesn't match what ANSI-C says a volatile is for.
In addition, since it is only loaded once, there wouldn't be a need
for it even if it did meet the definition.

You *CANNOT* rely on 'volatile' fixing locking issues.

Warner


More information about the freebsd-usb mailing list