aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2011-05-18 04:44:50 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-05-19 19:43:19 -0400
commitbab1ff1bda27e654dfd382a1fbdfcda1f7ed0a37 (patch)
tree9ff9d83fa7f81eecd5569c0bd9089ea39da3880a /drivers/usb
parent8452c6745e74384e7e434144f989ada3eae41170 (diff)
USB: UHCI: Use ACCESS_ONCE rather than using a full compiler barrier
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>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/uhci-hcd.h14
1 files changed, 2 insertions, 12 deletions
diff --git a/drivers/usb/host/uhci-hcd.h b/drivers/usb/host/uhci-hcd.h
index 10b68a846f65..0deeab6c9e56 100644
--- a/drivers/usb/host/uhci-hcd.h
+++ b/drivers/usb/host/uhci-hcd.h
@@ -168,12 +168,7 @@ struct uhci_qh {
168 * We need a special accessor for the element pointer because it is 168 * We need a special accessor for the element pointer because it is
169 * subject to asynchronous updates by the controller. 169 * subject to asynchronous updates by the controller.
170 */ 170 */
171static inline __le32 qh_element(struct uhci_qh *qh) { 171#define qh_element(qh) ACCESS_ONCE((qh)->element)
172 __le32 element = qh->element;
173
174 barrier();
175 return element;
176}
177 172
178#define LINK_TO_QH(qh) (UHCI_PTR_QH | cpu_to_le32((qh)->dma_handle)) 173#define LINK_TO_QH(qh) (UHCI_PTR_QH | cpu_to_le32((qh)->dma_handle))
179 174
@@ -263,12 +258,7 @@ struct uhci_td {
263 * We need a special accessor for the control/status word because it is 258 * We need a special accessor for the control/status word because it is
264 * subject to asynchronous updates by the controller. 259 * subject to asynchronous updates by the controller.
265 */ 260 */
266static inline u32 td_status(struct uhci_td *td) { 261#define td_status(td) le32_to_cpu(ACCESS_ONCE((td)->status))
267 __le32 status = td->status;
268
269 barrier();
270 return le32_to_cpu(status);
271}
272 262
273#define LINK_TO_TD(td) (cpu_to_le32((td)->dma_handle)) 263#define LINK_TO_TD(td) (cpu_to_le32((td)->dma_handle))
274 264