From: Greg KH To: torvalds@transmeta.com Cc: linux-usb-devel@lists.sourceforge.net Subject: [PATCH 05 of 11] USB microtek driver update Hi, Here's a patch against 2.5.3-pre1 for the USB microtek driver that removes some dead code, and tries to shave off some cycles in the interrupt handler. This patch was written by Oliver Neukum. thanks, greg k-h diff -Nru a/drivers/usb/microtek.c b/drivers/usb/microtek.c --- a/drivers/usb/microtek.c Wed Jan 16 09:57:45 2002 +++ b/drivers/usb/microtek.c Wed Jan 16 09:57:45 2002 @@ -320,11 +320,6 @@ #endif - -/* static inline int mts_is_aborting(struct mts_desc* desc) { - return (atomic_read(&desc->context.do_abort)); -} */ - static inline void mts_urb_abort(struct mts_desc* desc) { MTS_DEBUG_GOT_HERE(); mts_debug_dump(desc); @@ -504,7 +499,7 @@ transfer->status = 0; res = usb_submit_urb( transfer ); - if ( res ) { + if ( unlikely(res) ) { MTS_INT_ERROR( "could not submit URB! Error was %d\n",(int)res ); context->srb->result = DID_ERROR << 16; mts_transfer_cleanup(transfer); @@ -518,7 +513,7 @@ { MTS_INT_INIT(); - if ( context->final_callback ) + if ( likely(context->final_callback != NULL) ) context->final_callback(context->srb); } @@ -556,7 +551,7 @@ if ( context->data_length != transfer->actual_length ) { context->srb->resid = context->data_length - transfer->actual_length; - } else if ( transfer->status ) { + } else if ( unlikely(transfer->status) ) { context->srb->result = (transfer->status == -ENOENT ? DID_ABORT : DID_ERROR)<<16; } @@ -571,7 +566,7 @@ { MTS_INT_INIT(); - if ( transfer->status ) { + if ( unlikely(transfer->status) ) { if (transfer->status == -ENOENT) { /* We are being killed */ MTS_DEBUG_GOT_HERE(); @@ -605,7 +600,7 @@ MTS_DEBUG("Processing fragment %d of %d\n", context->fragment,context->srb->use_sg); - if (transfer->status) { + if (unlikely(transfer->status)) { context->srb->result = (transfer->status == -ENOENT ? DID_ABORT : DID_ERROR)<<16; mts_transfer_cleanup(transfer); } @@ -703,7 +698,7 @@ srb->result = DID_BAD_TARGET << 16; - if(callback) + if(likely(callback != NULL)) callback(srb); goto out; @@ -725,11 +720,11 @@ res=usb_submit_urb(&desc->urb); - if(res){ + if(unlikely(res)){ MTS_ERROR("error %d submitting URB\n",(int)res); srb->result = DID_ERROR << 16; - if(callback) + if(likely(callback != NULL)) callback(srb); } @@ -1061,4 +1056,5 @@ MODULE_AUTHOR( DRIVER_AUTHOR ); MODULE_DESCRIPTION( DRIVER_DESC ); MODULE_LICENSE("GPL"); +