Commit b44cd112 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

USB: image: microtek: 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 dd6fa4d7
...@@ -189,7 +189,7 @@ static struct usb_driver mts_usb_driver = { ...@@ -189,7 +189,7 @@ static struct usb_driver mts_usb_driver = {
#define MTS_DEBUG_INT() \ #define MTS_DEBUG_INT() \
do { MTS_DEBUG_GOT_HERE(); \ do { MTS_DEBUG_GOT_HERE(); \
MTS_DEBUG("transfer = 0x%x context = 0x%x\n",(int)transfer,(int)context ); \ MTS_DEBUG("transfer = 0x%x context = 0x%x\n",(int)transfer,(int)context ); \
MTS_DEBUG("status = 0x%x data-length = 0x%x sent = 0x%x\n",(int)transfer->status,(int)context->data_length, (int)transfer->actual_length ); \ MTS_DEBUG("status = 0x%x data-length = 0x%x sent = 0x%x\n",transfer->status,(int)context->data_length, (int)transfer->actual_length ); \
mts_debug_dump(context->instance);\ mts_debug_dump(context->instance);\
} while(0) } while(0)
#else #else
...@@ -393,8 +393,6 @@ void mts_int_submit_urb (struct urb* transfer, ...@@ -393,8 +393,6 @@ void mts_int_submit_urb (struct urb* transfer,
context context
); );
transfer->status = 0;
res = usb_submit_urb( transfer, GFP_ATOMIC ); res = usb_submit_urb( transfer, GFP_ATOMIC );
if ( unlikely(res) ) { if ( unlikely(res) ) {
MTS_INT_ERROR( "could not submit URB! Error was %d\n",(int)res ); MTS_INT_ERROR( "could not submit URB! Error was %d\n",(int)res );
...@@ -444,12 +442,13 @@ static void mts_get_status( struct urb *transfer ) ...@@ -444,12 +442,13 @@ static void mts_get_status( struct urb *transfer )
static void mts_data_done( struct urb* transfer ) static void mts_data_done( struct urb* transfer )
/* Interrupt context! */ /* Interrupt context! */
{ {
int status = transfer->status;
MTS_INT_INIT(); MTS_INT_INIT();
if ( context->data_length != transfer->actual_length ) { if ( context->data_length != transfer->actual_length ) {
context->srb->resid = context->data_length - transfer->actual_length; context->srb->resid = context->data_length - transfer->actual_length;
} else if ( unlikely(transfer->status) ) { } else if ( unlikely(status) ) {
context->srb->result = (transfer->status == -ENOENT ? DID_ABORT : DID_ERROR)<<16; context->srb->result = (status == -ENOENT ? DID_ABORT : DID_ERROR)<<16;
} }
mts_get_status(transfer); mts_get_status(transfer);
...@@ -461,10 +460,11 @@ static void mts_data_done( struct urb* transfer ) ...@@ -461,10 +460,11 @@ static void mts_data_done( struct urb* transfer )
static void mts_command_done( struct urb *transfer ) static void mts_command_done( struct urb *transfer )
/* Interrupt context! */ /* Interrupt context! */
{ {
int status = transfer->status;
MTS_INT_INIT(); MTS_INT_INIT();
if ( unlikely(transfer->status) ) { if ( unlikely(status) ) {
if (transfer->status == -ENOENT) { if (status == -ENOENT) {
/* We are being killed */ /* We are being killed */
MTS_DEBUG_GOT_HERE(); MTS_DEBUG_GOT_HERE();
context->srb->result = DID_ABORT<<16; context->srb->result = DID_ABORT<<16;
...@@ -502,12 +502,13 @@ static void mts_command_done( struct urb *transfer ) ...@@ -502,12 +502,13 @@ static void mts_command_done( struct urb *transfer )
static void mts_do_sg (struct urb* transfer) static void mts_do_sg (struct urb* transfer)
{ {
struct scatterlist * sg; struct scatterlist * sg;
int status = transfer->status;
MTS_INT_INIT(); MTS_INT_INIT();
MTS_DEBUG("Processing fragment %d of %d\n", context->fragment,context->srb->use_sg); MTS_DEBUG("Processing fragment %d of %d\n", context->fragment,context->srb->use_sg);
if (unlikely(transfer->status)) { if (unlikely(status)) {
context->srb->result = (transfer->status == -ENOENT ? DID_ABORT : DID_ERROR)<<16; context->srb->result = (status == -ENOENT ? DID_ABORT : DID_ERROR)<<16;
mts_transfer_cleanup(transfer); mts_transfer_cleanup(transfer);
} }
......
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