Commit 31e6a5bf authored by Luca Ellero's avatar Luca Ellero Committed by Greg Kroah-Hartman

staging: ced1401: fix ced_stage_chunk()

Rename camel case arguments and locals in function ced_stage_chunk()
Signed-off-by: default avatarLuca Ellero <luca.ellero@brickedbrain.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1b6cb7eb
...@@ -761,12 +761,15 @@ static void staged_callback(struct urb *urb) ...@@ -761,12 +761,15 @@ static void staged_callback(struct urb *urb)
****************************************************************************/ ****************************************************************************/
static int ced_stage_chunk(struct ced_data *ced) static int ced_stage_chunk(struct ced_data *ced)
{ {
int iReturn = U14ERR_NOERROR; int retval = U14ERR_NOERROR;
unsigned int ChunkSize; unsigned int chunk_size;
int nPipe = ced->staged_read ? 3 : 2; /* The pipe number to use for reads or writes */ int pipe = ced->staged_read ? 3 : 2; /* The pipe number to use for */
/* reads or writes */
if (ced->n_pipes == 3) if (ced->n_pipes == 3)
nPipe--; /* Adjust for the 3-pipe case */ pipe--; /* Adjust for the 3-pipe case */
if (nPipe < 0) /* and trap case that should never happen */
if (pipe < 0) /* and trap case that should never happen */
return U14ERR_FAIL; return U14ERR_FAIL;
if (!can_accept_io_requests(ced)) { /* got sudden remove? */ if (!can_accept_io_requests(ced)) { /* got sudden remove? */
...@@ -775,34 +778,40 @@ static int ced_stage_chunk(struct ced_data *ced) ...@@ -775,34 +778,40 @@ static int ced_stage_chunk(struct ced_data *ced)
return U14ERR_FAIL; /* could do with a better error */ return U14ERR_FAIL; /* could do with a better error */
} }
ChunkSize = (ced->staged_length - ced->staged_done); /* transfer length remaining */ /* transfer length remaining */
if (ChunkSize > STAGED_SZ) /* make sure to keep legal */ chunk_size = (ced->staged_length - ced->staged_done);
ChunkSize = STAGED_SZ; /* limit to max allowed */ if (chunk_size > STAGED_SZ) /* make sure to keep legal */
chunk_size = STAGED_SZ; /* limit to max allowed */
if (!ced->staged_read) /* if writing... */ if (!ced->staged_read) /* if writing... */
ced_copy_user_space(ced, ChunkSize); /* ...copy data into the buffer */ /* ...copy data into the buffer */
ced_copy_user_space(ced, chunk_size);
usb_fill_bulk_urb(ced->staged_urb, ced->udev, usb_fill_bulk_urb(ced->staged_urb, ced->udev,
ced->staged_read ? usb_rcvbulkpipe(ced->udev, ced->staged_read ? usb_rcvbulkpipe(ced->udev,
ced-> ced->
ep_addr[nPipe]) : ep_addr[pipe]) :
usb_sndbulkpipe(ced->udev, ced->ep_addr[nPipe]), usb_sndbulkpipe(ced->udev, ced->ep_addr[pipe]),
ced->coher_staged_io, ChunkSize, ced->coher_staged_io, chunk_size,
staged_callback, ced); staged_callback, ced);
ced->staged_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; ced->staged_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
usb_anchor_urb(ced->staged_urb, &ced->submitted); /* in case we need to kill it */ /* in case we need to kill it */
iReturn = usb_submit_urb(ced->staged_urb, GFP_ATOMIC); usb_anchor_urb(ced->staged_urb, &ced->submitted);
if (iReturn) { retval = usb_submit_urb(ced->staged_urb, GFP_ATOMIC);
if (retval) {
usb_unanchor_urb(ced->staged_urb); /* kill it */ usb_unanchor_urb(ced->staged_urb); /* kill it */
ced->pipe_error[nPipe] = 1; /* Flag an error to be handled later */ ced->pipe_error[pipe] = 1; /* Flag an error to be */
dev_err(&ced->interface->dev, "%s: submit urb failed, code %d\n", /* handled later */
__func__, iReturn); dev_err(&ced->interface->dev,
"%s: submit urb failed, code %d\n",
__func__, retval);
} else } else
ced->staged_urb_pending = true; /* Set the flag for staged URB pending */ /* Set the flag for staged URB pending */
ced->staged_urb_pending = true;
dev_dbg(&ced->interface->dev, "%s: done so far:%d, this size:%d\n", dev_dbg(&ced->interface->dev, "%s: done so far:%d, this size:%d\n",
__func__, ced->staged_done, ChunkSize); __func__, ced->staged_done, chunk_size);
return iReturn; return retval;
} }
/*************************************************************************** /***************************************************************************
......
Markdown is supported
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