Greg:

Rather than using a home-brewed test (dev->dma_mask != NULL) to
indicate which host controller devices use DMA, this patch (as770)
invokes the standard dma_supported() API and caches the result.

Alan Stern



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

---

This may be redundant; I don't know why the dma_mask pointer would be set 
if the device wasn't actually able to use DMA.  If you think this patch 
isn't needed, that's okay.  The third patch in the series would then need 
a small update.

Index: usb-2.6/drivers/usb/core/hcd.c
===================================================================
--- usb-2.6.orig/drivers/usb/core/hcd.c
+++ usb-2.6/drivers/usb/core/hcd.c
@@ -1152,7 +1152,7 @@ doit:
        /* lower level hcd code should use *_dma exclusively,
         * unless it uses pio or talks to another transport.
         */
-       if (hcd->self.controller->dma_mask) {
+       if (hcd->self.uses_dma) {
                if (usb_pipecontrol (urb->pipe)
                        && !(urb->transfer_flags & URB_NO_SETUP_DMA_MAP))
                        urb->setup_dma = dma_map_single (
@@ -1588,8 +1588,9 @@ void usb_hcd_giveback_urb (struct usb_hc
        at_root_hub = (urb->dev == hcd->self.root_hub);
        urb_unlink (urb);
 
-       /* lower level hcd code should use *_dma exclusively */
-       if (hcd->self.controller->dma_mask && !at_root_hub) {
+       /* lower level hcd code should use *_dma exclusively if the
+        * host controller does DMA */
+       if (hcd->self.uses_dma && !at_root_hub) {
                if (usb_pipecontrol (urb->pipe)
                        && !(urb->transfer_flags & URB_NO_SETUP_DMA_MAP))
                        dma_unmap_single (hcd->self.controller, urb->setup_dma,
@@ -1713,6 +1714,8 @@ struct usb_hcd *usb_create_hcd (const st
        hcd->self.release = &hcd_release;
        hcd->self.controller = dev;
        hcd->self.bus_name = bus_name;
+       hcd->self.uses_dma = (dev->dma_mask &&
+                       dma_supported(dev, *dev->dma_mask));
 
        init_timer(&hcd->rh_timer);
        hcd->rh_timer.function = rh_timer_func;
Index: usb-2.6/include/linux/usb.h
===================================================================
--- usb-2.6.orig/include/linux/usb.h
+++ usb-2.6/include/linux/usb.h
@@ -270,6 +270,7 @@ struct usb_bus {
        struct device *controller;      /* host/master side hardware */
        int busnum;                     /* Bus number (in order of reg) */
        char *bus_name;                 /* stable id (PCI slot_name etc) */
+       u8 uses_dma;                    /* Does the host controller use DMA? */
        u8 otg_port;                    /* 0, or number of OTG/HNP port */
        unsigned is_b_host:1;           /* true during some HNP roleswitches */
        unsigned b_hnp_enable:1;        /* OTG: did A-Host enable HNP? */


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to