From ff8041bb7ca15bc5c6048e8598a896819cbec417 Mon Sep 17 00:00:00 2001 From: Daniel Kenji Toyama Date: Tue, 30 Mar 2010 00:28:19 +1100 Subject: [PATCH] Staging: vt6656: int.c: Fixed Coding Style issues Fixed almost all the issues given by checkpatch.pl except for one warning about an 81 character line, which cannot really be decomposed (the code is a bit too nested there). Signed-off-by: Daniel Kenji Toyama Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/int.c | 250 ++++++++++++++++++++--------------- 1 file changed, 141 insertions(+), 109 deletions(-) diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c index 35053be6900..824c67de0ea 100644 --- a/drivers/staging/vt6656/int.c +++ b/drivers/staging/vt6656/int.c @@ -41,8 +41,8 @@ #include "usbpipe.h" /*--------------------- Static Definitions -------------------------*/ -//static int msglevel =MSG_LEVEL_DEBUG; -static int msglevel =MSG_LEVEL_INFO; +/* static int msglevel = MSG_LEVEL_DEBUG; */ +static int msglevel = MSG_LEVEL_INFO; /*--------------------- Static Classes ----------------------------*/ @@ -74,120 +74,152 @@ static int msglevel =MSG_LEVEL_INFO; * * Notes: * - * USB reads are by nature 'Blocking', and when in a read, the device looks like it's - * in a 'stall' condition, so we deliberately time out every second if we've gotten no data + * USB reads are by nature 'Blocking', and when in a read, the device looks + * like it's in a 'stall' condition, so we deliberately time out every second + * if we've gotten no data * -*/ VOID -INTvWorkItem( - PVOID Context - ) +INTvWorkItem(PVOID Context) { - PSDevice pDevice = (PSDevice) Context; - NTSTATUS ntStatus; + PSDevice pDevice = (PSDevice) Context; + NTSTATUS ntStatus; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Interrupt Polling Thread\n"); - - spin_lock_irq(&pDevice->lock); - if (pDevice->fKillEventPollingThread != TRUE) { - ntStatus = PIPEnsInterruptRead(pDevice); - } - spin_unlock_irq(&pDevice->lock); - - } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Interrupt Polling Thread\n"); + spin_lock_irq(&pDevice->lock); + if (pDevice->fKillEventPollingThread != TRUE) + ntStatus = PIPEnsInterruptRead(pDevice); + spin_unlock_irq(&pDevice->lock); +} NTSTATUS -INTnsProcessData( - IN PSDevice pDevice - ) +INTnsProcessData(IN PSDevice pDevice) { - NTSTATUS status = STATUS_SUCCESS; - PSINTData pINTData; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - struct net_device_stats* pStats = &pDevice->stats; - - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsInterruptProcessData\n"); - - pINTData = (PSINTData) pDevice->intBuf.pDataBuf; - if (pINTData->byTSR0 & TSR_VALID) { - STAvUpdateTDStatCounter (&(pDevice->scStatistic), (BYTE) (pINTData->byPkt0 & 0x0F), (BYTE) (pINTData->byPkt0>>4), pINTData->byTSR0); - BSSvUpdateNodeTxCounter (pDevice, &(pDevice->scStatistic), pINTData->byTSR0, pINTData->byPkt0); - //DBG_PRN_GRP01(("TSR0 %02x\n", pINTData->byTSR0)); - } - if (pINTData->byTSR1 & TSR_VALID) { - STAvUpdateTDStatCounter (&(pDevice->scStatistic), (BYTE) (pINTData->byPkt1 & 0x0F), (BYTE) (pINTData->byPkt1>>4), pINTData->byTSR1); - BSSvUpdateNodeTxCounter (pDevice, &(pDevice->scStatistic), pINTData->byTSR1, pINTData->byPkt1); - //DBG_PRN_GRP01(("TSR1 %02x\n", pINTData->byTSR1)); - } - if (pINTData->byTSR2 & TSR_VALID) { - STAvUpdateTDStatCounter (&(pDevice->scStatistic), (BYTE) (pINTData->byPkt2 & 0x0F), (BYTE) (pINTData->byPkt2>>4), pINTData->byTSR2); - BSSvUpdateNodeTxCounter (pDevice, &(pDevice->scStatistic), pINTData->byTSR2, pINTData->byPkt2); - //DBG_PRN_GRP01(("TSR2 %02x\n", pINTData->byTSR2)); - } - if (pINTData->byTSR3 & TSR_VALID) { - STAvUpdateTDStatCounter (&(pDevice->scStatistic), (BYTE) (pINTData->byPkt3 & 0x0F), (BYTE) (pINTData->byPkt3>>4), pINTData->byTSR3); - BSSvUpdateNodeTxCounter (pDevice, &(pDevice->scStatistic), pINTData->byTSR3, pINTData->byPkt3); - //DBG_PRN_GRP01(("TSR3 %02x\n", pINTData->byTSR3)); - } - if ( pINTData->byISR0 != 0 ) { - if (pINTData->byISR0 & ISR_BNTX) { - - if (pDevice->eOPMode == OP_MODE_AP) { - if(pMgmt->byDTIMCount > 0) { - pMgmt->byDTIMCount --; - pMgmt->sNodeDBTable[0].bRxPSPoll = FALSE; - } else if(pMgmt->byDTIMCount == 0) { - // check if mutltcast tx bufferring - pMgmt->byDTIMCount = pMgmt->byDTIMPeriod - 1; - pMgmt->sNodeDBTable[0].bRxPSPoll = TRUE; - if (pMgmt->sNodeDBTable[0].bPSEnable) { - bScheduleCommand((HANDLE)pDevice, WLAN_CMD_RX_PSPOLL, NULL); - } - } - bScheduleCommand((HANDLE)pDevice, WLAN_CMD_BECON_SEND, NULL); - } // if (pDevice->eOPMode == OP_MODE_AP) - - pDevice->bBeaconSent = TRUE; - } else { - pDevice->bBeaconSent = FALSE; - } - if (pINTData->byISR0 & ISR_TBTT) { - if ( pDevice->bEnablePSMode ) { - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_TBTT_WAKEUP, NULL); - } - if ( pDevice->bChannelSwitch ) { - pDevice->byChannelSwitchCount--; - if ( pDevice->byChannelSwitchCount == 0 ) { - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_11H_CHSW, NULL); - } - } - } - LODWORD(pDevice->qwCurrTSF) = pINTData->dwLoTSF; - HIDWORD(pDevice->qwCurrTSF) = pINTData->dwHiTSF; - //DBG_PRN_GRP01(("ISR0 = %02x ,LoTsf = %08x,HiTsf = %08x\n", pINTData->byISR0, pINTData->dwLoTSF,pINTData->dwHiTSF)); - - STAvUpdate802_11Counter(&pDevice->s802_11Counter, &pDevice->scStatistic, pINTData->byRTSSuccess, - pINTData->byRTSFail, pINTData->byACKFail, pINTData->byFCSErr ); - STAvUpdateIsrStatCounter(&pDevice->scStatistic, pINTData->byISR0, pINTData->byISR1); - - } - - if ( pINTData->byISR1 != 0 ) { - if (pINTData->byISR1 & ISR_GPIO3) { - bScheduleCommand((HANDLE) pDevice, WLAN_CMD_RADIO, NULL); - } - } - pDevice->intBuf.uDataLen = 0; - pDevice->intBuf.bInUse = FALSE; - - pStats->tx_packets = pDevice->scStatistic.ullTsrOK; - pStats->tx_bytes = pDevice->scStatistic.ullTxDirectedBytes + - pDevice->scStatistic.ullTxMulticastBytes + - pDevice->scStatistic.ullTxBroadcastBytes; - pStats->tx_errors = pDevice->scStatistic.dwTsrErr; - pStats->tx_dropped = pDevice->scStatistic.dwTsrErr; - - return status; + NTSTATUS status = STATUS_SUCCESS; + PSINTData pINTData; + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct net_device_stats *pStats = &pDevice->stats; + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsInterruptProcessData\n"); + + pINTData = (PSINTData) pDevice->intBuf.pDataBuf; + if (pINTData->byTSR0 & TSR_VALID) { + STAvUpdateTDStatCounter(&(pDevice->scStatistic), + (BYTE) (pINTData->byPkt0 & 0x0F), + (BYTE) (pINTData->byPkt0>>4), + pINTData->byTSR0); + BSSvUpdateNodeTxCounter(pDevice, + &(pDevice->scStatistic), + pINTData->byTSR0, + pINTData->byPkt0); + /*DBG_PRN_GRP01(("TSR0 %02x\n", pINTData->byTSR0));*/ + } + if (pINTData->byTSR1 & TSR_VALID) { + STAvUpdateTDStatCounter(&(pDevice->scStatistic), + (BYTE) (pINTData->byPkt1 & 0x0F), + (BYTE) (pINTData->byPkt1>>4), + pINTData->byTSR1); + BSSvUpdateNodeTxCounter(pDevice, + &(pDevice->scStatistic), + pINTData->byTSR1, + pINTData->byPkt1); + /*DBG_PRN_GRP01(("TSR1 %02x\n", pINTData->byTSR1));*/ + } + if (pINTData->byTSR2 & TSR_VALID) { + STAvUpdateTDStatCounter(&(pDevice->scStatistic), + (BYTE) (pINTData->byPkt2 & 0x0F), + (BYTE) (pINTData->byPkt2>>4), + pINTData->byTSR2); + BSSvUpdateNodeTxCounter(pDevice, + &(pDevice->scStatistic), + pINTData->byTSR2, + pINTData->byPkt2); + /*DBG_PRN_GRP01(("TSR2 %02x\n", pINTData->byTSR2));*/ + } + if (pINTData->byTSR3 & TSR_VALID) { + STAvUpdateTDStatCounter(&(pDevice->scStatistic), + (BYTE) (pINTData->byPkt3 & 0x0F), + (BYTE) (pINTData->byPkt3>>4), + pINTData->byTSR3); + BSSvUpdateNodeTxCounter(pDevice, + &(pDevice->scStatistic), + pINTData->byTSR3, + pINTData->byPkt3); + /*DBG_PRN_GRP01(("TSR3 %02x\n", pINTData->byTSR3));*/ + } + if (pINTData->byISR0 != 0) { + if (pINTData->byISR0 & ISR_BNTX) { + if (pDevice->eOPMode == OP_MODE_AP) { + if (pMgmt->byDTIMCount > 0) { + pMgmt->byDTIMCount--; + pMgmt->sNodeDBTable[0].bRxPSPoll = + FALSE; + } else if (pMgmt->byDTIMCount == 0) { + /* check if mutltcast tx bufferring */ + pMgmt->byDTIMCount = + pMgmt->byDTIMPeriod-1; + pMgmt->sNodeDBTable[0].bRxPSPoll = TRUE; + if (pMgmt->sNodeDBTable[0].bPSEnable) + bScheduleCommand((HANDLE)pDevice, + WLAN_CMD_RX_PSPOLL, + NULL); + } + bScheduleCommand((HANDLE)pDevice, + WLAN_CMD_BECON_SEND, + NULL); + } /* if (pDevice->eOPMode == OP_MODE_AP) */ + pDevice->bBeaconSent = TRUE; + } else { + pDevice->bBeaconSent = FALSE; + } + if (pINTData->byISR0 & ISR_TBTT) { + if (pDevice->bEnablePSMode) + bScheduleCommand((HANDLE) pDevice, + WLAN_CMD_TBTT_WAKEUP, + NULL); + if (pDevice->bChannelSwitch) { + pDevice->byChannelSwitchCount--; + if (pDevice->byChannelSwitchCount == 0) + bScheduleCommand((HANDLE) pDevice, + WLAN_CMD_11H_CHSW, + NULL); + } + } + LODWORD(pDevice->qwCurrTSF) = pINTData->dwLoTSF; + HIDWORD(pDevice->qwCurrTSF) = pINTData->dwHiTSF; + /*DBG_PRN_GRP01(("ISR0 = %02x , + LoTsf = %08x, + HiTsf = %08x\n", + pINTData->byISR0, + pINTData->dwLoTSF, + pINTData->dwHiTSF)); */ + + STAvUpdate802_11Counter(&pDevice->s802_11Counter, + &pDevice->scStatistic, + pINTData->byRTSSuccess, + pINTData->byRTSFail, + pINTData->byACKFail, + pINTData->byFCSErr); + STAvUpdateIsrStatCounter(&pDevice->scStatistic, + pINTData->byISR0, + pINTData->byISR1); + } + + if (pINTData->byISR1 != 0) + if (pINTData->byISR1 & ISR_GPIO3) + bScheduleCommand((HANDLE) pDevice, + WLAN_CMD_RADIO, + NULL); + pDevice->intBuf.uDataLen = 0; + pDevice->intBuf.bInUse = FALSE; + + pStats->tx_packets = pDevice->scStatistic.ullTsrOK; + pStats->tx_bytes = pDevice->scStatistic.ullTxDirectedBytes + + pDevice->scStatistic.ullTxMulticastBytes + + pDevice->scStatistic.ullTxBroadcastBytes; + pStats->tx_errors = pDevice->scStatistic.dwTsrErr; + pStats->tx_dropped = pDevice->scStatistic.dwTsrErr; + + return status; } -- 2.20.1