Commit 22bea334 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

USB: misc: auerswald: clean up urb->status usage

This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 13f9782d
...@@ -862,14 +862,16 @@ static void auerswald_ctrlread_wretcomplete (struct urb * urb) ...@@ -862,14 +862,16 @@ static void auerswald_ctrlread_wretcomplete (struct urb * urb)
pauerbuf_t bp = (pauerbuf_t) urb->context; pauerbuf_t bp = (pauerbuf_t) urb->context;
pauerswald_t cp; pauerswald_t cp;
int ret; int ret;
int status = urb->status;
dbg ("auerswald_ctrlread_wretcomplete called"); dbg ("auerswald_ctrlread_wretcomplete called");
dbg ("complete with status: %d", urb->status); dbg ("complete with status: %d", status);
cp = ((pauerswald_t)((char *)(bp->list)-(unsigned long)(&((pauerswald_t)0)->bufctl))); cp = ((pauerswald_t)((char *)(bp->list)-(unsigned long)(&((pauerswald_t)0)->bufctl)));
/* check if it is possible to advance */ /* check if it is possible to advance */
if (!auerswald_status_retry (urb->status) || !cp->usbdev) { if (!auerswald_status_retry(status) || !cp->usbdev) {
/* reuse the buffer */ /* reuse the buffer */
err ("control dummy: transmission error %d, can not retry", urb->status); err ("control dummy: transmission error %d, can not retry", status);
auerbuf_releasebuf (bp); auerbuf_releasebuf (bp);
/* Wake up all processes waiting for a buffer */ /* Wake up all processes waiting for a buffer */
wake_up (&cp->bufferwait); wake_up (&cp->bufferwait);
...@@ -902,21 +904,23 @@ static void auerswald_ctrlread_complete (struct urb * urb) ...@@ -902,21 +904,23 @@ static void auerswald_ctrlread_complete (struct urb * urb)
pauerswald_t cp; pauerswald_t cp;
pauerscon_t scp; pauerscon_t scp;
pauerbuf_t bp = (pauerbuf_t) urb->context; pauerbuf_t bp = (pauerbuf_t) urb->context;
int status = urb->status;
int ret; int ret;
dbg ("auerswald_ctrlread_complete called"); dbg ("auerswald_ctrlread_complete called");
cp = ((pauerswald_t)((char *)(bp->list)-(unsigned long)(&((pauerswald_t)0)->bufctl))); cp = ((pauerswald_t)((char *)(bp->list)-(unsigned long)(&((pauerswald_t)0)->bufctl)));
/* check if there is valid data in this urb */ /* check if there is valid data in this urb */
if (urb->status) { if (status) {
dbg ("complete with non-zero status: %d", urb->status); dbg ("complete with non-zero status: %d", status);
/* should we do a retry? */ /* should we do a retry? */
if (!auerswald_status_retry (urb->status) if (!auerswald_status_retry(status)
|| !cp->usbdev || !cp->usbdev
|| (cp->version < AUV_RETRY) || (cp->version < AUV_RETRY)
|| (bp->retries >= AU_RETRIES)) { || (bp->retries >= AU_RETRIES)) {
/* reuse the buffer */ /* reuse the buffer */
err ("control read: transmission error %d, can not retry", urb->status); err ("control read: transmission error %d, can not retry", status);
auerbuf_releasebuf (bp); auerbuf_releasebuf (bp);
/* Wake up all processes waiting for a buffer */ /* Wake up all processes waiting for a buffer */
wake_up (&cp->bufferwait); wake_up (&cp->bufferwait);
...@@ -974,12 +978,13 @@ static void auerswald_int_complete (struct urb * urb) ...@@ -974,12 +978,13 @@ static void auerswald_int_complete (struct urb * urb)
unsigned int channelid; unsigned int channelid;
unsigned int bytecount; unsigned int bytecount;
int ret; int ret;
int status = urb->status;
pauerbuf_t bp = NULL; pauerbuf_t bp = NULL;
pauerswald_t cp = (pauerswald_t) urb->context; pauerswald_t cp = (pauerswald_t) urb->context;
dbg ("%s called", __FUNCTION__); dbg ("%s called", __FUNCTION__);
switch (urb->status) { switch (status) {
case 0: case 0:
/* success */ /* success */
break; break;
...@@ -987,10 +992,10 @@ static void auerswald_int_complete (struct urb * urb) ...@@ -987,10 +992,10 @@ static void auerswald_int_complete (struct urb * urb)
case -ENOENT: case -ENOENT:
case -ESHUTDOWN: case -ESHUTDOWN:
/* this urb is terminated, clean up */ /* this urb is terminated, clean up */
dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status); dbg("%s - urb shutting down with status: %d", __FUNCTION__, status);
return; return;
default: default:
dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); dbg("%s - nonzero urb status received: %d", __FUNCTION__, status);
goto exit; goto exit;
} }
......
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