On Mon, 12 Dec 2005, Jeff Garzik wrote: > Greg Kroah-Hartman wrote: > > From: Alan Stern <[EMAIL PROTECTED]> > > > > This patch (as617) adds a couple of memory barriers that Ben H. forgot in > > his recent suspend/resume fix. > > > > Signed-off-by: Alan Stern <[EMAIL PROTECTED]> > > Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> > > > > --- > > drivers/usb/host/uhci-hcd.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > --- greg-2.6.orig/drivers/usb/host/uhci-hcd.c > > +++ greg-2.6/drivers/usb/host/uhci-hcd.c > > @@ -717,6 +717,7 @@ static int uhci_suspend(struct usb_hcd * > > * at the source, so we must turn off PIRQ. > > */ > > pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0); > > + mb(); > > clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); > > uhci->hc_inaccessible = 1; > > hcd->poll_rh = 0; > > @@ -738,6 +739,7 @@ static int uhci_resume(struct usb_hcd *h > > * really don't want to keep a stale HCD_FLAG_HW_ACCESSIBLE=0 > > */ > > set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); > > + mb(); > > Are these just guesses, or what?
There's no need for sarcasm. No, they are not guesses. Ask Ben Herrenschmidt if you don't believe me. > Why not smp_mb__before_clear_bit() or smp_mb__after_clear_bit() ? Because the code needs to synchronize not with another CPU, but with a USB host controller. Those barriers are necessary even on a UP system. By the way, what's the idea with this proliferation of little not-all-that-helpful routines, like smp_mb__before_clear_bit()? Are there architectures on which smp_mb__before_clear_bit(...); is significantly superior to smp_mb(); clear_bit(...); ? (It's certainly not easier to type.) Is this difference worth noting, considering how infrequently clear_bit() gets used? Alan Stern ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel