Commit 35d07fd5 authored by Tony Lindgren's avatar Tony Lindgren Committed by Greg Kroah-Hartman
Browse files

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: default avatarTony Lindgren <>
Signed-off-by: default avatarDavid Brownell <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent ebc3ac14
......@@ -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);
io->urbs[i]->transfer_buffer = NULL;
io->urbs[i]->transfer_buffer =
page_address(sg[i].page) + sg[i].offset;
} else {
/* hc may use _only_ transfer_buffer */
io->urbs [i]->transfer_buffer =
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment