Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=35d07fd58f47284adecf219d3b73e4ea197cf29f
Commit:     35d07fd58f47284adecf219d3b73e4ea197cf29f
Parent:     ebc3ac149bf3a20c235625f1c07e0f997b3e08ba
Author:     Tony Lindgren <[EMAIL PROTECTED]>
AuthorDate: Sat Mar 31 18:15:43 2007 -0700
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Fri Apr 27 13:28:39 2007 -0700

    USB: Allow transfer_buffer with transfer_dma
    
    Some host controller drivers may need a PIO fallback when a DMA channel
    is temporarily unavailable.  This patch provides an address that such
    drivers can use for PIO in those cases, and nulls that field out when
    no such address is available (highmem) which should help usbmon.
    
    Signed-off-by: Tony Lindgren <[EMAIL PROTECTED]>
    Signed-off-by: David Brownell <[EMAIL PROTECTED]>
    Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/usb/core/message.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index da4ee07..b743478 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -412,10 +412,24 @@ int usb_sg_init (
                io->urbs [i]->status = -EINPROGRESS;
                io->urbs [i]->actual_length = 0;
 
+               /*
+                * Some systems need to revert to PIO when DMA is temporarily
+                * unavailable.  For their sakes, both transfer_buffer and
+                * transfer_dma are set when possible.  However this can only
+                * work on systems without HIGHMEM, since DMA buffers located
+                * in high memory are not directly addressable by the CPU for
+                * PIO ... so when HIGHMEM is in use, transfer_buffer is NULL
+                * to prevent stale pointers and to help spot bugs.
+                */
                if (dma) {
-                       /* hc may use _only_ transfer_dma */
                        io->urbs [i]->transfer_dma = sg_dma_address (sg + i);
                        len = sg_dma_len (sg + i);
+#ifdef CONFIG_HIGHMEM
+                       io->urbs[i]->transfer_buffer = NULL;
+#else
+                       io->urbs[i]->transfer_buffer =
+                               page_address(sg[i].page) + sg[i].offset;
+#endif
                } else {
                        /* hc may use _only_ transfer_buffer */
                        io->urbs [i]->transfer_buffer =
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to