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

staging: ced1401: fix ced_readchar_callback()

Rename camel case arguments and locals in function ced_readchar_callback()
Signed-off-by: default avatarLuca Ellero <luca.ellero@brickedbrain.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 13f9c568
...@@ -1189,57 +1189,68 @@ static int ced_handle_esc(struct ced_data *ced, char *ch, ...@@ -1189,57 +1189,68 @@ static int ced_handle_esc(struct ced_data *ced, char *ch,
/**************************************************************************** /****************************************************************************
** Callback for the character read complete or error ** Callback for the character read complete or error
****************************************************************************/ ****************************************************************************/
static void ced_readchar_callback(struct urb *pUrb) static void ced_readchar_callback(struct urb *urb)
{ {
struct ced_data *ced = pUrb->context; struct ced_data *ced = urb->context;
int nGot = pUrb->actual_length; /* what we transferred */ int got = urb->actual_length; /* what we transferred */
if (pUrb->status) { /* Do we have a problem to handle? */ if (urb->status) { /* Do we have a problem to handle? */
int nPipe = ced->n_pipes == 4 ? 1 : 0; /* The pipe number to use for error */ /* The pipe number to use for error */
/* sync/async unlink faults aren't errors... just saying device removed or stopped */ int pipe = ced->n_pipes == 4 ? 1 : 0;
/* sync/async unlink faults aren't errors... */
/* just saying device removed or stopped */
if (! if (!
(pUrb->status == -ENOENT || pUrb->status == -ECONNRESET (urb->status == -ENOENT || urb->status == -ECONNRESET
|| pUrb->status == -ESHUTDOWN)) { || urb->status == -ESHUTDOWN)) {
dev_err(&ced->interface->dev, dev_err(&ced->interface->dev,
"%s: nonzero write bulk status received: %d\n", "%s: nonzero write bulk status received: %d\n",
__func__, pUrb->status); __func__, urb->status);
} else } else
dev_dbg(&ced->interface->dev, dev_dbg(&ced->interface->dev,
"%s: 0 chars pUrb->status=%d (shutdown?)\n", "%s: 0 chars urb->status=%d (shutdown?)\n",
__func__, pUrb->status); __func__, urb->status);
spin_lock(&ced->err_lock); spin_lock(&ced->err_lock);
ced->errors = pUrb->status; ced->errors = urb->status;
spin_unlock(&ced->err_lock); spin_unlock(&ced->err_lock);
nGot = 0; /* and tidy up again if so */ got = 0; /* and tidy up again if so */
spin_lock(&ced->char_in_lock); /* already at irq level */ spin_lock(&ced->char_in_lock); /* already at irq level */
ced->pipe_error[nPipe] = 1; /* Flag an error for later */ ced->pipe_error[pipe] = 1; /* Flag an error for later */
} else { } else {
if ((nGot > 1) && ((ced->coher_char_in[0] & 0x7f) == 0x1b)) { /* Esc sequence? */ /* Esc sequence? */
ced_handle_esc(ced, &ced->coher_char_in[1], nGot - 1); /* handle it */ if ((got > 1) && ((ced->coher_char_in[0] & 0x7f) == 0x1b)) {
spin_lock(&ced->char_in_lock); /* already at irq level */ /* handle it */
ced_handle_esc(ced, &ced->coher_char_in[1], got - 1);
/* already at irq level */
spin_lock(&ced->char_in_lock);
} else { } else {
spin_lock(&ced->char_in_lock); /* already at irq level */ /* already at irq level */
if (nGot > 0) { spin_lock(&ced->char_in_lock);
if (got > 0) {
unsigned int i; unsigned int i;
if (nGot < INBUF_SZ) { if (got < INBUF_SZ) {
ced->coher_char_in[nGot] = 0; /* tidy the string */ /* tidy the string */
ced->coher_char_in[got] = 0;
dev_dbg(&ced->interface->dev, dev_dbg(&ced->interface->dev,
"%s: got %d chars >%s<\n", "%s: got %d chars >%s<\n",
__func__, nGot, __func__, got,
ced->coher_char_in); ced->coher_char_in);
} }
/* We know that whatever we read must fit in the input buffer */ /* We know that whatever we read must fit */
for (i = 0; i < nGot; i++) { /* in the input buffer */
for (i = 0; i < got; i++) {
ced->input_buffer[ced->in_buff_put++] = ced->input_buffer[ced->in_buff_put++] =
ced->coher_char_in[i] & 0x7F; ced->coher_char_in[i] & 0x7F;
if (ced->in_buff_put >= INBUF_SZ) if (ced->in_buff_put >= INBUF_SZ)
ced->in_buff_put = 0; ced->in_buff_put = 0;
} }
if ((ced->num_input + nGot) <= INBUF_SZ) if ((ced->num_input + got) <= INBUF_SZ)
ced->num_input += nGot; /* Adjust the buffer count accordingly */ /* Adjust the buffer count accordingly */
ced->num_input += got;
} else } else
dev_dbg(&ced->interface->dev, "%s: read ZLP\n", dev_dbg(&ced->interface->dev, "%s: read ZLP\n",
__func__); __func__);
......
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