public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Handling of bounce buffers by rh_call_control
@ 2003-12-17 11:41 Richard Curnow
  2003-12-17 16:29 ` David Brownell
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Curnow @ 2003-12-17 11:41 UTC (permalink / raw)
  To: David Brownell, Greg KH; +Cc: Linux Kernel Mailing List

The following patch

===== drivers/usb/hcd.c 1.10 vs edited =====
--- 1.10/drivers/usb/hcd.c      Mon Mar 31 14:22:42 2003
+++ edited/drivers/usb/hcd.c    Wed Dec 17 11:26:53 2003
@@ -323,7 +323,7 @@
        struct usb_ctrlrequest *cmd = (struct usb_ctrlrequest *) urb->setup_packet;
        u16             typeReq, wValue, wIndex, wLength;
        const u8        *bufp = 0;
-       u8              *ubuf = urb->transfer_buffer;
+       u8              *ubuf = (u8 *) urb->transfer_dma;
        int             len = 0;
 
        typeReq  = (cmd->bRequestType << 8) | cmd->bRequest;

seems to be needed to make the following code later in the function work

	if (bufp) {
		if (urb->transfer_buffer_length < len)
			len = urb->transfer_buffer_length;
		urb->actual_length = len;
		// always USB_DIR_IN, toward host
		memcpy (ubuf, bufp, len);
	}

in the case where bounce buffers are being used to implement PCI DMA
operations.  Without the patch, the subsequent pci_unmap_single copies
the contents of the bounce buffer over the top of urb->transfer_buffer,
destroying what the memcpy() put there.

My USB knowledge is pretty limited, so I've no idea whether this patch
adversely affects anything else in rh_call_control.

The patch is against 2.4.23-pre-something, but I see the code's the same
in 2.6.

-- 
Richard \\\ SH-4/SH-5 Core & Debug Architect
Curnow  \\\         SuperH (UK) Ltd, Bristol

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-12-30 11:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-17 11:41 Handling of bounce buffers by rh_call_control Richard Curnow
2003-12-17 16:29 ` David Brownell
2003-12-17 22:47   ` bill davidsen
     [not found]   ` <200312172247.RAA08325@gatekeeper.tmr.com>
2003-12-18  2:40     ` David Brownell
2003-12-18 14:32   ` Richard Curnow
2003-12-18 14:53     ` iproute2 and 2.6.0 kernel Remus
2003-12-22 19:07       ` bill davidsen
2003-12-30 11:31       ` Remus
2003-12-18 15:36     ` Handling of bounce buffers by rh_call_control David Brownell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox