From 9a01e186d31a469d34604a49760a937abc127282 Mon Sep 17 00:00:00 2001 From: Forest Bond Date: Sat, 13 Jun 2009 07:38:31 -0400 Subject: Staging: Add pristine upstream vt6656 driver sources to drivers/staging/vt6656. Add pristine upstream vt6656 driver sources to drivers/staging/vt6656. These files were copied from the driver directory in the upstream source archive, available here: http://www.viaarena.com/Driver/VT6656_Linux_src_v1.19_12_x86.zip After copying, trailing whitespace was stripped. This is GPL-licensed code. Signed-off-by: Forest Bond Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/usbpipe.c | 989 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 989 insertions(+) create mode 100644 drivers/staging/vt6656/usbpipe.c (limited to 'drivers/staging/vt6656/usbpipe.c') diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c new file mode 100644 index 000000000000..625ffb60e631 --- /dev/null +++ b/drivers/staging/vt6656/usbpipe.c @@ -0,0 +1,989 @@ +/* + * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * + * File: usbpipe.c + * + * Purpose: Handle USB control endpoint + * + * Author: Warren Hsu + * + * Date: Mar. 29, 2005 + * + * Functions: + * CONTROLnsRequestOut - Write variable length bytes to MEM/BB/MAC/EEPROM + * CONTROLnsRequestIn - Read variable length bytes from MEM/BB/MAC/EEPROM + * ControlvWriteByte - Write one byte to MEM/BB/MAC/EEPROM + * ControlvReadByte - Read one byte from MEM/BB/MAC/EEPROM + * ControlvMaskByte - Read one byte from MEM/BB/MAC/EEPROM and clear/set some bits in the same address + * + * Revision History: + * 04-05-2004 Jerry Chen: Initial release + * 11-24-2004 Warren Hsu: Add ControlvWriteByte,ControlvReadByte,ControlvMaskByte + * + */ + +#if !defined(__UMEM_H__) +#include "umem.h" +#endif +#if !defined(__INT_H__) +#include "int.h" +#endif +#if !defined(__RXTX_H__) +#include "rxtx.h" +#endif +#if !defined(__DPC_H__) +#include "dpc.h" +#endif +#if !defined(__CONTROL_H__) +#include "control.h" +#endif +#if !defined(__DESC_H__) +#include "desc.h" +#endif +#if !defined(__DEVICE_H__) +#include "device.h" +#endif + + +/*--------------------- Static Definitions -------------------------*/ +//endpoint def +//endpoint 0: control +//endpoint 1: interrupt +//endpoint 2: read bulk +//endpoint 3: write bulk + +//RequestType: +//#define REQUEST_OUT (USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE) // 0x40 +//#define REQUEST_IN (USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE ) //0xc0 +//static int msglevel =MSG_LEVEL_DEBUG; +static int msglevel =MSG_LEVEL_INFO; + + +#define USB_CTL_WAIT 500 //ms + +#ifndef URB_ASYNC_UNLINK +#define URB_ASYNC_UNLINK 0 +#endif + +/*--------------------- Static Classes ----------------------------*/ + +/*--------------------- Static Variables --------------------------*/ + +/*--------------------- Static Functions --------------------------*/ +//2007-0508-02by MikeLiu +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))&&(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) + +static +VOID +s_nsInterruptUsbIoCompleteRead( + IN struct urb *urb, + IN struct pt_regs *regs + ); + + +static +VOID +s_nsBulkInUsbIoCompleteRead( + IN struct urb *urb, + IN struct pt_regs *regs + ); + + +static +VOID +s_nsBulkOutIoCompleteWrite( + IN struct urb *urb, + IN struct pt_regs *regs + ); + + +static +VOID +s_nsControlInUsbIoCompleteRead( + IN struct urb *urb, + IN struct pt_regs *regs + ); + +static +VOID +s_nsControlInUsbIoCompleteWrite( + IN struct urb *urb, + IN struct pt_regs *regs + ); + +#else + +static +VOID +s_nsInterruptUsbIoCompleteRead( + IN struct urb *urb + ); + + +static +VOID +s_nsBulkInUsbIoCompleteRead( + IN struct urb *urb + ); + + +static +VOID +s_nsBulkOutIoCompleteWrite( + IN struct urb *urb + ); + + +static +VOID +s_nsControlInUsbIoCompleteRead( + IN struct urb *urb + ); + +static +VOID +s_nsControlInUsbIoCompleteWrite( + IN struct urb *urb + ); + +#endif + + +/*--------------------- Export Variables --------------------------*/ + +/*--------------------- Export Functions --------------------------*/ + + + +NTSTATUS +PIPEnsControlOutAsyn( + IN PSDevice pDevice, + IN BYTE byRequest, + IN WORD wValue, + IN WORD wIndex, + IN WORD wLength, + IN PBYTE pbyBuffer + ) +{ + NTSTATUS ntStatus; + + + if (MP_TEST_FLAG(pDevice, fMP_DISCONNECTED)) + return STATUS_FAILURE; + + + if (MP_TEST_FLAG(pDevice, fMP_CONTROL_WRITES)) { + return STATUS_FAILURE; + } + + if (in_interrupt()) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"in_interrupt return ..byRequest %x\n", byRequest); + return STATUS_FAILURE; + } + + ntStatus = usb_control_msg( + pDevice->usb, + usb_sndctrlpipe(pDevice->usb , 0), + byRequest, + 0x40, // RequestType + wValue, + wIndex, + (PVOID) pbyBuffer, + wLength, + HZ + ); + if (ntStatus >= 0) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"usb_sndctrlpipe ntStatus= %d\n", ntStatus); + ntStatus = 0; + } else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"usb_sndctrlpipe fail, ntStatus= %d\n", ntStatus); + } + + return ntStatus; +} + + + + + +NTSTATUS +PIPEnsControlOut( + IN PSDevice pDevice, + IN BYTE byRequest, + IN WORD wValue, + IN WORD wIndex, + IN WORD wLength, + IN PBYTE pbyBuffer + ) +{ + NTSTATUS ntStatus = 0; + int ii; + + + if (MP_TEST_FLAG(pDevice, fMP_DISCONNECTED)) + return STATUS_FAILURE; + + if (MP_TEST_FLAG(pDevice, fMP_CONTROL_WRITES)) { + return STATUS_FAILURE; + } + + pDevice->sUsbCtlRequest.bRequestType = 0x40; + pDevice->sUsbCtlRequest.bRequest = byRequest; + pDevice->sUsbCtlRequest.wValue = cpu_to_le16p(&wValue); + pDevice->sUsbCtlRequest.wIndex = cpu_to_le16p(&wIndex); + pDevice->sUsbCtlRequest.wLength = cpu_to_le16p(&wLength); + pDevice->pControlURB->transfer_flags |= URB_ASYNC_UNLINK; + pDevice->pControlURB->actual_length = 0; + // Notice, pbyBuffer limited point to variable buffer, can't be constant. + usb_fill_control_urb(pDevice->pControlURB, pDevice->usb, + usb_sndctrlpipe(pDevice->usb , 0), (char *) &pDevice->sUsbCtlRequest, + pbyBuffer, wLength, s_nsControlInUsbIoCompleteWrite, pDevice); + + if ((ntStatus = vntwusb_submit_urb(pDevice->pControlURB) != 0)) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"control send request submission failed: %d\n", ntStatus); + return STATUS_FAILURE; + } + else { + MP_SET_FLAG(pDevice, fMP_CONTROL_WRITES); + } + spin_unlock_irq(&pDevice->lock); + for (ii = 0; ii <= USB_CTL_WAIT; ii ++) { + if (MP_TEST_FLAG(pDevice, fMP_CONTROL_WRITES)) + mdelay(1); + else + break; + if (ii >= USB_CTL_WAIT) { + 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; + } + } + spin_lock_irq(&pDevice->lock); + + return STATUS_SUCCESS; +} + + + + +NTSTATUS +PIPEnsControlIn( + IN PSDevice pDevice, + IN BYTE byRequest, + IN WORD wValue, + IN WORD wIndex, + IN WORD wLength, + IN OUT PBYTE pbyBuffer + ) +{ + NTSTATUS ntStatus = 0; + int ii; + + if (MP_TEST_FLAG(pDevice, fMP_DISCONNECTED)) + return STATUS_FAILURE; + + if (MP_TEST_FLAG(pDevice, fMP_CONTROL_READS)) { + return STATUS_FAILURE; + } + pDevice->sUsbCtlRequest.bRequestType = 0xC0; + pDevice->sUsbCtlRequest.bRequest = byRequest; + pDevice->sUsbCtlRequest.wValue = cpu_to_le16p(&wValue); + pDevice->sUsbCtlRequest.wIndex = cpu_to_le16p(&wIndex); + pDevice->sUsbCtlRequest.wLength = cpu_to_le16p(&wLength); + pDevice->pControlURB->transfer_flags |= URB_ASYNC_UNLINK; + pDevice->pControlURB->actual_length = 0; + usb_fill_control_urb(pDevice->pControlURB, pDevice->usb, + usb_rcvctrlpipe(pDevice->usb , 0), (char *) &pDevice->sUsbCtlRequest, + pbyBuffer, wLength, s_nsControlInUsbIoCompleteRead, pDevice); + + if ((ntStatus = vntwusb_submit_urb(pDevice->pControlURB) != 0)) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"control request submission failed: %d\n", ntStatus); + }else { + MP_SET_FLAG(pDevice, fMP_CONTROL_READS); + } + + 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"); + spin_lock_irq(&pDevice->lock); + MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS); + return STATUS_FAILURE; + } + } + spin_lock_irq(&pDevice->lock); + + return ntStatus; +} + +//2007-0508-03by MikeLiu +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))&&(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) + +static +VOID +s_nsControlInUsbIoCompleteWrite( + IN struct urb *urb, + IN struct pt_regs *regs + ) +#else + +static +VOID +s_nsControlInUsbIoCompleteWrite( + IN struct urb *urb + ) +#endif +{ + PSDevice pDevice; + + pDevice = urb->context; + switch (urb->status) { + case 0: + break; + case -EINPROGRESS: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ctrl write urb status EINPROGRESS%d\n", urb->status); + break; + case -ENOENT: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ctrl write urb status ENOENT %d\n", urb->status); + break; + default: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ctrl write urb status %d\n", urb->status); + } + + MP_CLEAR_FLAG(pDevice, fMP_CONTROL_WRITES); +} + + + +/* + * Description: + * Complete function of usb Control callback + * + * Parameters: + * In: + * pDevice - Pointer to the adapter + * + * Out: + * none + * + * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver + * + */ + +//2007-0508-04by MikeLiu +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))&&(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) +static +VOID +s_nsControlInUsbIoCompleteRead( + IN struct urb *urb, + IN struct pt_regs *regs + ) +#else + +static +VOID +s_nsControlInUsbIoCompleteRead( + IN struct urb *urb + ) +#endif +{ + PSDevice pDevice; + + pDevice = urb->context; + switch (urb->status) { + case 0: + break; + case -EINPROGRESS: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ctrl read urb status EINPROGRESS%d\n", urb->status); + break; + case -ENOENT: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ctrl read urb status = ENOENT %d\n", urb->status); + break; + default: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ctrl read urb status %d\n", urb->status); + } + + MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS); +} + + + + +/* + * Description: + * Allocates an usb interrupt in irp and calls USBD. + * + * Parameters: + * In: + * pDevice - Pointer to the adapter + * Out: + * none + * + * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver + * + */ +NTSTATUS +PIPEnsInterruptRead( + IN PSDevice pDevice + ) +{ + NTSTATUS ntStatus = STATUS_FAILURE; + + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsStartInterruptUsbRead()\n"); + + if(pDevice->intBuf.bInUse == TRUE){ + return (STATUS_FAILURE); + } + pDevice->intBuf.bInUse = TRUE; +// pDevice->bEventAvailable = FALSE; + pDevice->ulIntInPosted++; + + // + // 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), + (PVOID) 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), + (PVOID) pDevice->intBuf.pDataBuf, + MAX_INTERRUPT_SIZE, + s_nsInterruptUsbIoCompleteRead, + pDevice, + pDevice->int_interval + ); +#else + +//2008-0526-01by MikeLiu +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) + pDevice->pInterruptURB->interval = pDevice->int_interval; +#endif + +usb_fill_bulk_urb(pDevice->pInterruptURB, + pDevice->usb, + usb_rcvbulkpipe(pDevice->usb, 1), + (PVOID) pDevice->intBuf.pDataBuf, + MAX_INTERRUPT_SIZE, + s_nsInterruptUsbIoCompleteRead, + pDevice); +#endif +#endif + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + if ((ntStatus = vntwusb_submit_urb(pDevice->pInterruptURB)) != 0) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit int URB failed %d\n", ntStatus); + } + +#else + if (pDevice->bEventAvailable == FALSE) { + if ((ntStatus = vntwusb_submit_urb(pDevice->pInterruptURB)) != 0) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit int URB failed %d\n", ntStatus); + } + } +#endif + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"<----s_nsStartInterruptUsbRead Return(%x)\n",ntStatus); + return ntStatus; +} + + +/* + * Description: + * Complete function of usb interrupt in irp. + * + * Parameters: + * In: + * pDevice - Pointer to the adapter + * + * Out: + * none + * + * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver + * + */ +//2007-0508-05by MikeLiu +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))&&(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) +static +VOID +s_nsInterruptUsbIoCompleteRead( + IN struct urb *urb, + IN struct pt_regs *regs + ) +#else + +static +VOID +s_nsInterruptUsbIoCompleteRead( + IN struct urb *urb + ) + +#endif +{ + PSDevice pDevice; + NTSTATUS ntStatus; + + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsInterruptUsbIoCompleteRead\n"); + // + // The context given to IoSetCompletionRoutine is the receive buffer object + // + pDevice = (PSDevice)urb->context; + + // + // We have a number of cases: + // 1) The USB read timed out and we received no data. + // 2) The USB read timed out and we received some data. + // 3) The USB read was successful and fully filled our irp buffer. + // 4) The irp was cancelled. + // 5) Some other failure from the USB device object. + // + ntStatus = urb->status; + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_nsInterruptUsbIoCompleteRead Status %d\n", ntStatus); + + // if we were not successful, we need to free the int buffer for future use right here + // otherwise interrupt data handler will free int buffer after it handle it. + if (( ntStatus != STATUS_SUCCESS )) { + pDevice->ulBulkInError++; + pDevice->intBuf.bInUse = FALSE; + +// if (ntStatus == USBD_STATUS_CRC) { +// pDevice->ulIntInContCRCError++; +// } + +// if (ntStatus == STATUS_NOT_CONNECTED ) +// { + pDevice->fKillEventPollingThread = TRUE; +// } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"IntUSBIoCompleteControl STATUS = %d\n", ntStatus ); + } + else { + pDevice->ulIntInBytesRead += (ULONG)urb->actual_length; + pDevice->ulIntInContCRCError = 0; + pDevice->bEventAvailable = TRUE; + INTnsProcessData(pDevice); + } + + STAvUpdateUSBCounter(&pDevice->scStatistic.USB_InterruptStat, ntStatus); + + + if (pDevice->fKillEventPollingThread != TRUE) { + #if 0 //reserve int URB submit + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + if ((ntStatus = vntwusb_submit_urb(urb)) != 0) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Re-Submit int URB failed %d\n", ntStatus); + } + + #else + if (pDevice->bEventAvailable == FALSE) { + if ((ntStatus = vntwusb_submit_urb(urb)) != 0) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Re-Submit int URB failed %d\n", ntStatus); + } + } + #endif + #else //replace int URB submit by bulk transfer + #ifdef Safe_Close + usb_fill_bulk_urb(pDevice->pInterruptURB, + pDevice->usb, + usb_rcvbulkpipe(pDevice->usb, 1), + (PVOID) pDevice->intBuf.pDataBuf, + MAX_INTERRUPT_SIZE, + s_nsInterruptUsbIoCompleteRead, + pDevice); + + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + if ((ntStatus = vntwusb_submit_urb(pDevice->pInterruptURB)) != 0) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit int URB failed %d\n", ntStatus); + } + + #else + if (pDevice->bEventAvailable == FALSE) { + if ((ntStatus = vntwusb_submit_urb(pDevice->pInterruptURB)) != 0) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit int URB failed %d\n", ntStatus); + } + } + #endif + #else + tasklet_schedule(&pDevice->EventWorkItem); + #endif +#endif + } + // + // We return STATUS_MORE_PROCESSING_REQUIRED so that the completion + // routine (IofCompleteRequest) will stop working on the irp. + // + return ; +} + +/* + * Description: + * Allocates an usb BulkIn irp and calls USBD. + * + * Parameters: + * In: + * pDevice - Pointer to the adapter + * Out: + * none + * + * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver + * + */ +NTSTATUS +PIPEnsBulkInUsbRead( + IN PSDevice pDevice, + IN PRCB pRCB + ) +{ + NTSTATUS ntStatus= 0; + struct urb *pUrb; + + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsStartBulkInUsbRead\n"); + + if (MP_TEST_FLAG(pDevice, fMP_DISCONNECTED)) + return STATUS_FAILURE; + + pDevice->ulBulkInPosted++; + + + pUrb = pRCB->pUrb; + // + // Now that we have created the urb, we will send a + // request to the USB device object. + // + if (pRCB->skb == NULL) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pRCB->skb is null \n"); + return ntStatus; + } + + usb_fill_bulk_urb(pUrb, + pDevice->usb, + usb_rcvbulkpipe(pDevice->usb, 2), + (PVOID) (pRCB->skb->data), + MAX_TOTAL_SIZE_WITH_ALL_HEADERS, + s_nsBulkInUsbIoCompleteRead, + pRCB); + + if((ntStatus = vntwusb_submit_urb(pUrb)!=0)){ + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit Rx URB failed %d\n", ntStatus); + return STATUS_FAILURE ; + } + pRCB->Ref = 1; + pRCB->bBoolInUse= TRUE; + + return ntStatus; +} + + + + +/* + * Description: + * Complete function of usb BulkIn irp. + * + * Parameters: + * In: + * pDevice - Pointer to the adapter + * + * Out: + * none + * + * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver + * + */ +//2007-0508-06by MikeLiu +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))&&(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) +static +VOID +s_nsBulkInUsbIoCompleteRead( + IN struct urb *urb, + IN struct pt_regs *regs + ) +#else + +static +VOID +s_nsBulkInUsbIoCompleteRead( + IN struct urb *urb + ) + +#endif +{ + PRCB pRCB = (PRCB)urb->context; + PSDevice pDevice = (PSDevice)pRCB->pDevice; + ULONG bytesRead; + BOOLEAN bIndicateReceive = FALSE; + BOOL bReAllocSkb = FALSE; + NTSTATUS status; + + + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsBulkInUsbIoCompleteRead\n"); + status = urb->status; + bytesRead = urb->actual_length; + + if (status) { + 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++; +// } +// if (status == STATUS_DEVICE_NOT_CONNECTED ) +// { +// MP_SET_FLAG(pDevice, fMP_DISCONNECTED); +// } + } else { + bIndicateReceive = TRUE; + pDevice->ulBulkInContCRCError = 0; + pDevice->ulBulkInBytesRead += bytesRead; + + #ifdef Calcu_LinkQual + pDevice->scStatistic.RxOkCnt ++; + #endif + } + + + STAvUpdateUSBCounter(&pDevice->scStatistic.USB_BulkInStat, status); + + if (bIndicateReceive) { + spin_lock(&pDevice->lock); + if (RXbBulkInProcessData(pDevice, pRCB, bytesRead) == TRUE) + bReAllocSkb = TRUE; + spin_unlock(&pDevice->lock); + } + pRCB->Ref--; + if (pRCB->Ref == 0) + { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RxvFreeNormal %d \n",pDevice->NumRecvFreeList); + spin_lock(&pDevice->lock); + RXvFreeRCB(pRCB, bReAllocSkb); + spin_unlock(&pDevice->lock); + } + + + return; +} + +/* + * Description: + * Allocates an usb BulkOut irp and calls USBD. + * + * Parameters: + * In: + * pDevice - Pointer to the adapter + * Out: + * none + * + * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver + * + */ +NDIS_STATUS +PIPEnsSendBulkOut( + IN PSDevice pDevice, + IN PUSB_SEND_CONTEXT pContext + ) +{ + NTSTATUS status; + struct urb *pUrb; + + + + pDevice->bPWBitOn = FALSE; + +/* + if (pDevice->pPendingBulkOutContext != NULL) { + pDevice->NumContextsQueued++; + EnqueueContext(pDevice->FirstTxContextQueue, pDevice->LastTxContextQueue, pContext); + status = STATUS_PENDING; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Send pending!\n"); + return status; + } +*/ + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_nsSendBulkOut\n"); + + if(MP_IS_READY(pDevice) && MP_TEST_FLAG(pDevice, fMP_POST_WRITES)) { + + pUrb = pContext->pUrb; + pDevice->ulBulkOutPosted++; +// pDevice->pPendingBulkOutContext = pContext; + usb_fill_bulk_urb( + pUrb, + pDevice->usb, + usb_sndbulkpipe(pDevice->usb, 3), + (PVOID) &(pContext->Data[0]), + pContext->uBufLen, + s_nsBulkOutIoCompleteWrite, + pContext); + + if((status = vntwusb_submit_urb(pUrb))!=0) + { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit Tx URB failed %d\n", status); + return STATUS_FAILURE; + } + return STATUS_PENDING; + } + else { + pContext->bBoolInUse = FALSE; + return STATUS_RESOURCES; + } +} + +/* + * Description: s_nsBulkOutIoCompleteWrite + * 1a) Indicate to the protocol the status of the write. + * 1b) Return ownership of the packet to the protocol. + * + * 2) If any more packets are queue for sending, send another packet + * to USBD. + * If the attempt to send the packet to the driver fails, + * return ownership of the packet to the protocol and + * try another packet (until one succeeds). + * + * Parameters: + * In: + * pdoUsbDevObj - pointer to the USB device object which + * completed the irp + * pIrp - the irp which was completed by the + * device object + * pContext - the context given to IoSetCompletionRoutine + * before calling IoCallDriver on the irp + * The pContext is a pointer to the USB device object. + * Out: + * none + * + * Return Value: STATUS_MORE_PROCESSING_REQUIRED - allows the completion routine + * (IofCompleteRequest) to stop working on the irp. + * + */ +//2007-0508-07by MikeLiu +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))&&(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) +static +VOID +s_nsBulkOutIoCompleteWrite( + IN struct urb *urb, + IN struct pt_regs *regs + ) +#else + +static +VOID +s_nsBulkOutIoCompleteWrite( + IN struct urb *urb + ) +#endif +{ + PSDevice pDevice; + NTSTATUS status; + CONTEXT_TYPE ContextType; + ULONG ulBufLen; + PUSB_SEND_CONTEXT pContext; + + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsBulkOutIoCompleteWrite\n"); + // + // The context given to IoSetCompletionRoutine is an USB_CONTEXT struct + // + pContext = (PUSB_SEND_CONTEXT) urb->context; + ASSERT( NULL != pContext ); + + pDevice = pContext->pDevice; + ContextType = pContext->Type; + ulBufLen = pContext->uBufLen; + + if (!netif_device_present(pDevice->dev)) + return; + + // + // Perform various IRP, URB, and buffer 'sanity checks' + // + + status = urb->status; + //we should have failed, succeeded, or cancelled, but NOT be pending + STAvUpdateUSBCounter(&pDevice->scStatistic.USB_BulkOutStat, status); + + if(status == STATUS_SUCCESS) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Write %d bytes\n",(int)ulBufLen); + pDevice->ulBulkOutBytesWrite += ulBufLen; + pDevice->ulBulkOutContCRCError = 0; + //2007-0115-06by MikeLiu + #ifdef TxInSleep + pDevice->nTxDataTimeCout = 0; + #endif + + } else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BULK Out failed %d\n", status); + pDevice->ulBulkOutError++; + } + +// pDevice->ulCheckForHangCount = 0; +// pDevice->pPendingBulkOutContext = NULL; + + if ( CONTEXT_DATA_PACKET == ContextType ) { + // Indicate to the protocol the status of the sent packet and return + // ownership of the packet. + if (pContext->pPacket != NULL) { + dev_kfree_skb_irq(pContext->pPacket); + pContext->pPacket = NULL; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"tx %d bytes\n",(int)ulBufLen); + } + + pDevice->dev->trans_start = jiffies; + + + if (status == STATUS_SUCCESS) { + pDevice->packetsSent++; + } + else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Send USB error! [%08xh]\n", status); + pDevice->packetsSentDropped++; + } + + } + if (pDevice->bLinkPass == TRUE) { + if (netif_queue_stopped(pDevice->dev)) + netif_wake_queue(pDevice->dev); + } + pContext->bBoolInUse = FALSE; + + return; +} -- cgit v1.2.3 From 4bd12be758df187d3f4af158609b67d384d2f91c Mon Sep 17 00:00:00 2001 From: Alexander Beregalov Date: Fri, 3 Jul 2009 09:52:59 +0400 Subject: Staging: vt6656: remove dependency on kernel version Signed-off-by: Alexander Beregalov Acked-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/bssdb.c | 9 -- drivers/staging/vt6656/device.h | 5 - drivers/staging/vt6656/device_cfg.h | 4 - drivers/staging/vt6656/dpc.c | 15 --- drivers/staging/vt6656/iwctl.c | 56 --------- drivers/staging/vt6656/kcompat.h | 232 ------------------------------------ drivers/staging/vt6656/main_usb.c | 111 ----------------- drivers/staging/vt6656/usbpipe.c | 132 -------------------- drivers/staging/vt6656/wcmd.c | 5 - drivers/staging/vt6656/wmgr.c | 15 --- 10 files changed, 584 deletions(-) (limited to 'drivers/staging/vt6656/usbpipe.c') diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c index 563fddc306c6..58348cf10d06 100644 --- a/drivers/staging/vt6656/bssdb.c +++ b/drivers/staging/vt6656/bssdb.c @@ -1300,12 +1300,7 @@ if((pMgmt->eCurrState!=WMAC_STATE_ASSOC) && wpahdr->req_ie_len = 0; skb_put(pDevice->skb, sizeof(viawget_wpa_header)); pDevice->skb->dev = pDevice->wpadev; -//2008-4-3 modify by Chester for wpa -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) pDevice->skb->mac_header = pDevice->skb->data; -#else - pDevice->skb->mac.raw = pDevice->skb->data; -#endif pDevice->skb->pkt_type = PACKET_HOST; pDevice->skb->protocol = htons(ETH_P_802_2); memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb)); @@ -1345,11 +1340,7 @@ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bIsRoaming %d, !\n", pDevice->bIsRoaming ); wpahdr->req_ie_len = 0; skb_put(pDevice->skb, sizeof(viawget_wpa_header)); pDevice->skb->dev = pDevice->wpadev; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) pDevice->skb->mac_header = pDevice->skb->data; -#else - pDevice->skb->mac.raw = pDevice->skb->data; -#endif pDevice->skb->pkt_type = PACKET_HOST; pDevice->skb->protocol = htons(ETH_P_802_2); memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb)); diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index 143aa76abef3..91e2f8fcddd8 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -57,11 +57,6 @@ #include #include #include //James - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) -#include -#endif - #include #include #include diff --git a/drivers/staging/vt6656/device_cfg.h b/drivers/staging/vt6656/device_cfg.h index f272c98e7a2c..e8acc9067713 100644 --- a/drivers/staging/vt6656/device_cfg.h +++ b/drivers/staging/vt6656/device_cfg.h @@ -27,10 +27,6 @@ #ifndef __DEVICE_CONFIG_H #define __DEVICE_CONFIG_H -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) -#include -#endif - #include #if !defined(__TTYPE_H__) diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c index 702304b356a9..a90d0924b85d 100644 --- a/drivers/staging/vt6656/dpc.c +++ b/drivers/staging/vt6656/dpc.c @@ -674,12 +674,7 @@ RXbBulkInProcessData ( skb->data += 8; skb->tail += 8; skb_put(skb, FrameSize); -//2008-4-3 modify by Chester for wpa -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) skb->mac_header = skb->data; -#else - skb->mac.raw = skb->data; -#endif skb->pkt_type = PACKET_OTHERHOST; skb->protocol = htons(ETH_P_802_2); memset(skb->cb, 0, sizeof(skb->cb)); @@ -836,12 +831,7 @@ RXbBulkInProcessData ( skb->data += (cbIVOffset + 8); skb->tail += (cbIVOffset + 8); skb_put(skb, FrameSize); -//2008-4-3 modify by Chester for wpa -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) skb->mac_header = skb->data; -#else - skb->mac.raw = skb->data; -#endif skb->pkt_type = PACKET_OTHERHOST; skb->protocol = htons(ETH_P_802_2); memset(skb->cb, 0, sizeof(skb->cb)); @@ -961,12 +951,7 @@ RXbBulkInProcessData ( wpahdr->req_ie_len = 0; skb_put(pDevice->skb, sizeof(viawget_wpa_header)); pDevice->skb->dev = pDevice->wpadev; -//2008-4-3 modify by Chester for wpa -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) pDevice->skb->mac_header = pDevice->skb->data; -#else - pDevice->skb->mac.raw = pDevice->skb->data; -#endif pDevice->skb->pkt_type = PACKET_HOST; pDevice->skb->protocol = htons(ETH_P_802_2); memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb)); diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index e6f8c1852339..7b42a1a60a8f 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -337,22 +337,14 @@ int iwctl_giwscan(struct net_device *dev, iwe.cmd = SIOCGIWAP; iwe.u.ap_addr.sa_family = ARPHRD_ETHER; memcpy(iwe.u.ap_addr.sa_data, pBSS->abyBSSID, WLAN_BSSID_LEN); - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) //mike add current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_ADDR_LEN); - #else - current_ev = iwe_stream_add_event(current_ev,end_buf, &iwe, IW_EV_ADDR_LEN); - #endif //ADD ssid memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWESSID; pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID; iwe.u.data.length = pItemSSID->len; iwe.u.data.flags = 1; - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) //mike add current_ev = iwe_stream_add_point(info,current_ev,end_buf, &iwe, pItemSSID->abySSID); - #else - current_ev = iwe_stream_add_point(current_ev,end_buf, &iwe, pItemSSID->abySSID); - #endif //ADD mode memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWMODE; @@ -363,11 +355,7 @@ int iwctl_giwscan(struct net_device *dev, iwe.u.mode = IW_MODE_ADHOC; } iwe.len = IW_EV_UINT_LEN; - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) //mike add current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_UINT_LEN); - #else - current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_UINT_LEN); - #endif //ADD frequency pSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abySuppRates; pExtSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abyExtSuppRates; @@ -376,11 +364,7 @@ int iwctl_giwscan(struct net_device *dev, iwe.u.freq.m = pBSS->uChannel; iwe.u.freq.e = 0; iwe.u.freq.i = 0; - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) //mike add current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); - #else - current_ev = iwe_stream_add_event(current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); - #endif //2008-0409-04, by Einsn Liu { int f = (int)pBSS->uChannel - 1; @@ -388,11 +372,7 @@ int iwctl_giwscan(struct net_device *dev, iwe.u.freq.m = frequency_list[f] * 100000; iwe.u.freq.e = 1; } - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) //mike add current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); - #else - current_ev = iwe_stream_add_event(current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); - #endif //ADD quality memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVQUAL; @@ -442,11 +422,7 @@ int iwctl_giwscan(struct net_device *dev, iwe.u.qual.qual = 0; } */ - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) //mike add current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); - #else - current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); - #endif //ADD encryption memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWENCODE; @@ -456,11 +432,7 @@ int iwctl_giwscan(struct net_device *dev, }else { iwe.u.data.flags = IW_ENCODE_DISABLED; } - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) //mike add current_ev = iwe_stream_add_point(info,current_ev,end_buf, &iwe, pItemSSID->abySSID); - #else - current_ev = iwe_stream_add_point(current_ev,end_buf, &iwe, pItemSSID->abySSID); - #endif memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWRATE; @@ -472,22 +444,14 @@ int iwctl_giwscan(struct net_device *dev, break; // Bit rate given in 500 kb/s units (+ 0x80) iwe.u.bitrate.value = ((pSuppRates->abyRates[kk] & 0x7f) * 500000); - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) //mike add current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); - #else - current_val = iwe_stream_add_value(current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); - #endif } for (kk = 0 ; kk < 8 ; kk++) { if (pExtSuppRates->abyRates[kk] == 0) break; // Bit rate given in 500 kb/s units (+ 0x80) iwe.u.bitrate.value = ((pExtSuppRates->abyRates[kk] & 0x7f) * 500000); - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) //mike add current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); - #else - current_val = iwe_stream_add_value(current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); - #endif } if((current_val - current_ev) > IW_EV_LCP_LEN) @@ -498,33 +462,21 @@ int iwctl_giwscan(struct net_device *dev, iwe.cmd = IWEVCUSTOM; sprintf(buf, "bcn_int=%d", pBSS->wBeaconInterval); iwe.u.data.length = strlen(buf); - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) //mike add current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, buf); - #else - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, buf); - #endif #if WIRELESS_EXT > 17 if ((pBSS->wWPALen > 0) && (pBSS->wWPALen <= MAX_WPA_IE_LEN)) { memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVGENIE; iwe.u.data.length = pBSS->wWPALen; - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) //mike add current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, pBSS->byWPAIE); - #else - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, pBSS->byWPAIE); - #endif } if ((pBSS->wRSNLen > 0) && (pBSS->wRSNLen <= MAX_WPA_IE_LEN)) { memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVGENIE; iwe.u.data.length = pBSS->wRSNLen; - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) //mike add current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, pBSS->byRSNIE); - #else - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, pBSS->byRSNIE); - #endif } #else // WIRELESS_EXT > 17 @@ -537,11 +489,7 @@ int iwctl_giwscan(struct net_device *dev, p += sprintf(p, "%02x", pBSS->byWPAIE[ii]); } iwe.u.data.length = strlen(buf); - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) //mike add current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, buf); - #else - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, buf); - #endif } @@ -554,11 +502,7 @@ int iwctl_giwscan(struct net_device *dev, p += sprintf(p, "%02x", pBSS->byRSNIE[ii]); } iwe.u.data.length = strlen(buf); - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) //mike add current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, buf); - #else - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, buf); - #endif } #endif #endif diff --git a/drivers/staging/vt6656/kcompat.h b/drivers/staging/vt6656/kcompat.h index 370483d36f12..3dc209c9f9e1 100644 --- a/drivers/staging/vt6656/kcompat.h +++ b/drivers/staging/vt6656/kcompat.h @@ -70,246 +70,14 @@ typedef void irqreturn_t; #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - #define vntwusb_submit_urb(val) usb_submit_urb(val, GFP_ATOMIC) #define vntwusb_alloc_urb(val) usb_alloc_urb(val, GFP_ATOMIC) -#else -#define vntwusb_alloc_urb(val) usb_alloc_urb(val) -#define vntwusb_submit_urb(val) usb_submit_urb(val) - -#endif - - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) #define vntwusb_unlink_urb(val) usb_kill_urb(val) -#else -#define vntwusb_unlink_urb(val) usb_unlink_urb(val) - -#endif - - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18) - -typedef unsigned long dma_addr_t; -typedef struct wait_queue *wait_queue_head_t; -#define init_waitqueue_head(x) *(x)=NULL -#define set_current_state(status) { current->state = (status); mb(); } - -#ifdef MODULE - -#define module_init(fn) int init_module (void) { return fn(); } -#define module_exit(fn) void cleanup_module(void) { return fn(); } - -#else /* MODULE */ - -#define module_init(fn) int e100_probe (void) { return fn(); } -#define module_exit(fn) /* NOTHING */ - -#endif /* MODULE */ - -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18) */ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) - -#ifdef MODVERSIONS -#include -#endif - -#include -#include -#include -#include - -#define pci_resource_start(dev, bar) \ - (((dev)->base_address[(bar)] & PCI_BASE_ADDRESS_SPACE_IO) ? \ - ((dev)->base_address[(bar)] & PCI_BASE_ADDRESS_IO_MASK) : \ - ((dev)->base_address[(bar)] & PCI_BASE_ADDRESS_MEM_MASK)) - -static inline int pci_enable_device(struct pci_dev *dev) { return 0; } -#define __constant_cpu_to_le32 cpu_to_le32 -#define __constant_cpu_to_le16 cpu_to_le16 - -#define PCI_DMA_TODEVICE 1 -#define PCI_DMA_FROMDEVICE 2 - -extern inline void *pci_alloc_consistent (struct pci_dev *dev, - size_t size, - dma_addr_t *dma_handle) { - void *vaddr = kmalloc(size, GFP_ATOMIC); - if(vaddr != NULL) { - *dma_handle = virt_to_bus(vaddr); - } - return vaddr; -} - -#define pci_dma_sync_single(dev,dma_handle,size,direction) do{} while(0) -#define pci_dma_supported(dev, addr_mask) (1) -#define pci_free_consistent(dev, size, cpu_addr, dma_handle) kfree(cpu_addr) -#define pci_map_single(dev, addr, size, direction) virt_to_bus(addr) -#define pci_unmap_single(dev, dma_handle, size, direction) do{} while(0) - - -#define spin_lock_bh spin_lock_irq -#define spin_unlock_bh spin_unlock_irq -#define del_timer_sync(timer) del_timer(timer) -#define net_device device - -#define netif_start_queue(dev) ( clear_bit(0, &(dev)->tbusy)) -#define netif_stop_queue(dev) ( set_bit(0, &(dev)->tbusy)) -#define netif_wake_queue(dev) { clear_bit(0, &(dev)->tbusy); \ - mark_bh(NET_BH); } -#define netif_running(dev) ( test_bit(0, &(dev)->start)) -#define netif_queue_stopped(dev) ( test_bit(0, &(dev)->tbusy)) - -#define netif_device_attach(dev) \ - do{ (dev)->start = 1; netif_start_queue(dev); } while (0) -#define netif_device_detach(dev) \ - do{ (dev)->start = 0; netif_stop_queue(dev); } while (0) - -#define dev_kfree_skb_irq(skb) dev_kfree_skb(skb) - -#define netif_carrier_on(dev) do {} while (0) -#define netif_carrier_off(dev) do {} while (0) - - -#define PCI_ANY_ID (~0U) - -struct pci_device_id { - unsigned int vendor, device; - unsigned int subvendor, subdevice; - unsigned int class, classmask; - unsigned long driver_data; -}; - -#define MODULE_DEVICE_TABLE(bus, dev_table) -#define PCI_MAX_NUM_NICS 256 - -struct pci_driver { - char *name; - struct pci_device_id *id_table; - int (*probe)(struct pci_dev *dev, const struct pci_device_id *id); - void (*remove)(struct pci_dev *dev); - void (*suspend)(struct pci_dev *dev); - void (*resume)(struct pci_dev *dev); - struct pci_dev *pcimap[PCI_MAX_NUM_NICS]; -}; - -static inline int pci_module_init(struct pci_driver *drv) -{ - struct pci_dev *pdev; - struct pci_device_id *pcid; - uint16_t subvendor, subdevice; - int board_count = 0; - - /* walk the global pci device list looking for matches */ - for (pdev = pci_devices; pdev && (board_count < PCI_MAX_NUM_NICS); pdev = pdev->next) { - - pcid = &drv->id_table[0]; - pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &subvendor); - pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &subdevice); - - while (pcid->vendor != 0) { - if (((pcid->vendor == pdev->vendor) || (pcid->vendor == PCI_ANY_ID)) && - ((pcid->device == pdev->device) || (pcid->device == PCI_ANY_ID)) && - ((pcid->subvendor == subvendor) || (pcid->subvendor == PCI_ANY_ID)) && - ((pcid->subdevice == subdevice) || (pcid->subdevice == PCI_ANY_ID))) { - - if (drv->probe(pdev, pcid) == 0) { - drv->pcimap[board_count] = pdev; - board_count++; - } - break; - } - pcid++; - } - } - - if (board_count < PCI_MAX_NUM_NICS) { - drv->pcimap[board_count] = NULL; - } - - return (board_count > 0) ? 0 : -ENODEV; -} - -static inline void pci_unregister_driver(struct pci_driver *drv) -{ - int i; - - for (i = 0; i < PCI_MAX_NUM_NICS; i++) { - if (!drv->pcimap[i]) - break; - - drv->remove(drv->pcimap[i]); - } -} - - -#define pci_set_drvdata(pcid, data) - -#define pci_get_drvdata(pcid) ({ \ - PSDevice pInfo; \ - for (pInfo = pDevice_Infos; \ - pInfo; pInfo = pInfo->next) { \ - if (pInfo->pcid == pcid) \ - break; \ - } \ - pInfo; }) - -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) */ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,5) - -#define skb_linearize(skb, gfp_mask) ({ \ - struct sk_buff *tmp_skb; \ - tmp_skb = skb; \ - skb = skb_copy(tmp_skb, gfp_mask); \ - dev_kfree_skb_irq(tmp_skb); }) - -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,4,5) */ - #ifndef MODULE_LICESEN #define MODULE_LICESEN(x) #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,6) - -#include -#include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,2) -static inline int pci_set_power_state(struct pci_dev* pcid, int state) { return 0; } -#endif - -#define PMCSR 0xe0 -#define PM_ENABLE_BIT 0x0100 -#define PM_CLEAR_BIT 0x8000 -#define PM_STATE_MASK 0xFFFC -#define PM_STATE_D1 0x0001 - -static inline int -pci_enable_wake(struct pci_dev *dev, u32 state, int enable) -{ - u16 p_state; - - pci_read_config_word(dev, PMCSR, &p_state); - pci_write_config_word(dev, PMCSR, p_state | PM_CLEAR_BIT); - - if (enable == 0) { - p_state &= ~PM_ENABLE_BIT; - } else { - p_state |= PM_ENABLE_BIT; - } - p_state &= PM_STATE_MASK; - p_state |= state; - - pci_write_config_word(dev, PMCSR, p_state); - - return 0; -} -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,4,6) */ - #endif diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 722b73910d73..f94bdff4e94c 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -150,19 +150,11 @@ MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION(DEVICE_FULL_DRV_NAM); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) #define DEVICE_PARAM(N,D) \ static int N[MAX_UINTS]=OPTION_DEFAULT;\ module_param_array(N, int, NULL, 0);\ MODULE_PARM_DESC(N, D); -#else -#define DEVICE_PARAM(N,D) \ - static const int N[MAX_UINTS]=OPTION_DEFAULT;\ - MODULE_PARM(N, "1-" __MODULE_STRING(MAX_UINTS) "i");\ - MODULE_PARM_DESC(N, D); -#endif - #define RX_DESC_MIN0 16 #define RX_DESC_MAX0 128 #define RX_DESC_DEF0 64 @@ -331,19 +323,12 @@ struct iw_request_info {}; /*--------------------- Static Functions --------------------------*/ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - static int vntwusb_found1(struct usb_interface *intf, const struct usb_device_id *id); static void vntwusb_disconnect(struct usb_interface *intf); #ifdef CONFIG_PM /* Minimal support for suspend and resume */ static int vntwusb_suspend(struct usb_interface *intf, pm_message_t message); static int vntwusb_resume(struct usb_interface *intf); #endif -#else - -static void* vntwusb_found1(struct usb_device *udev, UINT interface, const struct usb_device_id *id); -static void vntwusb_disconnect(struct usb_device *udev, void *ptr); -#endif static struct net_device_stats *device_get_stats(struct net_device *dev); static int device_open(struct net_device *dev); static int device_xmit(struct sk_buff *skb, struct net_device *dev); @@ -370,10 +355,7 @@ static int Config_FileGetParameter(UCHAR *string, UCHAR *dest,UCHAR *source); //2008-0714by Mike Liu static BOOL device_release_WPADEV(PSDevice pDevice); -//2007-1107-01by MikeLiu -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) static void usb_device_reset(PSDevice pDevice); -#endif @@ -778,12 +760,7 @@ static BOOL device_release_WPADEV(PSDevice pDevice) wpahdr->req_ie_len = 0; skb_put(pDevice->skb, sizeof(viawget_wpa_header)); pDevice->skb->dev = pDevice->wpadev; -//2008-4-3 modify by Chester for wpa -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) pDevice->skb->mac_header = pDevice->skb->data; -#else - pDevice->skb->mac.raw = pDevice->skb->data; -#endif pDevice->skb->pkt_type = PACKET_HOST; pDevice->skb->protocol = htons(ETH_P_802_2); memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb)); @@ -848,23 +825,12 @@ static const struct net_device_ops device_netdev_ops = { }; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - static int vntwusb_found1(struct usb_interface *intf, const struct usb_device_id *id) -#else - -static void * -vntwusb_found1(struct usb_device *udev, UINT interface, const struct usb_device_id *id) -#endif { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) BYTE fake_mac[U_ETHER_ADDR_LEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x01};//fake MAC address -#endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) struct usb_device *udev = interface_to_usbdev(intf); int rc = 0; -#endif struct net_device *netdev = NULL; PSDevice pDevice = NULL; @@ -872,16 +838,9 @@ vntwusb_found1(struct usb_device *udev, UINT interface, const struct usb_device_ printk(KERN_NOTICE "%s Ver. %s\n",DEVICE_FULL_DRV_NAM, DEVICE_VERSION); printk(KERN_NOTICE "Copyright (c) 2004 VIA Networking Technologies, Inc.\n"); -//2008-0922-01by MikeLiu, add usb counter. -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) udev = usb_get_dev(udev); -#endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) netdev = alloc_etherdev(sizeof(DEVICE_INFO)); -#else - netdev = init_etherdev(netdev, 0); -#endif if (netdev == NULL) { printk(KERN_ERR DEVICE_NAME ": allocate net device failed \n"); @@ -895,11 +854,6 @@ vntwusb_found1(struct usb_device *udev, UINT interface, const struct usb_device_ pDevice->dev = netdev; pDevice->usb = udev; - // Chain it all together -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - SET_MODULE_OWNER(netdev); -#endif - // Set initial settings device_set_options(pDevice); spin_lock_init(&pDevice->lock); @@ -912,9 +866,6 @@ vntwusb_found1(struct usb_device *udev, UINT interface, const struct usb_device_ #ifdef WIRELESS_EXT //2007-0508-01by MikeLiu - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - netdev->get_wireless_stats = iwctl_get_wireless_stats; - #endif #if WIRELESS_EXT > 12 netdev->wireless_handlers = (struct iw_handler_def *)&iwctl_handler_def; @@ -922,17 +873,11 @@ vntwusb_found1(struct usb_device *udev, UINT interface, const struct usb_device_ #endif /* WIRELESS_EXT > 12 */ #endif /* WIRELESS_EXT */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - //2008-0623-01by MikeLiu //2007-0821-01by MikeLiu - // #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) usb_set_intfdata(intf, pDevice); SET_NETDEV_DEV(netdev, &intf->dev); - //#endif - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) memcpy(pDevice->dev->dev_addr, fake_mac, U_ETHER_ADDR_LEN); //use fake mac address - #endif rc = register_netdev(netdev); if (rc != 0) { printk(KERN_ERR DEVICE_NAME " Failed to register netdev\n"); @@ -956,10 +901,7 @@ vntwusb_found1(struct usb_device *udev, UINT interface, const struct usb_device_ kfree(pDevice); } -//2007-1107-03by MikeLiu - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) usb_device_reset(pDevice); - #endif #ifdef SndEvt_ToAPI { @@ -972,21 +914,13 @@ vntwusb_found1(struct usb_device *udev, UINT interface, const struct usb_device_ #endif return 0; -#else - return pDevice; -#endif err_nomem: -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - //2008-0922-01by MikeLiu, decrease usb counter. usb_put_dev(udev); return -ENOMEM; -#else - return NULL; -#endif } @@ -1032,7 +966,6 @@ static VOID device_free_rx_bufs(PSDevice pDevice) { } //2007-1107-02by MikeLiu -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) static void usb_device_reset(PSDevice pDevice) { int status; @@ -1041,7 +974,6 @@ static void usb_device_reset(PSDevice pDevice) printk("usb_device_reset fail status=%d\n",status); return ; } -#endif static VOID device_free_int_bufs(PSDevice pDevice) { @@ -1269,11 +1201,7 @@ static int device_open(struct net_device *dev) { tasklet_init(&pDevice->ReadWorkItem, (void *)RXvWorkItem, (unsigned long)pDevice); tasklet_init(&pDevice->EventWorkItem, (void *)INTvWorkItem, (unsigned long)pDevice); add_timer(&(pDevice->sMgmtObj.sTimerSecondCallback)); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) pDevice->int_interval = 100; //Max 100 microframes. -#else - pDevice->int_interval = 0x10; //16 microframes interval(~2ms) for usb 2.0 -#endif pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; pDevice->bIsRxWorkItemQueued = TRUE; @@ -1354,9 +1282,7 @@ static int device_close(struct net_device *dev) { PSDevice pDevice=(PSDevice) netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) int uu; - #endif DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_close1 \n"); if (pDevice == NULL) @@ -1381,8 +1307,6 @@ static int device_close(struct net_device *dev) { //2008-0714-01by MikeLiu device_release_WPADEV(pDevice); - //2007-0821-01by MikeLiu - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); pMgmt->bShareKeyAlgorithm = FALSE; pDevice->bEncryptionEnable = FALSE; @@ -1391,7 +1315,6 @@ device_release_WPADEV(pDevice); for(uu=0;uulock); - #endif if ((pDevice->flags & DEVICE_FLAGS_UNPLUG) == FALSE) { MACbShutdown(pDevice); @@ -1444,22 +1367,12 @@ device_release_WPADEV(pDevice); return 0; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) static void vntwusb_disconnect(struct usb_interface *intf) -#else - -static void vntwusb_disconnect(struct usb_device *udev, void *ptr) -#endif { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) PSDevice pDevice = usb_get_intfdata(intf); -#else - PSDevice pDevice = (PSDevice)ptr; -#endif - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_disconnect1.. \n"); if (pDevice == NULL) @@ -1477,14 +1390,10 @@ static void vntwusb_disconnect(struct usb_device *udev, void *ptr) //2008-0714-01by MikeLiu device_release_WPADEV(pDevice); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - usb_set_intfdata(intf, NULL); //2008-0922-01by MikeLiu, decrease usb counter. usb_put_dev(interface_to_usbdev(intf)); -#endif - pDevice->flags |= DEVICE_FLAGS_UNPLUG; if (pDevice->dev != NULL) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "unregister_netdev..\n"); @@ -1495,11 +1404,7 @@ device_release_WPADEV(pDevice); if(wpa_set_wpadev(pDevice, 0)!=0) printk("unregister wpadev fail?\n"); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) free_netdev(pDevice->dev); -#else - kfree(pDevice->dev); -#endif } kfree(pDevice); @@ -2360,12 +2265,7 @@ static int ethtool_ioctl(struct net_device *dev, void *useraddr) MODULE_DEVICE_TABLE(usb, vntwusb_table); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - static struct usb_driver vntwusb_driver = { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) - .owner = THIS_MODULE, -#endif .name = DEVICE_NAME, .probe = vntwusb_found1, .disconnect = vntwusb_disconnect, @@ -2379,17 +2279,6 @@ static struct usb_driver vntwusb_driver = { #endif }; -#else - -static struct usb_driver vntwusb_driver = { - name: DEVICE_NAME, - probe: vntwusb_found1, - disconnect: vntwusb_disconnect, - id_table: vntwusb_table, -}; - -#endif - static int __init vntwusb_init_module(void) { printk(KERN_NOTICE DEVICE_FULL_DRV_NAM " " DEVICE_VERSION); diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c index 625ffb60e631..97efd87ddddb 100644 --- a/drivers/staging/vt6656/usbpipe.c +++ b/drivers/staging/vt6656/usbpipe.c @@ -86,49 +86,6 @@ static int msglevel =MSG_LEVEL_INFO; /*--------------------- Static Variables --------------------------*/ /*--------------------- Static Functions --------------------------*/ -//2007-0508-02by MikeLiu -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))&&(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) - -static -VOID -s_nsInterruptUsbIoCompleteRead( - IN struct urb *urb, - IN struct pt_regs *regs - ); - - -static -VOID -s_nsBulkInUsbIoCompleteRead( - IN struct urb *urb, - IN struct pt_regs *regs - ); - - -static -VOID -s_nsBulkOutIoCompleteWrite( - IN struct urb *urb, - IN struct pt_regs *regs - ); - - -static -VOID -s_nsControlInUsbIoCompleteRead( - IN struct urb *urb, - IN struct pt_regs *regs - ); - -static -VOID -s_nsControlInUsbIoCompleteWrite( - IN struct urb *urb, - IN struct pt_regs *regs - ); - -#else - static VOID s_nsInterruptUsbIoCompleteRead( @@ -162,9 +119,6 @@ s_nsControlInUsbIoCompleteWrite( IN struct urb *urb ); -#endif - - /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ @@ -338,23 +292,11 @@ PIPEnsControlIn( return ntStatus; } -//2007-0508-03by MikeLiu -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))&&(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) - -static -VOID -s_nsControlInUsbIoCompleteWrite( - IN struct urb *urb, - IN struct pt_regs *regs - ) -#else - static VOID s_nsControlInUsbIoCompleteWrite( IN struct urb *urb ) -#endif { PSDevice pDevice; @@ -391,23 +333,11 @@ s_nsControlInUsbIoCompleteWrite( * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver * */ - -//2007-0508-04by MikeLiu -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))&&(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) -static -VOID -s_nsControlInUsbIoCompleteRead( - IN struct urb *urb, - IN struct pt_regs *regs - ) -#else - static VOID s_nsControlInUsbIoCompleteRead( IN struct urb *urb ) -#endif { PSDevice pDevice; @@ -488,10 +418,7 @@ PIPEnsInterruptRead( ); #else -//2008-0526-01by MikeLiu -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) pDevice->pInterruptURB->interval = pDevice->int_interval; -#endif usb_fill_bulk_urb(pDevice->pInterruptURB, pDevice->usb, @@ -503,19 +430,10 @@ usb_fill_bulk_urb(pDevice->pInterruptURB, #endif #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) if ((ntStatus = vntwusb_submit_urb(pDevice->pInterruptURB)) != 0) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit int URB failed %d\n", ntStatus); } -#else - if (pDevice->bEventAvailable == FALSE) { - if ((ntStatus = vntwusb_submit_urb(pDevice->pInterruptURB)) != 0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit int URB failed %d\n", ntStatus); - } - } -#endif - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"<----s_nsStartInterruptUsbRead Return(%x)\n",ntStatus); return ntStatus; } @@ -535,23 +453,12 @@ usb_fill_bulk_urb(pDevice->pInterruptURB, * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver * */ -//2007-0508-05by MikeLiu -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))&&(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) -static -VOID -s_nsInterruptUsbIoCompleteRead( - IN struct urb *urb, - IN struct pt_regs *regs - ) -#else - static VOID s_nsInterruptUsbIoCompleteRead( IN struct urb *urb ) -#endif { PSDevice pDevice; NTSTATUS ntStatus; @@ -603,18 +510,9 @@ s_nsInterruptUsbIoCompleteRead( if (pDevice->fKillEventPollingThread != TRUE) { #if 0 //reserve int URB submit - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) if ((ntStatus = vntwusb_submit_urb(urb)) != 0) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Re-Submit int URB failed %d\n", ntStatus); } - - #else - if (pDevice->bEventAvailable == FALSE) { - if ((ntStatus = vntwusb_submit_urb(urb)) != 0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Re-Submit int URB failed %d\n", ntStatus); - } - } - #endif #else //replace int URB submit by bulk transfer #ifdef Safe_Close usb_fill_bulk_urb(pDevice->pInterruptURB, @@ -625,18 +523,10 @@ s_nsInterruptUsbIoCompleteRead( s_nsInterruptUsbIoCompleteRead, pDevice); - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) if ((ntStatus = vntwusb_submit_urb(pDevice->pInterruptURB)) != 0) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit int URB failed %d\n", ntStatus); } - #else - if (pDevice->bEventAvailable == FALSE) { - if ((ntStatus = vntwusb_submit_urb(pDevice->pInterruptURB)) != 0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit int URB failed %d\n", ntStatus); - } - } - #endif #else tasklet_schedule(&pDevice->EventWorkItem); #endif @@ -725,23 +615,12 @@ PIPEnsBulkInUsbRead( * Return Value: STATUS_INSUFFICIENT_RESOURCES or result of IoCallDriver * */ -//2007-0508-06by MikeLiu -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))&&(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) -static -VOID -s_nsBulkInUsbIoCompleteRead( - IN struct urb *urb, - IN struct pt_regs *regs - ) -#else - static VOID s_nsBulkInUsbIoCompleteRead( IN struct urb *urb ) -#endif { PRCB pRCB = (PRCB)urb->context; PSDevice pDevice = (PSDevice)pRCB->pDevice; @@ -895,22 +774,11 @@ PIPEnsSendBulkOut( * (IofCompleteRequest) to stop working on the irp. * */ -//2007-0508-07by MikeLiu -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))&&(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) -static -VOID -s_nsBulkOutIoCompleteWrite( - IN struct urb *urb, - IN struct pt_regs *regs - ) -#else - static VOID s_nsBulkOutIoCompleteWrite( IN struct urb *urb ) -#endif { PSDevice pDevice; NTSTATUS status; diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index 7c0829ee0ac0..80d7ca73bcd9 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -524,12 +524,7 @@ vRunCommand( (pMgmt->uScanChannel < CB_MAX_CHANNEL_24G)) { s_vProbeChannel(pDevice); spin_unlock_irq(&pDevice->lock); - //2008-0526-02by MikeLiu - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) vCommandTimerWait((HANDLE)pDevice, 100); - #else - vCommandTimerWait((HANDLE)pDevice, WCMD_ACTIVE_SCAN_TIME); - #endif return; } else { spin_unlock_irq(&pDevice->lock); diff --git a/drivers/staging/vt6656/wmgr.c b/drivers/staging/vt6656/wmgr.c index 89eb965744cd..5879e484b971 100644 --- a/drivers/staging/vt6656/wmgr.c +++ b/drivers/staging/vt6656/wmgr.c @@ -1053,12 +1053,7 @@ s_vMgrRxAssocResponse( ); skb_put(pDevice->skb, sizeof(viawget_wpa_header) + wpahdr->resp_ie_len + wpahdr->req_ie_len); pDevice->skb->dev = pDevice->wpadev; -//2008-4-3 modify by Chester for wpa -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) pDevice->skb->mac_header = pDevice->skb->data; -#else - pDevice->skb->mac.raw = pDevice->skb->data; -#endif pDevice->skb->pkt_type = PACKET_HOST; pDevice->skb->protocol = htons(ETH_P_802_2); memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb)); @@ -1697,12 +1692,7 @@ s_vMgrRxDisassociation( wpahdr->req_ie_len = 0; skb_put(pDevice->skb, sizeof(viawget_wpa_header)); pDevice->skb->dev = pDevice->wpadev; -//2008-4-3 modify by Chester for wpa -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) pDevice->skb->mac_header = pDevice->skb->data; -#else - pDevice->skb->mac.raw = pDevice->skb->data; -#endif pDevice->skb->pkt_type = PACKET_HOST; pDevice->skb->protocol = htons(ETH_P_802_2); memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb)); @@ -1805,12 +1795,7 @@ s_vMgrRxDeauthentication( wpahdr->req_ie_len = 0; skb_put(pDevice->skb, sizeof(viawget_wpa_header)); pDevice->skb->dev = pDevice->wpadev; -//2008-4-3 modify by Chester for wpa -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) pDevice->skb->mac_header = pDevice->skb->data; -#else - pDevice->skb->mac.raw = pDevice->skb->data; -#endif pDevice->skb->pkt_type = PACKET_HOST; pDevice->skb->protocol = htons(ETH_P_802_2); memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb)); -- cgit v1.2.3