diff options
Diffstat (limited to 'drivers/staging/vt6656/usbpipe.c')
-rw-r--r-- | drivers/staging/vt6656/usbpipe.c | 151 |
1 files changed, 42 insertions, 109 deletions
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c index fd2355e34fb0..c612ab58f389 100644 --- a/drivers/staging/vt6656/usbpipe.c +++ b/drivers/staging/vt6656/usbpipe.c @@ -107,10 +107,7 @@ s_nsControlInUsbIoCompleteWrite( /*--------------------- Export Functions --------------------------*/ - - -NTSTATUS -PIPEnsControlOutAsyn( +int PIPEnsControlOutAsyn( PSDevice pDevice, BYTE byRequest, WORD wValue, @@ -119,16 +116,13 @@ PIPEnsControlOutAsyn( PBYTE pbyBuffer ) { - NTSTATUS ntStatus; - + int ntStatus; - if (MP_TEST_FLAG(pDevice, fMP_DISCONNECTED)) + if (pDevice->Flags & fMP_DISCONNECTED) return STATUS_FAILURE; - - if (MP_TEST_FLAG(pDevice, fMP_CONTROL_WRITES)) { + if (pDevice->Flags & fMP_CONTROL_WRITES) return STATUS_FAILURE; - } if (in_interrupt()) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"in_interrupt return ..byRequest %x\n", byRequest); @@ -156,12 +150,7 @@ PIPEnsControlOutAsyn( return ntStatus; } - - - - -NTSTATUS -PIPEnsControlOut( +int PIPEnsControlOut( PSDevice pDevice, BYTE byRequest, WORD wValue, @@ -170,16 +159,14 @@ PIPEnsControlOut( PBYTE pbyBuffer ) { - NTSTATUS ntStatus = 0; + int ntStatus = 0; int ii; - - if (MP_TEST_FLAG(pDevice, fMP_DISCONNECTED)) + if (pDevice->Flags & fMP_DISCONNECTED) return STATUS_FAILURE; - if (MP_TEST_FLAG(pDevice, fMP_CONTROL_WRITES)) { + if (pDevice->Flags & fMP_CONTROL_WRITES) return STATUS_FAILURE; - } pDevice->sUsbCtlRequest.bRequestType = 0x40; pDevice->sUsbCtlRequest.bRequest = byRequest; @@ -203,12 +190,15 @@ PIPEnsControlOut( } spin_unlock_irq(&pDevice->lock); for (ii = 0; ii <= USB_CTL_WAIT; ii ++) { - if (MP_TEST_FLAG(pDevice, fMP_CONTROL_WRITES)) - mdelay(1); + + if (pDevice->Flags & fMP_CONTROL_WRITES) + mdelay(1); else - break; + break; + if (ii >= USB_CTL_WAIT) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"control send request submission timeout \n"); + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "control send request submission timeout\n"); spin_lock_irq(&pDevice->lock); MP_CLEAR_FLAG(pDevice, fMP_CONTROL_WRITES); return STATUS_FAILURE; @@ -219,11 +209,7 @@ PIPEnsControlOut( return STATUS_SUCCESS; } - - - -NTSTATUS -PIPEnsControlIn( +int PIPEnsControlIn( PSDevice pDevice, BYTE byRequest, WORD wValue, @@ -232,15 +218,15 @@ PIPEnsControlIn( PBYTE pbyBuffer ) { - NTSTATUS ntStatus = 0; + int ntStatus = 0; int ii; - if (MP_TEST_FLAG(pDevice, fMP_DISCONNECTED)) + if (pDevice->Flags & fMP_DISCONNECTED) return STATUS_FAILURE; - if (MP_TEST_FLAG(pDevice, fMP_CONTROL_READS)) { - return STATUS_FAILURE; - } + if (pDevice->Flags & fMP_CONTROL_READS) + return STATUS_FAILURE; + pDevice->sUsbCtlRequest.bRequestType = 0xC0; pDevice->sUsbCtlRequest.bRequest = byRequest; pDevice->sUsbCtlRequest.wValue = cpu_to_le16p(&wValue); @@ -261,13 +247,15 @@ PIPEnsControlIn( spin_unlock_irq(&pDevice->lock); for (ii = 0; ii <= USB_CTL_WAIT; ii ++) { - if (MP_TEST_FLAG(pDevice, fMP_CONTROL_READS)) - mdelay(1); - else { - break; - } - if (ii >= USB_CTL_WAIT) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"control rcv request submission timeout \n"); + + if (pDevice->Flags & fMP_CONTROL_READS) + mdelay(1); + else + break; + + if (ii >= USB_CTL_WAIT) { + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "control rcv request submission timeout\n"); spin_lock_irq(&pDevice->lock); MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS); return STATUS_FAILURE; @@ -360,13 +348,9 @@ s_nsControlInUsbIoCompleteRead( * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver * */ -NTSTATUS -PIPEnsInterruptRead( - PSDevice pDevice - ) +int PIPEnsInterruptRead(PSDevice pDevice) { - NTSTATUS ntStatus = STATUS_FAILURE; - + int ntStatus = STATUS_FAILURE; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsStartInterruptUsbRead()\n"); @@ -381,29 +365,6 @@ PIPEnsInterruptRead( // Now that we have created the urb, we will send a // request to the USB device object. // -#if 0 //reserve int URB submit - usb_fill_int_urb(pDevice->pInterruptURB, - pDevice->usb, - usb_rcvintpipe(pDevice->usb, 1), - (void *) pDevice->intBuf.pDataBuf, - MAX_INTERRUPT_SIZE, - s_nsInterruptUsbIoCompleteRead, - pDevice, - pDevice->int_interval - ); -#else //replace int URB submit by bulk transfer -#ifndef Safe_Close - usb_fill_int_urb(pDevice->pInterruptURB, - pDevice->usb, - usb_rcvintpipe(pDevice->usb, 1), - (void *) pDevice->intBuf.pDataBuf, - MAX_INTERRUPT_SIZE, - s_nsInterruptUsbIoCompleteRead, - pDevice, - pDevice->int_interval - ); -#else - pDevice->pInterruptURB->interval = pDevice->int_interval; usb_fill_bulk_urb(pDevice->pInterruptURB, @@ -413,8 +374,6 @@ usb_fill_bulk_urb(pDevice->pInterruptURB, MAX_INTERRUPT_SIZE, s_nsInterruptUsbIoCompleteRead, pDevice); -#endif -#endif ntStatus = usb_submit_urb(pDevice->pInterruptURB, GFP_ATOMIC); if (ntStatus != 0) { @@ -448,8 +407,7 @@ s_nsInterruptUsbIoCompleteRead( { PSDevice pDevice; - NTSTATUS ntStatus; - + int ntStatus; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsInterruptUsbIoCompleteRead\n"); // @@ -495,13 +453,6 @@ s_nsInterruptUsbIoCompleteRead( if (pDevice->fKillEventPollingThread != TRUE) { - #if 0 //reserve int URB submit - ntStatus = usb_submit_urb(urb, GFP_ATOMIC); - if (ntStatus != 0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Re-Submit int URB failed %d\n", ntStatus); - } - #else //replace int URB submit by bulk transfer - #ifdef Safe_Close usb_fill_bulk_urb(pDevice->pInterruptURB, pDevice->usb, usb_rcvbulkpipe(pDevice->usb, 1), @@ -514,11 +465,6 @@ s_nsInterruptUsbIoCompleteRead( if (ntStatus != 0) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit int URB failed %d\n", ntStatus); } - - #else - tasklet_schedule(&pDevice->EventWorkItem); - #endif -#endif } // // We return STATUS_MORE_PROCESSING_REQUIRED so that the completion @@ -540,19 +486,15 @@ s_nsInterruptUsbIoCompleteRead( * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver * */ -NTSTATUS -PIPEnsBulkInUsbRead( - PSDevice pDevice, - PRCB pRCB - ) +int PIPEnsBulkInUsbRead(PSDevice pDevice, PRCB pRCB) { - NTSTATUS ntStatus= 0; + int ntStatus = 0; struct urb *pUrb; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsStartBulkInUsbRead\n"); - if (MP_TEST_FLAG(pDevice, fMP_DISCONNECTED)) + if (pDevice->Flags & fMP_DISCONNECTED) return STATUS_FAILURE; pDevice->ulBulkInPosted++; @@ -616,9 +558,7 @@ s_nsBulkInUsbIoCompleteRead( unsigned long bytesRead; BOOL bIndicateReceive = FALSE; BOOL bReAllocSkb = FALSE; - NTSTATUS status; - - + int status; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsBulkInUsbIoCompleteRead\n"); status = urb->status; @@ -628,9 +568,7 @@ s_nsBulkInUsbIoCompleteRead( pDevice->ulBulkInError++; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BULK In failed %d\n", status); - #ifdef Calcu_LinkQual pDevice->scStatistic.RxFcsErrCnt ++; - #endif //todo...xxxxxx // if (status == USBD_STATUS_CRC) { // pDevice->ulBulkInContCRCError++; @@ -644,9 +582,7 @@ s_nsBulkInUsbIoCompleteRead( pDevice->ulBulkInContCRCError = 0; pDevice->ulBulkInBytesRead += bytesRead; - #ifdef Calcu_LinkQual pDevice->scStatistic.RxOkCnt ++; - #endif } @@ -684,13 +620,13 @@ s_nsBulkInUsbIoCompleteRead( * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver * */ -NDIS_STATUS +int PIPEnsSendBulkOut( PSDevice pDevice, PUSB_SEND_CONTEXT pContext ) { - NTSTATUS status; + int status; struct urb *pUrb; @@ -709,7 +645,7 @@ PIPEnsSendBulkOut( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_nsSendBulkOut\n"); - if(MP_IS_READY(pDevice) && MP_TEST_FLAG(pDevice, fMP_POST_WRITES)) { + if (MP_IS_READY(pDevice) && (pDevice->Flags & fMP_POST_WRITES)) { pUrb = pContext->pUrb; pDevice->ulBulkOutPosted++; @@ -771,7 +707,7 @@ s_nsBulkOutIoCompleteWrite( ) { PSDevice pDevice; - NTSTATUS status; + int status; CONTEXT_TYPE ContextType; unsigned long ulBufLen; PUSB_SEND_CONTEXT pContext; @@ -803,10 +739,7 @@ s_nsBulkOutIoCompleteWrite( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Write %d bytes\n",(int)ulBufLen); pDevice->ulBulkOutBytesWrite += ulBufLen; pDevice->ulBulkOutContCRCError = 0; - //2007-0115-06<Add>by MikeLiu - #ifdef TxInSleep - pDevice->nTxDataTimeCout = 0; - #endif + pDevice->nTxDataTimeCout = 0; } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BULK Out failed %d\n", status); |