summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMalcolm Priestley <tvboxspy@gmail.com>2014-05-15 22:49:15 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-15 15:02:19 -0700
commit931cb9ff6eefb5c0e92c1b170ba68f5453aab32f (patch)
tree3700ec34be12f605d7ba681b3cf1f92171a7b8fd /drivers
parente03ce8393e41ddff574c95ac72378ed1f02cef54 (diff)
downloadlinux-931cb9ff6eefb5c0e92c1b170ba68f5453aab32f.tar.gz
linux-931cb9ff6eefb5c0e92c1b170ba68f5453aab32f.tar.bz2
linux-931cb9ff6eefb5c0e92c1b170ba68f5453aab32f.zip
staging: vt6656: lock changes: csMgmt_xmit.
csMgmt_xmit is nolonger atomically called but part of must be. Reorder the function so that RFbSetPower is called first. Add new lock spinlock for the remainder of the function. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/vt6656/rxtx.c50
1 files changed, 27 insertions, 23 deletions
diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 52be7b0d98bb..c6ac263a7cb9 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -1383,13 +1383,32 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice,
u16 wTxBufSize;
u32 cbMacHdLen;
u16 wCurrentRate = RATE_1M;
+ unsigned long flags;
- pContext = s_vGetFreeContext(pDevice);
+ if (pDevice->byBBType == BB_TYPE_11A) {
+ wCurrentRate = RATE_6M;
+ byPktType = PK_TYPE_11A;
+ } else {
+ wCurrentRate = RATE_1M;
+ byPktType = PK_TYPE_11B;
+ }
- if (NULL == pContext) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ManagementSend TX...NO CONTEXT!\n");
- return CMD_STATUS_RESOURCES;
- }
+ if (pMgmt->eScanState != WMAC_NO_SCANNING)
+ RFbSetPower(pDevice, wCurrentRate, pDevice->byCurrentCh);
+ else
+ RFbSetPower(pDevice, wCurrentRate, pMgmt->uCurrChannel);
+
+ pDevice->wCurrentRate = wCurrentRate;
+
+ spin_lock_irqsave(&pDevice->lock, flags);
+
+ pContext = s_vGetFreeContext(pDevice);
+ if (!pContext) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "ManagementSend TX...NO CONTEXT!\n");
+ spin_unlock_irqrestore(&pDevice->lock, flags);
+ return CMD_STATUS_RESOURCES;
+ }
pTX_Buffer = (struct vnt_tx_buffer *)&pContext->data[0];
cbFrameBodySize = pPacket->cbPayloadLen;
@@ -1397,24 +1416,6 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice,
pbyTxBufferAddr = (u8 *)&pTxBufHead->adwTxKey[0];
wTxBufSize = sizeof(struct vnt_tx_fifo_head);
- if (pDevice->byBBType == BB_TYPE_11A) {
- wCurrentRate = RATE_6M;
- byPktType = PK_TYPE_11A;
- } else {
- wCurrentRate = RATE_1M;
- byPktType = PK_TYPE_11B;
- }
-
- // SetPower will cause error power TX state for OFDM Date packet in TX buffer.
- // 2004.11.11 Kyle -- Using OFDM power to tx MngPkt will decrease the connection capability.
- // And cmd timer will wait data pkt TX finish before scanning so it's OK
- // to set power here.
- if (pMgmt->eScanState != WMAC_NO_SCANNING) {
- RFbSetPower(pDevice, wCurrentRate, pDevice->byCurrentCh);
- } else {
- RFbSetPower(pDevice, wCurrentRate, pMgmt->uCurrChannel);
- }
- pDevice->wCurrentRate = wCurrentRate;
//Set packet type
if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000
@@ -1625,6 +1626,9 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice,
}
PIPEnsSendBulkOut(pDevice,pContext);
+
+ spin_unlock_irqrestore(&pDevice->lock, flags);
+
return CMD_STATUS_PENDING;
}