staging: vt6656: Clean up RXvWorkItem
PATCH 1/9 staging: vt6656: Clean up RXvWorkItem
Remove white space and camel case.
Camel case changes
pDevice -> priv
ntStatus -> status
pRCB -> rcb
--- drivers/staging/vt6656/dpc.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-)
drivers/staging/vt6656/dpc.c +20 -16
@@ -1295,28 +1295,32 @@ static int s_bAPModeRxData(struct vnt_private *pDevice, struct sk_buff *skb,void RXvWorkItem (struct work_struct *work) { -struct vnt_private *pDevice = +struct vnt_private *priv = container_of(work, struct vnt_private, read_work_item); -int ntStatus; -struct vnt_rcb *pRCB =NULL ; +int status; +struct vnt_rcb *rcb =NULL ; -if (pDevice->Flags & fMP_DISCONNECTED) +if (priv->Flags & fMP_DISCONNECTED)return ; -DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "---->Rx Polling Thread\n" ); -spin_lock_irq (&pDevice->lock); +DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "---->Rx Polling Thread\n" ); -while ((pDevice->Flags & fMP_POST_READS) && -MP_IS_READY (pDevice) && - (pDevice->NumRecvFreeList !=0 ) ) { - pRCB = pDevice->FirstRecvFreeList; - pDevice->NumRecvFreeList--; -DequeueRCB (pDevice->FirstRecvFreeList, pDevice->LastRecvFreeList); - ntStatus =PIPEnsBulkInUsbRead (pDevice, pRCB); - } - pDevice->bIsRxWorkItemQueued = false; -spin_unlock_irq (&pDevice->lock); +spin_lock_irq (&priv->lock); + +while ((priv->Flags & fMP_POST_READS) &&MP_IS_READY (priv) && + (priv->NumRecvFreeList !=0 )) { + rcb = priv->FirstRecvFreeList; + + priv->NumRecvFreeList--; + +DequeueRCB (priv->FirstRecvFreeList, priv->LastRecvFreeList); + + status =PIPEnsBulkInUsbRead (priv, rcb); + } + + priv->bIsRxWorkItemQueued = false; +spin_unlock_irq (&priv->lock); }void RXvFreeRCB (struct vnt_rcb *pRCB,int bReAllocSkb)
Signature · 1 line
1.9.0
PATCH 2/9 staging: vt6656: Clean up RXvFreeRCB.
Clean up white space, comments and camel case.
Camel case changes
pRCB -> rcb
bReAllocSkb -> re_alloc_skb
pDevice -> priv
--- drivers/staging/vt6656/dpc.c | 53 ++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 26 deletions(-)
drivers/staging/vt6656/dpc.c +27 -26
@@ -1323,39 +1323,40 @@ void RXvWorkItem(struct work_struct *work)spin_unlock_irq (&priv->lock); } -void RXvFreeRCB (struct vnt_rcb *pRCB,int bReAllocSkb) +void RXvFreeRCB (struct vnt_rcb *rcb,int re_alloc_skb) { -struct vnt_private *pDevice = pRCB->pDevice; +struct vnt_private *priv = rcb->pDevice; -DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "---->RXvFreeRCB\n" ); +DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "---->RXvFreeRCB\n" ); -if (bReAllocSkb == false) { -kfree_skb (pRCB->skb); - bReAllocSkb = true; +if (re_alloc_skb == false) { +kfree_skb (rcb->skb); + re_alloc_skb = true; } -if (bReAllocSkb == true) { - pRCB->skb =dev_alloc_skb ((int )pDevice->rx_buf_sz); -// todo error handling -if (pRCB->skb ==NULL ) { -DBG_PRT (MSG_LEVEL_ERR ,KERN_ERR " Failed to re-alloc rx skb\n" ); - }else { - pRCB->skb->dev = pDevice->dev; - } - } -// -// Insert the RCB back in the Recv free list -// -EnqueueRCB (pDevice->FirstRecvFreeList, pDevice->LastRecvFreeList, pRCB); - pDevice->NumRecvFreeList++; +if (re_alloc_skb == true) { + rcb->skb =dev_alloc_skb ((int )priv->rx_buf_sz); +/* TODO error handling */ +if (rcb->skb ==NULL ) { +DBG_PRT (MSG_LEVEL_ERR ,KERN_ERR +" Failed to re-alloc rx skb\n" ); + }else { + rcb->skb->dev = priv->dev; + } + } -if ((pDevice->Flags & fMP_POST_READS) &&MP_IS_READY (pDevice) && - (pDevice->bIsRxWorkItemQueued == false) ) { +/* Insert the RCB back in the Recv free list */ +EnqueueRCB (priv->FirstRecvFreeList, priv->LastRecvFreeList, rcb); + priv->NumRecvFreeList++; - pDevice->bIsRxWorkItemQueued = true; -schedule_work (&pDevice->read_work_item); - } -DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "<----RXFreeRCB %d %d\n" ,pDevice->NumRecvFreeList, pDevice->NumRecvMngList); +if ((priv->Flags & fMP_POST_READS) &&MP_IS_READY (priv) && + (priv->bIsRxWorkItemQueued == false)) { + priv->bIsRxWorkItemQueued = true; +schedule_work (&priv->read_work_item); + } + +DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "<----RXFreeRCB %d %d\n" , + priv->NumRecvFreeList, priv->NumRecvMngList); }void RXvMngWorkItem (struct work_struct *work)
Signature · 1 line
1.9.0
PATCH 3/9 staging: vt6656: Replace dev_alloc_skb with netdev_alloc_skb.
In reply to Malcolm PriestleyRemove code that points to netdev (pDevice/priv->dev)
--- drivers/staging/vt6656/dpc.c | 9 +++------ drivers/staging/vt6656/main_usb.c | 13 +++++-------- 2 files changed, 8 insertions(+), 14 deletions(-)
drivers/staging/vt6656/dpc.c +3 -6
@@ -1227,14 +1227,13 @@ static int s_bAPModeRxData(struct vnt_private *pDevice, struct sk_buff *skb,if (is_multicast_ether_addr ((u8 *)(skb->data+cbHeaderOffset))) {if (pMgmt->sNodeDBTable[0 ].bPSEnable) { - skbcpy =dev_alloc_skb ((int )pDevice->rx_buf_sz); + skbcpy =netdev_alloc_skb (pDevice->dev, pDevice->rx_buf_sz);// if any node in PS mode, buffer packet until DTIM. if (skbcpy ==NULL ) {DBG_PRT (MSG_LEVEL_NOTICE ,KERN_INFO "relay multicast no skb available \n" ); }else { - skbcpy->dev = pDevice->dev; skbcpy->len = FrameSize;memcpy (skbcpy->data, skb->data+cbHeaderOffset, FrameSize);skb_queue_tail (&(pMgmt->sNodeDBTable[0 ].sTxPSQueue), skbcpy);
@@ -1335,13 +1334,11 @@ void RXvFreeRCB(struct vnt_rcb *rcb, int re_alloc_skb) }if (re_alloc_skb == true) { - rcb->skb =dev_alloc_skb ((int )priv->rx_buf_sz); + rcb->skb =netdev_alloc_skb (priv->dev, priv->rx_buf_sz);/* TODO error handling */ -if (rcb->skb ==NULL ) { +if (!rcb->skb) {DBG_PRT (MSG_LEVEL_ERR ,KERN_ERR " Failed to re-alloc rx skb\n" ); - }else { - rcb->skb->dev = priv->dev; } }
drivers/staging/vt6656/main_usb.c +5 -8
@@ -855,12 +855,11 @@ static bool device_alloc_bufs(struct vnt_private *pDevice)DBG_PRT (MSG_LEVEL_ERR ,KERN_ERR " Failed to alloc rx urb\n" ); goto free_rx_tx; } - pRCB->skb =dev_alloc_skb ((int )pDevice->rx_buf_sz); + pRCB->skb =netdev_alloc_skb (pDevice->dev, pDevice->rx_buf_sz);if (pRCB->skb ==NULL ) {DBG_PRT (MSG_LEVEL_ERR ,KERN_ERR " Failed to alloc rx skb\n" ); goto free_rx_tx; } - pRCB->skb->dev = pDevice->dev; pRCB->bBoolInUse = false;EnqueueRCB (pDevice->FirstRecvFreeList, pDevice->LastRecvFreeList, pRCB); pDevice->NumRecvFreeList++;
@@ -931,13 +930,11 @@ static void device_free_frag_bufs(struct vnt_private *pDevice)int device_alloc_frag_buf (struct vnt_private *pDevice,PSDeFragControlBlock pDeF) { + pDeF->skb =netdev_alloc_skb (pDevice->dev, pDevice->rx_buf_sz); +if (!pDeF->skb) +return false; - pDeF->skb =dev_alloc_skb ((int )pDevice->rx_buf_sz); -if (pDeF->skb ==NULL ) -return false; - pDeF->skb->dev = pDevice->dev; - -return true; +return true; }static int device_open (struct net_device *dev)
Signature · 1 line
1.9.0
PATCH 4/9 staging: vt6656: Clean up device_alloc_bufs
In reply to Malcolm PriestleyClean up white space, comments and camel case.
pDevice -> priv
pTxContext -> tx_context
pRCB -> rcb
--- drivers/staging/vt6656/main_usb.c | 138 +++++++++++++++++++++----------------- 1 file changed, 76 insertions(+), 62 deletions(-)
drivers/staging/vt6656/main_usb.c +76 -62
@@ -804,88 +804,102 @@ static void device_free_int_bufs(struct vnt_private *pDevice)return ; } -static bool device_alloc_bufs (struct vnt_private *pDevice) +static bool device_alloc_bufs (struct vnt_private *priv) { -struct vnt_usb_send_context *pTxContext; -struct vnt_rcb *pRCB; +struct vnt_usb_send_context *tx_context; +struct vnt_rcb *rcb;int ii; -for (ii =0 ; ii < pDevice->cbTD; ii++) { +for (ii =0 ; ii < priv->cbTD; ii++) { + tx_context =kmalloc (sizeof (struct vnt_usb_send_context ), +GFP_KERNEL ); +if (tx_context ==NULL ) { +DBG_PRT (MSG_LEVEL_ERR ,KERN_ERR +"%s : allocate tx usb context failed\n" , + priv->dev->name); + goto free_tx; + } - pTxContext =kmalloc (sizeof (struct vnt_usb_send_context ),GFP_KERNEL ); -if (pTxContext ==NULL ) { -DBG_PRT (MSG_LEVEL_ERR ,KERN_ERR "%s : allocate tx usb context failed\n" , pDevice->dev->name); - goto free_tx; - } - pDevice->apTD[ii] = pTxContext; - pTxContext->pDevice = (void *) pDevice; -/* allocate URBs */ - pTxContext->pUrb =usb_alloc_urb (0 ,GFP_ATOMIC ); -if (pTxContext->pUrb ==NULL ) { -DBG_PRT (MSG_LEVEL_ERR ,KERN_ERR "alloc tx urb failed\n" ); - goto free_tx; - } - pTxContext->bBoolInUse = false; - } + priv->apTD[ii] = tx_context; + tx_context->pDevice = priv; + +/* allocate URBs */ + tx_context->pUrb =usb_alloc_urb (0 ,GFP_ATOMIC ); +if (tx_context->pUrb ==NULL ) { +DBG_PRT (MSG_LEVEL_ERR , +KERN_ERR "alloc tx urb failed\n" ); + goto free_tx; + } -/* allocate RCB mem */ - pDevice->pRCBMem =kzalloc ((sizeof (struct vnt_rcb ) * pDevice->cbRD), + tx_context->bBoolInUse = false; + } + +/* allocate RCB mem */ + priv->pRCBMem =kzalloc ((sizeof (struct vnt_rcb ) * priv->cbRD),GFP_KERNEL ); -if (pDevice->pRCBMem ==NULL ) { -DBG_PRT (MSG_LEVEL_ERR ,KERN_ERR "%s : alloc rx usb context failed\n" , pDevice->dev->name); - goto free_tx; - } +if (priv->pRCBMem ==NULL ) { +DBG_PRT (MSG_LEVEL_ERR ,KERN_ERR +"%s : alloc rx usb context failed\n" , + priv->dev->name); + goto free_tx; + } - pDevice->FirstRecvFreeList =NULL ; - pDevice->LastRecvFreeList =NULL ; - pDevice->FirstRecvMngList =NULL ; - pDevice->LastRecvMngList =NULL ; - pDevice->NumRecvFreeList =0 ; + priv->FirstRecvFreeList =NULL ; + priv->LastRecvFreeList =NULL ; + priv->FirstRecvMngList =NULL ; + priv->LastRecvMngList =NULL ; + priv->NumRecvFreeList =0 ; - pRCB = (struct vnt_rcb *)pDevice->pRCBMem; + rcb = (struct vnt_rcb *)priv->pRCBMem; -for (ii =0 ; ii < pDevice->cbRD; ii++) { +for (ii =0 ; ii < priv->cbRD; ii++) { + priv->apRCB[ii] = rcb; + rcb->pDevice = priv; - pDevice->apRCB[ii] = pRCB; - pRCB->pDevice = (void *) pDevice; -/* allocate URBs */ - pRCB->pUrb =usb_alloc_urb (0 ,GFP_ATOMIC ); +/* allocate URBs */ + rcb->pUrb =usb_alloc_urb (0 ,GFP_ATOMIC ); +if (rcb->pUrb ==NULL ) { +DBG_PRT (MSG_LEVEL_ERR ,KERN_ERR +" Failed to alloc rx urb\n" ); + goto free_rx_tx; + } -if (pRCB->pUrb ==NULL ) { -DBG_PRT (MSG_LEVEL_ERR ,KERN_ERR " Failed to alloc rx urb\n" ); - goto free_rx_tx; - } - pRCB->skb =netdev_alloc_skb (pDevice->dev, pDevice->rx_buf_sz); -if (pRCB->skb ==NULL ) { -DBG_PRT (MSG_LEVEL_ERR ,KERN_ERR " Failed to alloc rx skb\n" ); - goto free_rx_tx; - } - pRCB->bBoolInUse = false; -EnqueueRCB (pDevice->FirstRecvFreeList, pDevice->LastRecvFreeList, pRCB); - pDevice->NumRecvFreeList++; - pRCB++; - } + rcb->skb =netdev_alloc_skb (priv->dev, priv->rx_buf_sz); +if (rcb->skb ==NULL ) { +DBG_PRT (MSG_LEVEL_ERR ,KERN_ERR +" Failed to alloc rx skb\n" ); + goto free_rx_tx; + } + + rcb->bBoolInUse = false; - pDevice->pInterruptURB =usb_alloc_urb (0 ,GFP_ATOMIC ); -if (pDevice->pInterruptURB ==NULL ) { -DBG_PRT (MSG_LEVEL_ERR ,KERN_ERR "Failed to alloc int urb\n" ); - goto free_rx_tx; +EnqueueRCB (priv->FirstRecvFreeList, + priv->LastRecvFreeList, rcb); + + priv->NumRecvFreeList++; + rcb++; } - pDevice->int_buf.data_buf =kmalloc (MAX_INTERRUPT_SIZE ,GFP_KERNEL ); -if (pDevice->int_buf.data_buf ==NULL ) { -DBG_PRT (MSG_LEVEL_ERR ,KERN_ERR "Failed to alloc int buf\n" ); -usb_free_urb (pDevice->pInterruptURB); - goto free_rx_tx; + priv->pInterruptURB =usb_alloc_urb (0 ,GFP_ATOMIC ); +if (priv->pInterruptURB ==NULL ) { +DBG_PRT (MSG_LEVEL_ERR ,KERN_ERR "Failed to alloc int urb\n" ); + goto free_rx_tx; } -return true; + priv->int_buf.data_buf =kmalloc (MAX_INTERRUPT_SIZE ,GFP_KERNEL ); +if (priv->int_buf.data_buf ==NULL ) { +DBG_PRT (MSG_LEVEL_ERR ,KERN_ERR "Failed to alloc int buf\n" ); +usb_free_urb (priv->pInterruptURB); + goto free_rx_tx; + } + +return true; free_rx_tx: -device_free_rx_bufs (pDevice); +device_free_rx_bufs (priv); free_tx: -device_free_tx_bufs (pDevice); +device_free_tx_bufs (priv);return false; }
Signature · 1 line
1.9.0
PATCH 5/9 staging: vt6656: clean up device_free_rx_bufs.
In reply to Malcolm Priestleycleanup white space and camel case.
Camel case changes
pDevice -> priv
pRCB -> rcb
--- drivers/staging/vt6656/main_usb.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-)
drivers/staging/vt6656/main_usb.c +17 -15
@@ -767,26 +767,28 @@ static void device_free_tx_bufs(struct vnt_private *pDevice)return ; } -static void device_free_rx_bufs (struct vnt_private *pDevice) +static void device_free_rx_bufs (struct vnt_private *priv) { -struct vnt_rcb *pRCB; +struct vnt_rcb *rcb;int ii; -for (ii =0 ; ii < pDevice->cbRD; ii++) { +for (ii =0 ; ii < priv->cbRD; ii++) { + rcb = priv->apRCB[ii]; - pRCB = pDevice->apRCB[ii]; -/* deallocate URBs */ -if (pRCB->pUrb) { -usb_kill_urb (pRCB->pUrb); -usb_free_urb (pRCB->pUrb); - } -/* deallocate skb */ -if (pRCB->skb) -dev_kfree_skb (pRCB->skb); - } -kfree (pDevice->pRCBMem); +/* deallocate URBs */ +if (rcb->pUrb) { +usb_kill_urb (rcb->pUrb); +usb_free_urb (rcb->pUrb); + } -return ; +/* deallocate skb */ +if (rcb->skb) +dev_kfree_skb (rcb->skb); + } + +kfree (priv->pRCBMem); + +return ; }static void usb_device_reset (struct vnt_private *pDevice)
Signature · 1 line
1.9.0
PATCH 6/9 staging: vt6656: clean up device_free_tx_bufs
In reply to Malcolm PriestleyClean up white space and camel case.
Camel case changes
pDevice -> priv
pTxContext -> tx_context
--- drivers/staging/vt6656/main_usb.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)
drivers/staging/vt6656/main_usb.c +14 -13
@@ -749,22 +749,23 @@ err_nomem:return rc; } -static void device_free_tx_bufs (struct vnt_private *pDevice) +static void device_free_tx_bufs (struct vnt_private *priv) { -struct vnt_usb_send_context *pTxContext; -int ii; +struct vnt_usb_send_context *tx_context; +int ii; -for (ii =0 ; ii < pDevice->cbTD; ii++) { +for (ii =0 ; ii < priv->cbTD; ii++) { + tx_context = priv->apTD[ii]; +/* deallocate URBs */ +if (tx_context->pUrb) { +usb_kill_urb (tx_context->pUrb); +usb_free_urb (tx_context->pUrb); + } - pTxContext = pDevice->apTD[ii]; -/* deallocate URBs */ -if (pTxContext->pUrb) { -usb_kill_urb (pTxContext->pUrb); -usb_free_urb (pTxContext->pUrb); - } -kfree (pTxContext); - } -return ; +kfree (tx_context); + } + +return ; }static void device_free_rx_bufs (struct vnt_private *priv)
Signature · 1 line
1.9.0
PATCH 7/9 staging: vt6656: clean up device_free_int_bufs.
In reply to Malcolm PriestleyClean up white and camel case.
Camel case change
pDevice -> priv
--- drivers/staging/vt6656/main_usb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/vt6656/main_usb.c +3 -2
@@ -801,9 +801,10 @@ static void usb_device_reset(struct vnt_private *pDevice)return ; } -static void device_free_int_bufs (struct vnt_private *pDevice) +static void device_free_int_bufs (struct vnt_private *priv) { -kfree (pDevice->int_buf.data_buf); +kfree (priv->int_buf.data_buf); +return ; }
Signature · 1 line
1.9.0
PATCH 8/9 staging: vt6656: dead code removetypedef struct tagSQuietControl
In reply to Malcolm Priestley--- drivers/staging/vt6656/device.h | 10 ---------- 1 file changed, 10 deletions(-)
drivers/staging/vt6656/device.h +0 -10
@@ -276,16 +276,6 @@ typedef struct tagSPMKIDCandidateEvent {PMKID_CANDIDATE CandidateList[MAX_PMKIDLIST ]; } SPMKIDCandidateEvent, *PSPMKIDCandidateEvent; -/*++ 802.11h related */ -#define MAX_QUIET_COUNT 8 - -typedef struct tagSQuietControl { -bool bEnable; -u32 dwStartTime; -u8 byPeriod; -u16 wDuration; -}SQuietControl , *PSQuietControl ; -/* The receive duplicate detection cache entry */ typedef struct tagSCacheEntry{ u16 wFmSequence;
Signature · 1 line
1.9.0
PATCH 9/9 staging: vt6656: Remove unused tasklets tasklet_struct CmdWorkItem and EventWorkItem are not used.
In reply to Malcolm Priestley--- drivers/staging/vt6656/device.h | 2 -- drivers/staging/vt6656/main_usb.c | 4 ---- 2 files changed, 6 deletions(-)
drivers/staging/vt6656/device.h +0 -2
@@ -355,8 +355,6 @@ struct vnt_private {OPTIONS sOpts; -struct tasklet_struct CmdWorkItem; -struct tasklet_struct EventWorkItem;struct work_struct read_work_item;struct work_struct rx_mng_work_item;
drivers/staging/vt6656/main_usb.c +0 -4
@@ -1005,8 +1005,6 @@ static int device_open(struct net_device *dev)vMgrObjectInit (pDevice); -tasklet_init (&pDevice->EventWorkItem, (void *)INTvWorkItem, (unsigned long )pDevice); -schedule_delayed_work (&pDevice->second_callback_work,HZ ); pDevice->int_interval =100 ;/* max 100 microframes */
@@ -1108,8 +1106,6 @@ static int device_close(struct net_device *dev)cancel_work_sync (&pDevice->rx_mng_work_item);cancel_work_sync (&pDevice->read_work_item); -tasklet_kill (&pDevice->EventWorkItem); - pDevice->bRoaming = false; pDevice->bIsRoaming = false; pDevice->bEnableRoaming = false;
Signature · 1 line
1.9.0