Greg:

This patch adds "volatile" to a couple of declarations for fields in the 
UHCI driver that are susceptible to outside change by DMA.  Without this 
or some similar approach to defeat gcc's optimizer, the compiler will 
generate incorrect references to these fields.

Please apply.

Alan Stern



Signed-off-by: Alan Stern <[EMAIL PROTECTED]>

===== drivers/usb/host/uhci-hcd.c 1.150 vs edited =====
--- 1.150/drivers/usb/host/uhci-hcd.c   2004-12-18 10:22:52 -05:00
+++ edited/drivers/usb/host/uhci-hcd.c  2005-01-03 10:21:16 -05:00
@@ -236,11 +236,11 @@
 {
        struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
        struct uhci_td *td;
-       u32 *plink;
+       __le32 *plink;
 
        /* Ordering isn't important here yet since the QH hasn't been */
        /* inserted into the schedule yet */
-       plink = &qh->element;
+       plink = (__le32 *) &qh->element;
        list_for_each_entry(td, &urbp->td_list, list) {
                *plink = cpu_to_le32(td->dma_handle) | breadth;
                plink = &td->link;
===== drivers/usb/host/uhci-hcd.h 1.43 vs edited =====
--- 1.43/drivers/usb/host/uhci-hcd.h    2004-12-18 10:22:52 -05:00
+++ edited/drivers/usb/host/uhci-hcd.h  2005-01-03 10:21:16 -05:00
@@ -106,7 +106,7 @@
 struct uhci_qh {
        /* Hardware fields */
        __le32 link;                    /* Next queue */
-       __le32 element;                 /* Queue element pointer */
+       __le32 volatile element;        /* Queue element pointer */
 
        /* Software fields */
        dma_addr_t dma_handle;
@@ -186,7 +186,7 @@
 struct uhci_td {
        /* Hardware fields */
        __le32 link;
-       __le32 status;
+       __le32 volatile status;
        __le32 token;
        __le32 buffer;
 



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to