staging: octeon-usb: cvmx_usb_submit_control: get params from urb
Get the transfer parameters from urb. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9ccca70718
commit
2ae09e8721
@ -2474,45 +2474,27 @@ static int cvmx_usb_submit_interrupt(struct cvmx_usb_state *usb,
|
|||||||
* @usb: USB device state populated by cvmx_usb_initialize().
|
* @usb: USB device state populated by cvmx_usb_initialize().
|
||||||
* @pipe_handle:
|
* @pipe_handle:
|
||||||
* Handle to the pipe for the transfer.
|
* Handle to the pipe for the transfer.
|
||||||
* @control_header:
|
* @urb: URB.
|
||||||
* USB 8 byte control header physical address.
|
|
||||||
* Note that this is NOT A POINTER, but the
|
|
||||||
* full 64bit physical address of the buffer.
|
|
||||||
* @buffer: Physical address of the data buffer in
|
|
||||||
* memory. Note that this is NOT A POINTER, but
|
|
||||||
* the full 64bit physical address of the
|
|
||||||
* buffer. This may be zero if buffer_length is
|
|
||||||
* zero.
|
|
||||||
* @buffer_length:
|
|
||||||
* Length of buffer in bytes.
|
|
||||||
* @urb: URB returned when the callback is called.
|
|
||||||
*
|
*
|
||||||
* Returns: A submitted transaction handle or negative on
|
* Returns: A submitted transaction handle or negative on
|
||||||
* failure. Negative values are error codes.
|
* failure. Negative values are error codes.
|
||||||
*/
|
*/
|
||||||
static int cvmx_usb_submit_control(struct cvmx_usb_state *usb,
|
static int cvmx_usb_submit_control(struct cvmx_usb_state *usb, int pipe_handle,
|
||||||
int pipe_handle, uint64_t control_header,
|
|
||||||
uint64_t buffer, int buffer_length,
|
|
||||||
struct urb *urb)
|
struct urb *urb)
|
||||||
{
|
{
|
||||||
int submit_handle;
|
int submit_handle;
|
||||||
|
int buffer_length = urb->transfer_buffer_length;
|
||||||
|
uint64_t control_header = urb->setup_dma;
|
||||||
union cvmx_usb_control_header *header =
|
union cvmx_usb_control_header *header =
|
||||||
cvmx_phys_to_ptr(control_header);
|
cvmx_phys_to_ptr(control_header);
|
||||||
|
|
||||||
/* Pipe handle checking is done later in a common place */
|
/* Pipe handle checking is done later in a common place */
|
||||||
if (unlikely(!control_header))
|
|
||||||
return -EINVAL;
|
|
||||||
/* Some drivers send a buffer with a zero length. God only knows why */
|
|
||||||
if (unlikely(buffer && (buffer_length < 0)))
|
|
||||||
return -EINVAL;
|
|
||||||
if (unlikely(!buffer && (buffer_length != 0)))
|
|
||||||
return -EINVAL;
|
|
||||||
if ((header->s.request_type & 0x80) == 0)
|
if ((header->s.request_type & 0x80) == 0)
|
||||||
buffer_length = le16_to_cpu(header->s.length);
|
buffer_length = le16_to_cpu(header->s.length);
|
||||||
|
|
||||||
submit_handle = __cvmx_usb_submit_transaction(usb, pipe_handle,
|
submit_handle = __cvmx_usb_submit_transaction(usb, pipe_handle,
|
||||||
CVMX_USB_TRANSFER_CONTROL,
|
CVMX_USB_TRANSFER_CONTROL,
|
||||||
buffer,
|
urb->transfer_dma,
|
||||||
buffer_length,
|
buffer_length,
|
||||||
control_header,
|
control_header,
|
||||||
0, /* iso_start_frame */
|
0, /* iso_start_frame */
|
||||||
@ -3471,10 +3453,7 @@ static int octeon_usb_urb_enqueue(struct usb_hcd *hcd,
|
|||||||
dev_dbg(dev, "Submit control to %d.%d\n",
|
dev_dbg(dev, "Submit control to %d.%d\n",
|
||||||
usb_pipedevice(urb->pipe), usb_pipeendpoint(urb->pipe));
|
usb_pipedevice(urb->pipe), usb_pipeendpoint(urb->pipe));
|
||||||
submit_handle = cvmx_usb_submit_control(&priv->usb, pipe_handle,
|
submit_handle = cvmx_usb_submit_control(&priv->usb, pipe_handle,
|
||||||
urb->setup_dma,
|
urb);
|
||||||
urb->transfer_dma,
|
|
||||||
urb->transfer_buffer_length,
|
|
||||||
urb);
|
|
||||||
break;
|
break;
|
||||||
case PIPE_BULK:
|
case PIPE_BULK:
|
||||||
dev_dbg(dev, "Submit bulk to %d.%d\n",
|
dev_dbg(dev, "Submit bulk to %d.%d\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user