]> Pileus Git - ~andy/linux/commitdiff
USB: UHCI: Use ACCESS_ONCE rather than using a full compiler barrier
authorAlan Stern <stern@rowland.harvard.edu>
Wed, 18 May 2011 08:44:50 +0000 (10:44 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 19 May 2011 23:43:19 +0000 (16:43 -0700)
This patch (as1462) updates the special accessor functions defined in
uhci-hcd.h.  Rather than using a full compiler barrier, all we really
need is the ACCESS_ONCE() mechanism, because the idea is to force the
compiler to store a fixed copy of a possibly changing value.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/host/uhci-hcd.h

index 10b68a846f6534b4821cc133fc376bcb338df368..0deeab6c9e5668bf946e952416fb736318f1d738 100644 (file)
@@ -168,12 +168,7 @@ struct uhci_qh {
  * We need a special accessor for the element pointer because it is
  * subject to asynchronous updates by the controller.
  */
-static inline __le32 qh_element(struct uhci_qh *qh) {
-       __le32 element = qh->element;
-
-       barrier();
-       return element;
-}
+#define qh_element(qh)         ACCESS_ONCE((qh)->element)
 
 #define LINK_TO_QH(qh)         (UHCI_PTR_QH | cpu_to_le32((qh)->dma_handle))
 
@@ -263,12 +258,7 @@ struct uhci_td {
  * We need a special accessor for the control/status word because it is
  * subject to asynchronous updates by the controller.
  */
-static inline u32 td_status(struct uhci_td *td) {
-       __le32 status = td->status;
-
-       barrier();
-       return le32_to_cpu(status);
-}
+#define td_status(td)          le32_to_cpu(ACCESS_ONCE((td)->status))
 
 #define LINK_TO_TD(td)         (cpu_to_le32((td)->dma_handle))