This patch makes the hub status irq DMA-aware, by pre-allocating the 
transfer buffer in consistent memory.  Unfortunately, there doesn't seem 
to be an easy way to do the same for the status report buffers.

Alan Stern


# This is a BitKeeper generated patch for the following project:
# Project Name: greg k-h's linux 2.5 USB kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#                  ChangeSet    1.1647  -> 1.1648 
#       drivers/usb/core/hub.h  1.18    -> 1.19   
#       drivers/usb/core/hub.c  1.107   -> 1.108  
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/06/09      [EMAIL PROTECTED]       1.1648
# Make hub status interrupt requests DMA-aware.
# --------------------------------------------
#
diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c    Mon Jun  9 12:15:48 2003
+++ b/drivers/usb/core/hub.c    Mon Jun  9 12:15:48 2003
@@ -302,9 +302,10 @@
        int maxp, ret;
        char *message;
 
-       hub->buffer = kmalloc(sizeof(*hub->buffer), GFP_KERNEL);
+       hub->buffer = usb_buffer_alloc(dev, sizeof(*hub->buffer), GFP_KERNEL,
+                       &hub->buffer_dma);
        if (!hub->buffer) {
-               message = "can't kmalloc hub irq buffer";
+               message = "can't allocate hub irq buffer";
                ret = -ENOMEM;
                goto fail;
        }
@@ -459,6 +460,8 @@
 
        usb_fill_int_urb(hub->urb, dev, pipe, *hub->buffer, maxp, hub_irq,
                hub, endpoint->bInterval);
+       hub->urb->transfer_dma = hub->buffer_dma;
+       hub->urb->transfer_flags |= URB_NO_DMA_MAP;
        ret = usb_submit_urb(hub->urb, GFP_KERNEL);
        if (ret) {
                message = "couldn't submit status urb";
@@ -522,7 +525,9 @@
        }
 
        if (hub->buffer) {
-               kfree(hub->buffer);
+               usb_buffer_free(interface_to_usbdev(intf),
+                               sizeof(*hub->buffer), hub->buffer,
+                               hub->buffer_dma);
                hub->buffer = NULL;
        }
 
diff -Nru a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h
--- a/drivers/usb/core/hub.h    Mon Jun  9 12:15:48 2003
+++ b/drivers/usb/core/hub.h    Mon Jun  9 12:15:48 2003
@@ -175,6 +175,7 @@
 
        /* buffer for urb ... 1 bit each for hub and children, rounded up */
        char                    (*buffer)[(USB_MAXCHILDREN + 1 + 7) / 8];
+       dma_addr_t              buffer_dma;     /* DMA address for buffer */
        union {
                struct usb_hub_status   hub;
                struct usb_port_status  port;



-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to