Commit ec6e0f63 authored by Andres More's avatar Andres More Committed by Greg Kroah-Hartman

staging: vt6656: fix C99 // comments in main_usb.c

Resolved 'do not use C99 // comments' checkpatch errors.
Many warnings about odd indentation were left.
Signed-off-by: default avatarAndres More <more.andres@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d3e23951
...@@ -73,15 +73,16 @@ ...@@ -73,15 +73,16 @@
#include "iowpa.h" #include "iowpa.h"
/*--------------------- Static Definitions -------------------------*/ /*--------------------- Static Definitions -------------------------*/
//static int msglevel =MSG_LEVEL_DEBUG; /* static int msglevel = MSG_LEVEL_DEBUG; */
static int msglevel =MSG_LEVEL_INFO; static int msglevel =MSG_LEVEL_INFO;
// /*
// Define module options * define module options
// */
// Version Information /* version information */
#define DRIVER_AUTHOR "VIA Networking Technologies, Inc., <lyndonchen@vntek.com.tw>" #define DRIVER_AUTHOR \
"VIA Networking Technologies, Inc., <lyndonchen@vntek.com.tw>"
MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION(DEVICE_FULL_DRV_NAM); MODULE_DESCRIPTION(DEVICE_FULL_DRV_NAM);
...@@ -184,16 +185,16 @@ DEVICE_PARAM(BasebandType, "baseband type"); ...@@ -184,16 +185,16 @@ DEVICE_PARAM(BasebandType, "baseband type");
DEVICE_PARAM(b80211hEnable, "802.11h mode"); DEVICE_PARAM(b80211hEnable, "802.11h mode");
// /*
// Static vars definitions * Static vars definitions
// */
static struct usb_device_id vt6656_table[] = { static struct usb_device_id vt6656_table[] = {
{USB_DEVICE(VNT_USB_VENDOR_ID, VNT_USB_PRODUCT_ID)}, {USB_DEVICE(VNT_USB_VENDOR_ID, VNT_USB_PRODUCT_ID)},
{} {}
}; };
// Frequency list (map channels to frequencies) /* frequency list (map channels to frequencies) */
/* /*
static const long frequency_list[] = { static const long frequency_list[] = {
2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484, 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484,
...@@ -288,7 +289,7 @@ device_set_options(struct vnt_private *pDevice) { ...@@ -288,7 +289,7 @@ device_set_options(struct vnt_private *pDevice) {
pDevice->wCTSDuration = 0; pDevice->wCTSDuration = 0;
pDevice->byPreambleType = 0; pDevice->byPreambleType = 0;
pDevice->bExistSWNetAddr = FALSE; pDevice->bExistSWNetAddr = FALSE;
// pDevice->bDiversityRegCtlON = TRUE; /* pDevice->bDiversityRegCtlON = TRUE; */
pDevice->bDiversityRegCtlON = FALSE; pDevice->bDiversityRegCtlON = FALSE;
} }
...@@ -314,9 +315,9 @@ static void device_init_diversity_timer(struct vnt_private *pDevice) ...@@ -314,9 +315,9 @@ static void device_init_diversity_timer(struct vnt_private *pDevice)
} }
// /*
// Initialization of MAC & BBP registers * initialization of MAC & BBP registers
// */
static int device_init_registers(struct vnt_private *pDevice, static int device_init_registers(struct vnt_private *pDevice,
DEVICE_INIT_TYPE InitType) DEVICE_INIT_TYPE InitType)
...@@ -372,7 +373,7 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -372,7 +373,7 @@ static int device_init_registers(struct vnt_private *pDevice,
sInitCmd.byShortRetryLimit = pDevice->byShortRetryLimit; sInitCmd.byShortRetryLimit = pDevice->byShortRetryLimit;
sInitCmd.byLongRetryLimit = pDevice->byLongRetryLimit; sInitCmd.byLongRetryLimit = pDevice->byLongRetryLimit;
//issue Card_init command to device /* issue card_init command to device */
ntStatus = CONTROLnsRequestOut(pDevice, ntStatus = CONTROLnsRequestOut(pDevice,
MESSAGE_TYPE_CARDINIT, MESSAGE_TYPE_CARDINIT,
0, 0,
...@@ -395,7 +396,7 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -395,7 +396,7 @@ static int device_init_registers(struct vnt_private *pDevice,
return FALSE; return FALSE;
} }
//Local ID for AES functions /* local ID for AES functions */
ntStatus = CONTROLnsRequestIn(pDevice, ntStatus = CONTROLnsRequestIn(pDevice,
MESSAGE_TYPE_READ, MESSAGE_TYPE_READ,
MAC_REG_LOCALID, MAC_REG_LOCALID,
...@@ -408,10 +409,12 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -408,10 +409,12 @@ static int device_init_registers(struct vnt_private *pDevice,
return FALSE; return FALSE;
} }
// Do MACbSoftwareReset in MACvInitialize /* do MACbSoftwareReset in MACvInitialize */
// force CCK
/* force CCK */
pDevice->bCCK = TRUE; pDevice->bCCK = TRUE;
pDevice->bProtectMode = FALSE; //Only used in 11g type, sync with ERP IE pDevice->bProtectMode = FALSE;
/* only used in 11g type, sync with ERP IE */
pDevice->bNonERPPresent = FALSE; pDevice->bNonERPPresent = FALSE;
pDevice->bBarkerPreambleMd = FALSE; pDevice->bBarkerPreambleMd = FALSE;
if ( pDevice->bFixRate ) { if ( pDevice->bFixRate ) {
...@@ -427,13 +430,14 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -427,13 +430,14 @@ static int device_init_registers(struct vnt_private *pDevice,
pDevice->byTopOFDMBasicRate = RATE_24M; pDevice->byTopOFDMBasicRate = RATE_24M;
pDevice->byTopCCKBasicRate = RATE_1M; pDevice->byTopCCKBasicRate = RATE_1M;
pDevice->byRevId = 0; //Target to IF pin while programming to RF chip. pDevice->byRevId = 0;
/* target to IF pin while programming to RF chip */
pDevice->byCurPwr = 0xFF; pDevice->byCurPwr = 0xFF;
pDevice->byCCKPwr = pDevice->abyEEPROM[EEP_OFS_PWR_CCK]; pDevice->byCCKPwr = pDevice->abyEEPROM[EEP_OFS_PWR_CCK];
pDevice->byOFDMPwrG = pDevice->abyEEPROM[EEP_OFS_PWR_OFDMG]; pDevice->byOFDMPwrG = pDevice->abyEEPROM[EEP_OFS_PWR_OFDMG];
// Load power Table /* load power table */
for (ii=0;ii<14;ii++) { for (ii = 0; ii < 14; ii++) {
pDevice->abyCCKPwrTbl[ii] = pDevice->abyEEPROM[ii + EEP_OFS_CCK_PWR_TBL]; pDevice->abyCCKPwrTbl[ii] = pDevice->abyEEPROM[ii + EEP_OFS_CCK_PWR_TBL];
if (pDevice->abyCCKPwrTbl[ii] == 0) if (pDevice->abyCCKPwrTbl[ii] == 0)
pDevice->abyCCKPwrTbl[ii] = pDevice->byCCKPwr; pDevice->abyCCKPwrTbl[ii] = pDevice->byCCKPwr;
...@@ -442,8 +446,10 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -442,8 +446,10 @@ static int device_init_registers(struct vnt_private *pDevice,
pDevice->abyOFDMPwrTbl[ii] = pDevice->byOFDMPwrG; pDevice->abyOFDMPwrTbl[ii] = pDevice->byOFDMPwrG;
} }
//original zonetype is USA,but customize zonetype is europe, /*
// then need recover 12,13 ,14 channel with 11 channel * original zonetype is USA, but custom zonetype is Europe,
* then need to recover 12, 13, 14 channels with 11 channel
*/
if(((pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Japan) || if(((pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Japan) ||
(pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Europe))&& (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Europe))&&
(pDevice->byOriginalZonetype == ZoneType_USA)) { (pDevice->byOriginalZonetype == ZoneType_USA)) {
...@@ -453,15 +459,14 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -453,15 +459,14 @@ static int device_init_registers(struct vnt_private *pDevice,
} }
} }
//{{ RobertYu: 20041124 pDevice->byOFDMPwrA = 0x34; /* same as RFbMA2829SelectChannel */
pDevice->byOFDMPwrA = 0x34; // same as RFbMA2829SelectChannel
// Load OFDM A Power Table /* load OFDM A power table */
for (ii=0;ii<CB_MAX_CHANNEL_5G;ii++) { //RobertYu:20041224, bug using CB_MAX_CHANNEL for (ii = 0; ii < CB_MAX_CHANNEL_5G; ii++) {
pDevice->abyOFDMAPwrTbl[ii] = pDevice->abyEEPROM[ii + EEP_OFS_OFDMA_PWR_TBL]; pDevice->abyOFDMAPwrTbl[ii] = pDevice->abyEEPROM[ii + EEP_OFS_OFDMA_PWR_TBL];
if (pDevice->abyOFDMAPwrTbl[ii] == 0) if (pDevice->abyOFDMAPwrTbl[ii] == 0)
pDevice->abyOFDMAPwrTbl[ii] = pDevice->byOFDMPwrA; pDevice->abyOFDMAPwrTbl[ii] = pDevice->byOFDMPwrA;
} }
//}} RobertYu
byAntenna = pDevice->abyEEPROM[EEP_OFS_ANTENNA]; byAntenna = pDevice->abyEEPROM[EEP_OFS_ANTENNA];
if (byAntenna & EEP_ANTINV) if (byAntenna & EEP_ANTINV)
...@@ -471,7 +476,7 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -471,7 +476,7 @@ static int device_init_registers(struct vnt_private *pDevice,
byAntenna &= (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN); byAntenna &= (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN);
if (byAntenna == 0) // if not set default is All if (byAntenna == 0) /* if not set default is both */
byAntenna = (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN); byAntenna = (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN);
if (byAntenna == (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN)) { if (byAntenna == (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN)) {
...@@ -513,35 +518,34 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -513,35 +518,34 @@ static int device_init_registers(struct vnt_private *pDevice,
pDevice->byTMax2 = 4; pDevice->byTMax2 = 4;
pDevice->ulSQ3TH = 0; pDevice->ulSQ3TH = 0;
pDevice->byTMax3 = 64; pDevice->byTMax3 = 64;
// -----------------------------------------------------------------
//Get Auto Fall Back Type /* get Auto Fall Back type */
pDevice->byAutoFBCtrl = AUTO_FB_0; pDevice->byAutoFBCtrl = AUTO_FB_0;
// Set SCAN Time /* set SCAN Time */
pDevice->uScanTime = WLAN_SCAN_MINITIME; pDevice->uScanTime = WLAN_SCAN_MINITIME;
// default Auto Mode /* default Auto Mode */
//pDevice->NetworkType = Ndis802_11Automode; /* pDevice->NetworkType = Ndis802_11Automode; */
pDevice->eConfigPHYMode = PHY_TYPE_AUTO; pDevice->eConfigPHYMode = PHY_TYPE_AUTO;
pDevice->byBBType = BB_TYPE_11G; pDevice->byBBType = BB_TYPE_11G;
// initialize BBP registers /* initialize BBP registers */
pDevice->ulTxPower = 25; pDevice->ulTxPower = 25;
// Get Channel range /* get channel range */
pDevice->byMinChannel = 1; pDevice->byMinChannel = 1;
pDevice->byMaxChannel = CB_MAX_CHANNEL; pDevice->byMaxChannel = CB_MAX_CHANNEL;
// Get RFType /* get RFType */
pDevice->byRFType = sInitRsp.byRFType; pDevice->byRFType = sInitRsp.byRFType;
if ((pDevice->byRFType & RF_EMU) != 0) { if ((pDevice->byRFType & RF_EMU) != 0) {
// force change RevID for VT3253 emu /* force change RevID for VT3253 emu */
pDevice->byRevId = 0x80; pDevice->byRevId = 0x80;
} }
// Load EEPROM calibrated vt3266 parameters /* load vt3266 calibration parameters in EEPROM */
if (pDevice->byRFType == RF_VT3226D0) { if (pDevice->byRFType == RF_VT3226D0) {
if((pDevice->abyEEPROM[EEP_OFS_MAJOR_VER] == 0x1) && if((pDevice->abyEEPROM[EEP_OFS_MAJOR_VER] == 0x1) &&
(pDevice->abyEEPROM[EEP_OFS_MINOR_VER] >= 0x4)) { (pDevice->abyEEPROM[EEP_OFS_MINOR_VER] >= 0x4)) {
...@@ -549,13 +553,32 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -549,13 +553,32 @@ static int device_init_registers(struct vnt_private *pDevice,
byCalibTXDC = pDevice->abyEEPROM[EEP_OFS_CALIB_TX_DC]; byCalibTXDC = pDevice->abyEEPROM[EEP_OFS_CALIB_TX_DC];
byCalibRXIQ = pDevice->abyEEPROM[EEP_OFS_CALIB_RX_IQ]; byCalibRXIQ = pDevice->abyEEPROM[EEP_OFS_CALIB_RX_IQ];
if( (byCalibTXIQ || byCalibTXDC || byCalibRXIQ) ) { if( (byCalibTXIQ || byCalibTXDC || byCalibRXIQ) ) {
ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xFF, 0x03); // CR255, Set BB to support TX/RX IQ and DC compensation Mode /* CR255, enable TX/RX IQ and DC compensation mode */
ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xFB, byCalibTXIQ); // CR251, TX I/Q Imbalance Calibration ControlvWriteByte(pDevice,
ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xFC, byCalibTXDC); // CR252, TX DC-Offset Calibration MESSAGE_REQUEST_BBREG,
ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xFD, byCalibRXIQ); // CR253, RX I/Q Imbalance Calibration 0xFF,
0x03);
/* CR251, TX I/Q Imbalance Calibration */
ControlvWriteByte(pDevice,
MESSAGE_REQUEST_BBREG,
0xFB,
byCalibTXIQ);
/* CR252, TX DC-Offset Calibration */
ControlvWriteByte(pDevice,
MESSAGE_REQUEST_BBREG,
0xFC,
byCalibTXDC);
/* CR253, RX I/Q Imbalance Calibration */
ControlvWriteByte(pDevice,
MESSAGE_REQUEST_BBREG,
0xFD,
byCalibRXIQ);
} else { } else {
// turn off BB Calibration compensation /* CR255, turn off BB Calibration compensation */
ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xFF, 0x0); // CR255 ControlvWriteByte(pDevice,
MESSAGE_REQUEST_BBREG,
0xFF,
0x0);
} }
} }
} }
...@@ -564,20 +587,21 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -564,20 +587,21 @@ static int device_init_registers(struct vnt_private *pDevice,
pMgmt->uIBSSChannel = pDevice->uChannel; pMgmt->uIBSSChannel = pDevice->uChannel;
CARDbSetMediaChannel(pDevice, pMgmt->uCurrChannel); CARDbSetMediaChannel(pDevice, pMgmt->uCurrChannel);
// get Permanent network address /* get permanent network address */
memcpy(pDevice->abyPermanentNetAddr,&(sInitRsp.byNetAddr[0]),6); memcpy(pDevice->abyPermanentNetAddr,&(sInitRsp.byNetAddr[0]),6);
memcpy(pDevice->abyCurrentNetAddr, memcpy(pDevice->abyCurrentNetAddr,
pDevice->abyPermanentNetAddr, pDevice->abyPermanentNetAddr,
ETH_ALEN); ETH_ALEN);
// if exist SW network address, use SW network address. /* if exist SW network address, use it */
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Network address = %pM\n", DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Network address = %pM\n",
pDevice->abyCurrentNetAddr); pDevice->abyCurrentNetAddr);
} }
// Set BB and packet type at the same time. /*
// Set Short Slot Time, xIFS, and RSPINF. * set BB and packet type at the same time
* set Short Slot Time, xIFS, and RSPINF
*/
if (pDevice->byBBType == BB_TYPE_11A) { if (pDevice->byBBType == BB_TYPE_11A) {
CARDbAddBasicRate(pDevice, RATE_6M); CARDbAddBasicRate(pDevice, RATE_6M);
pDevice->bShortSlotTime = TRUE; pDevice->bShortSlotTime = TRUE;
...@@ -616,7 +640,7 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -616,7 +640,7 @@ static int device_init_registers(struct vnt_private *pDevice,
pDevice->bHWRadioOff = FALSE; pDevice->bHWRadioOff = FALSE;
} }
} //EEP_RADIOCTL_ENABLE }
ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_TMLEN,0x38); ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_TMLEN,0x38);
ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW);
...@@ -741,7 +765,7 @@ static void device_free_tx_bufs(struct vnt_private *pDevice) ...@@ -741,7 +765,7 @@ static void device_free_tx_bufs(struct vnt_private *pDevice)
for (ii = 0; ii < pDevice->cbTD; ii++) { for (ii = 0; ii < pDevice->cbTD; ii++) {
pTxContext = pDevice->apTD[ii]; pTxContext = pDevice->apTD[ii];
//de-allocate URBs /* deallocate URBs */
if (pTxContext->pUrb) { if (pTxContext->pUrb) {
usb_kill_urb(pTxContext->pUrb); usb_kill_urb(pTxContext->pUrb);
usb_free_urb(pTxContext->pUrb); usb_free_urb(pTxContext->pUrb);
...@@ -760,12 +784,12 @@ static void device_free_rx_bufs(struct vnt_private *pDevice) ...@@ -760,12 +784,12 @@ static void device_free_rx_bufs(struct vnt_private *pDevice)
for (ii = 0; ii < pDevice->cbRD; ii++) { for (ii = 0; ii < pDevice->cbRD; ii++) {
pRCB = pDevice->apRCB[ii]; pRCB = pDevice->apRCB[ii];
//de-allocate URBs /* deallocate URBs */
if (pRCB->pUrb) { if (pRCB->pUrb) {
usb_kill_urb(pRCB->pUrb); usb_kill_urb(pRCB->pUrb);
usb_free_urb(pRCB->pUrb); usb_free_urb(pRCB->pUrb);
} }
//de-allocate skb /* deallocate skb */
if (pRCB->skb) if (pRCB->skb)
dev_kfree_skb(pRCB->skb); dev_kfree_skb(pRCB->skb);
} }
...@@ -807,7 +831,7 @@ static BOOL device_alloc_bufs(struct vnt_private *pDevice) ...@@ -807,7 +831,7 @@ static BOOL device_alloc_bufs(struct vnt_private *pDevice)
} }
pDevice->apTD[ii] = pTxContext; pDevice->apTD[ii] = pTxContext;
pTxContext->pDevice = (void *) pDevice; pTxContext->pDevice = (void *) pDevice;
//allocate URBs /* allocate URBs */
pTxContext->pUrb = usb_alloc_urb(0, GFP_ATOMIC); pTxContext->pUrb = usb_alloc_urb(0, GFP_ATOMIC);
if (pTxContext->pUrb == NULL) { if (pTxContext->pUrb == NULL) {
DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "alloc tx urb failed\n"); DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "alloc tx urb failed\n");
...@@ -816,7 +840,7 @@ static BOOL device_alloc_bufs(struct vnt_private *pDevice) ...@@ -816,7 +840,7 @@ static BOOL device_alloc_bufs(struct vnt_private *pDevice)
pTxContext->bBoolInUse = FALSE; pTxContext->bBoolInUse = FALSE;
} }
// allocate rcb mem /* allocate RCB mem */
pDevice->pRCBMem = kzalloc((sizeof(RCB) * pDevice->cbRD), GFP_KERNEL); pDevice->pRCBMem = kzalloc((sizeof(RCB) * pDevice->cbRD), GFP_KERNEL);
if (pDevice->pRCBMem == NULL) { if (pDevice->pRCBMem == NULL) {
DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s : alloc rx usb context failed\n", pDevice->dev->name); DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s : alloc rx usb context failed\n", pDevice->dev->name);
...@@ -835,7 +859,7 @@ static BOOL device_alloc_bufs(struct vnt_private *pDevice) ...@@ -835,7 +859,7 @@ static BOOL device_alloc_bufs(struct vnt_private *pDevice)
pDevice->apRCB[ii] = pRCB; pDevice->apRCB[ii] = pRCB;
pRCB->pDevice = (void *) pDevice; pRCB->pDevice = (void *) pDevice;
//allocate URBs /* allocate URBs */
pRCB->pUrb = usb_alloc_urb(0, GFP_ATOMIC); pRCB->pUrb = usb_alloc_urb(0, GFP_ATOMIC);
if (pRCB->pUrb == NULL) { if (pRCB->pUrb == NULL) {
...@@ -974,7 +998,7 @@ static int device_open(struct net_device *dev) ...@@ -974,7 +998,7 @@ static int device_open(struct net_device *dev)
MP_SET_FLAG(pDevice, fMP_POST_READS); MP_SET_FLAG(pDevice, fMP_POST_READS);
MP_SET_FLAG(pDevice, fMP_POST_WRITES); MP_SET_FLAG(pDevice, fMP_POST_WRITES);
//read config file /* read config file */
Read_config_file(pDevice); Read_config_file(pDevice);
if (device_init_registers(pDevice, DEVICE_INIT_COLD) == FALSE) { if (device_init_registers(pDevice, DEVICE_INIT_COLD) == FALSE) {
...@@ -983,8 +1007,8 @@ static int device_open(struct net_device *dev) ...@@ -983,8 +1007,8 @@ static int device_open(struct net_device *dev)
} }
device_set_multi(pDevice->dev); device_set_multi(pDevice->dev);
// Init for Key Management
/* init for key management */
KeyvInitTable(pDevice,&pDevice->sKey); KeyvInitTable(pDevice,&pDevice->sKey);
memcpy(pDevice->vnt_mgmt.abyMACAddr, memcpy(pDevice->vnt_mgmt.abyMACAddr,
pDevice->abyCurrentNetAddr, ETH_ALEN); pDevice->abyCurrentNetAddr, ETH_ALEN);
...@@ -1003,7 +1027,7 @@ static int device_open(struct net_device *dev) ...@@ -1003,7 +1027,7 @@ static int device_open(struct net_device *dev)
tasklet_init(&pDevice->ReadWorkItem, (void *)RXvWorkItem, (unsigned long)pDevice); tasklet_init(&pDevice->ReadWorkItem, (void *)RXvWorkItem, (unsigned long)pDevice);
tasklet_init(&pDevice->EventWorkItem, (void *)INTvWorkItem, (unsigned long)pDevice); tasklet_init(&pDevice->EventWorkItem, (void *)INTvWorkItem, (unsigned long)pDevice);
add_timer(&pDevice->vnt_mgmt.sTimerSecondCallback); add_timer(&pDevice->vnt_mgmt.sTimerSecondCallback);
pDevice->int_interval = 100; //Max 100 microframes. pDevice->int_interval = 100; /* max 100 microframes */
pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
pDevice->bIsRxWorkItemQueued = TRUE; pDevice->bIsRxWorkItemQueued = TRUE;
...@@ -1021,7 +1045,7 @@ static int device_open(struct net_device *dev) ...@@ -1021,7 +1045,7 @@ static int device_open(struct net_device *dev)
RXvWorkItem(pDevice); RXvWorkItem(pDevice);
INTvWorkItem(pDevice); INTvWorkItem(pDevice);
// Patch: if WEP key already set by iwconfig but device not yet open /* if WEP key already set by iwconfig but device not yet open */
if ((pDevice->bEncryptionEnable == TRUE) && (pDevice->bTransmitKey == TRUE)) { if ((pDevice->bEncryptionEnable == TRUE) && (pDevice->bTransmitKey == TRUE)) {
spin_lock_irq(&pDevice->lock); spin_lock_irq(&pDevice->lock);
KeybSetDefaultKey( pDevice, KeybSetDefaultKey( pDevice,
...@@ -1221,7 +1245,7 @@ static inline u32 ether_crc(int length, unsigned char *data) ...@@ -1221,7 +1245,7 @@ static inline u32 ether_crc(int length, unsigned char *data)
return crc; return crc;
} }
//find out the start position of str2 from str1 /* find out the start position of str2 from str1 */
static unsigned char *kstrstr(const unsigned char *str1, static unsigned char *kstrstr(const unsigned char *str1,
const unsigned char *str2) { const unsigned char *str2) {
int str1_len = strlen(str1); int str1_len = strlen(str1);
...@@ -1250,12 +1274,12 @@ static int Config_FileGetParameter(unsigned char *string, ...@@ -1250,12 +1274,12 @@ static int Config_FileGetParameter(unsigned char *string,
strcat(buf1, "="); strcat(buf1, "=");
source+=strlen(buf1); source+=strlen(buf1);
//find target string start point /* find target string start point */
start_p = kstrstr(source,buf1); start_p = kstrstr(source,buf1);
if (start_p == NULL) if (start_p == NULL)
return FALSE; return FALSE;
//check if current config line is marked by "#" ?? /* check if current config line is marked by "#" */
for (ii = 1; ; ii++) { for (ii = 1; ; ii++) {
if (memcmp(start_p - ii, "\n", 1) == 0) if (memcmp(start_p - ii, "\n", 1) == 0)
break; break;
...@@ -1263,24 +1287,24 @@ static int Config_FileGetParameter(unsigned char *string, ...@@ -1263,24 +1287,24 @@ static int Config_FileGetParameter(unsigned char *string,
return FALSE; return FALSE;
} }
//find target string end point /* find target string end point */
end_p = kstrstr(start_p,"\n"); end_p = kstrstr(start_p,"\n");
if (end_p == NULL) { //can't find "\n",but don't care if (end_p == NULL) { /* can't find "\n", but don't care */
end_p=start_p+strlen(start_p); //no include "\n" end_p = start_p + strlen(start_p); /* no include "\n" */
} }
memset(buf2,0,100); memset(buf2,0,100);
memcpy(buf2,start_p,end_p-start_p); //get the target line memcpy(buf2, start_p, end_p-start_p); /* get the target line */
buf2[end_p-start_p]='\0'; buf2[end_p-start_p]='\0';
//find value /* find value */
start_p = kstrstr(buf2,"="); start_p = kstrstr(buf2,"=");
if (start_p == NULL) if (start_p == NULL)
return FALSE; return FALSE;
memset(buf1,0,100); memset(buf1,0,100);
strcpy(buf1,start_p+1); strcpy(buf1,start_p+1);
//except space /* except space */
tmp_p = buf1; tmp_p = buf1;
while(*tmp_p != 0x00) { while(*tmp_p != 0x00) {
if(*tmp_p==' ') if(*tmp_p==' ')
...@@ -1293,26 +1317,19 @@ static int Config_FileGetParameter(unsigned char *string, ...@@ -1293,26 +1317,19 @@ static int Config_FileGetParameter(unsigned char *string,
return TRUE; return TRUE;
} }
//if read fail,return NULL,or return data pointer; /* if read fails, return NULL, or return data pointer */
static unsigned char *Config_FileOperation(struct vnt_private *pDevice) static unsigned char *Config_FileOperation(struct vnt_private *pDevice)
{ {
unsigned char *config_path = CONFIG_PATH; unsigned char *config_path = CONFIG_PATH;
unsigned char *buffer = NULL; unsigned char *buffer = NULL;
struct file *filp=NULL; struct file *filp=NULL;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
//int oldfsuid=0,oldfsgid=0;
int result = 0; int result = 0;
set_fs (KERNEL_DS); set_fs (KERNEL_DS);
/* Can't do this anymore, so we rely on correct filesystem permissions:
//Make sure a caller can read or write power as root /* open file */
oldfsuid=current->fsuid;
oldfsgid=current->fsgid;
current->fsuid = 0;
current->fsgid = 0;
*/
//open file
filp = filp_open(config_path, O_RDWR, 0); filp = filp_open(config_path, O_RDWR, 0);
if (IS_ERR(filp)) { if (IS_ERR(filp)) {
printk("Config_FileOperation file Not exist\n"); printk("Config_FileOperation file Not exist\n");
...@@ -1345,11 +1362,6 @@ static unsigned char *Config_FileOperation(struct vnt_private *pDevice) ...@@ -1345,11 +1362,6 @@ static unsigned char *Config_FileOperation(struct vnt_private *pDevice)
error2: error2:
set_fs (old_fs); set_fs (old_fs);
/*
current->fsuid=oldfsuid;
current->fsgid=oldfsgid;
*/
if(result!=0) { if(result!=0) {
kfree(buffer); kfree(buffer);
buffer=NULL; buffer=NULL;
...@@ -1357,14 +1369,14 @@ if(result!=0) { ...@@ -1357,14 +1369,14 @@ if(result!=0) {
return buffer; return buffer;
} }
//return --->-1:fail; >=0:successful /* return --->-1:fail; >=0:successful */
static int Read_config_file(struct vnt_private *pDevice) static int Read_config_file(struct vnt_private *pDevice)
{ {
int result = 0; int result = 0;
unsigned char tmpbuffer[100]; unsigned char tmpbuffer[100];
unsigned char *buffer = NULL; unsigned char *buffer = NULL;
//init config setting /* init config setting */
pDevice->config_file.ZoneType = -1; pDevice->config_file.ZoneType = -1;
pDevice->config_file.eAuthenMode = -1; pDevice->config_file.eAuthenMode = -1;
pDevice->config_file.eEncryptionStatus = -1; pDevice->config_file.eEncryptionStatus = -1;
...@@ -1375,7 +1387,7 @@ static int Read_config_file(struct vnt_private *pDevice) ...@@ -1375,7 +1387,7 @@ static int Read_config_file(struct vnt_private *pDevice)
return result; return result;
} }
//get zonetype /* get zonetype */
{ {
memset(tmpbuffer,0,sizeof(tmpbuffer)); memset(tmpbuffer,0,sizeof(tmpbuffer));
if(Config_FileGetParameter("ZONETYPE",tmpbuffer,buffer) ==TRUE) { if(Config_FileGetParameter("ZONETYPE",tmpbuffer,buffer) ==TRUE) {
...@@ -1394,7 +1406,7 @@ static int Read_config_file(struct vnt_private *pDevice) ...@@ -1394,7 +1406,7 @@ static int Read_config_file(struct vnt_private *pDevice)
} }
} }
//get other parameter /* get other parameter */
{ {
memset(tmpbuffer,0,sizeof(tmpbuffer)); memset(tmpbuffer,0,sizeof(tmpbuffer));
if(Config_FileGetParameter("AUTHENMODE",tmpbuffer,buffer)==TRUE) { if(Config_FileGetParameter("AUTHENMODE",tmpbuffer,buffer)==TRUE) {
...@@ -1435,9 +1447,9 @@ static void device_set_multi(struct net_device *dev) ...@@ -1435,9 +1447,9 @@ static void device_set_multi(struct net_device *dev)
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRxMode in= %x\n", pDevice->byRxMode); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRxMode in= %x\n", pDevice->byRxMode);
if (dev->flags & IFF_PROMISC) { // Set promiscuous. if (dev->flags & IFF_PROMISC) { /* set promiscuous mode */
DBG_PRT(MSG_LEVEL_ERR,KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name); DBG_PRT(MSG_LEVEL_ERR,KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name);
// Unconditionally log net taps. /* unconditionally log net taps */
pDevice->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST|RCR_UNICAST); pDevice->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST|RCR_UNICAST);
} }
else if ((netdev_mc_count(dev) > pDevice->multicast_limit) || else if ((netdev_mc_count(dev) > pDevice->multicast_limit) ||
...@@ -1466,7 +1478,10 @@ static void device_set_multi(struct net_device *dev) ...@@ -1466,7 +1478,10 @@ static void device_set_multi(struct net_device *dev)
} }
if (pMgmt->eConfigMode == WMAC_CONFIG_AP) { if (pMgmt->eConfigMode == WMAC_CONFIG_AP) {
// If AP mode, don't enable RCR_UNICAST. Since hw only compare addr1 with local mac. /*
* If AP mode, don't enable RCR_UNICAST since HW only compares
* addr1 with local MAC
*/
pDevice->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST); pDevice->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST);
pDevice->byRxMode &= ~(RCR_UNICAST); pDevice->byRxMode &= ~(RCR_UNICAST);
} }
...@@ -1530,9 +1545,6 @@ static int ethtool_ioctl(struct net_device *dev, void *useraddr) ...@@ -1530,9 +1545,6 @@ static int ethtool_ioctl(struct net_device *dev, void *useraddr)
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
/*------------------------------------------------------------------*/
MODULE_DEVICE_TABLE(usb, vt6656_table); MODULE_DEVICE_TABLE(usb, vt6656_table);
static struct usb_driver vt6656_driver = { static struct usb_driver vt6656_driver = {
......
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