2014-02-27 23:07:00

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 1/7] staging: vt6656: Remove all variables ulBulk*

None of these variables reach user or in any debug messages.

Remove them all.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/device.h | 10 ----------
drivers/staging/vt6656/usbpipe.c | 10 ----------
2 files changed, 20 deletions(-)

diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index ce1587a..50262dc 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -424,16 +424,6 @@ struct vnt_private {
DEFAULT_CONFIG config_file;

/* Statistic for USB */
- unsigned long ulBulkInPosted;
- unsigned long ulBulkInError;
- unsigned long ulBulkInContCRCError;
- unsigned long ulBulkInBytesRead;
-
- unsigned long ulBulkOutPosted;
- unsigned long ulBulkOutError;
- unsigned long ulBulkOutContCRCError;
- unsigned long ulBulkOutBytesWrite;
-
unsigned long ulIntInPosted;
unsigned long ulIntInError;
unsigned long ulIntInContCRCError;
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index 54c68a5..ce396b9 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -372,7 +372,6 @@ static void s_nsInterruptUsbIoCompleteRead(struct urb *urb)
"s_nsInterruptUsbIoCompleteRead Status %d\n", status);

if (status != STATUS_SUCCESS) {
- priv->ulBulkInError++;
priv->int_buf.in_use = false;

DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
@@ -419,8 +418,6 @@ int PIPEnsBulkInUsbRead(struct vnt_private *priv, struct vnt_rcb *rcb)
if (priv->Flags & fMP_DISCONNECTED)
return STATUS_FAILURE;

- priv->ulBulkInPosted++;
-
urb = rcb->pUrb;
if (rcb->skb == NULL) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"rcb->skb is null\n");
@@ -473,8 +470,6 @@ static void s_nsBulkInUsbIoCompleteRead(struct urb *urb)

switch (urb->status) {
case 0:
- priv->ulBulkInContCRCError = 0;
- priv->ulBulkInBytesRead += urb->actual_length;
break;
case -ECONNRESET:
case -ENOENT:
@@ -482,7 +477,6 @@ static void s_nsBulkInUsbIoCompleteRead(struct urb *urb)
return;
case -ETIMEDOUT:
default:
- priv->ulBulkInError++;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
"BULK In failed %d\n", urb->status);
break;
@@ -541,7 +535,6 @@ int PIPEnsSendBulkOut(struct vnt_private *priv,
}

urb = context->pUrb;
- priv->ulBulkOutPosted++;

usb_fill_bulk_urb(urb,
priv->usb,
@@ -622,12 +615,9 @@ static void s_nsBulkOutIoCompleteWrite(struct urb *urb)
if (status == STATUS_SUCCESS) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
"Write %d bytes\n", (int)buf_len);
- priv->ulBulkOutBytesWrite += buf_len;
- priv->ulBulkOutContCRCError = 0;
} else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
"BULK Out failed %d\n", status);
- priv->ulBulkOutError++;
}


--
1.9.0



2014-02-27 23:07:15

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 4/7] staging: vt6656: Remove unused variable bEventAvailable.

Flips from true to false but does nothing.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/device.h | 1 -
drivers/staging/vt6656/main_usb.c | 1 -
drivers/staging/vt6656/usbpipe.c | 1 -
3 files changed, 3 deletions(-)

diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index 72bcafb..1124aa4 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -417,7 +417,6 @@ struct vnt_private {

/* Variables to track resources for the Interrupt In Pipe */
struct vnt_interrupt_buffer int_buf;
- int bEventAvailable;

/* default config from file by user setting */
DEFAULT_CONFIG config_file;
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 7783050..e1d90c5 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -998,7 +998,6 @@ static int device_open(struct net_device *dev)
pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;

pDevice->bIsRxWorkItemQueued = true;
- pDevice->bEventAvailable = false;

pDevice->bWPADEVUp = false;
pDevice->bwextstep0 = false;
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index 0a3aeec..5ce583e 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -376,7 +376,6 @@ static void s_nsInterruptUsbIoCompleteRead(struct urb *urb)
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
"IntUSBIoCompleteControl STATUS = %d\n", status);
} else {
- priv->bEventAvailable = true;
INTnsProcessData(priv);
}

--
1.9.0


2014-02-27 23:07:14

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 3/7] staging: vt6656: struct vnt_usb_send_context remove sEthHeader.

In nsDMA_tx_packet and bRelayPacketSend s_vSaveTxPktInfo points
to sEthHeader.h_dest which is the wrong viable.

Correct and point to pDevice->sTxEthHeader.

This is only relevant in the non fuctioning hostapd access point
mode, shortly to be removed from driver.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/device.h | 1 -
drivers/staging/vt6656/rxtx.c | 4 ++--
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index 2574029..72bcafb 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -179,7 +179,6 @@ struct vnt_usb_send_context {
void *pDevice;
struct sk_buff *pPacket;
struct urb *pUrb;
- struct ethhdr sEthHeader;
unsigned int uBufLen;
u8 type;
bool bBoolInUse;
diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index ba0184a..7083af3 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -2444,7 +2444,7 @@ int nsDMA_tx_packet(struct vnt_private *pDevice,
pContext->uBufLen = (u16)BytesToWrite + 4 ; //USB header

s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F),
- &pContext->sEthHeader.h_dest[0],
+ &pDevice->sTxEthHeader.h_dest[0],
(u16)(BytesToWrite-uHeaderLen),
pTX_Buffer->fifo_head.wFIFOCtl);

@@ -2598,7 +2598,7 @@ int bRelayPacketSend(struct vnt_private *pDevice, u8 *pbySkbData, u32 uDataLen,
pContext->uBufLen = (u16)BytesToWrite + 4 ; //USB header

s_vSaveTxPktInfo(pDevice, (u8)(pTX_Buffer->byPKTNO & 0x0F),
- &pContext->sEthHeader.h_dest[0],
+ &pDevice->sTxEthHeader.h_dest[0],
(u16)(BytesToWrite - uHeaderLen),
pTX_Buffer->fifo_head.wFIFOCtl);

--
1.9.0


2014-02-27 23:07:24

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 7/7] staging: vt6656: s_nsBulkOutIoCompleteWrite Remove variable status.

Remove status and move debug messages to switch statement.

Remove duplicate second debug message.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/usbpipe.c | 24 +++++-------------------
1 file changed, 5 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index 57efb7f..a4a4bf2 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -584,38 +584,29 @@ static void s_nsBulkOutIoCompleteWrite(struct urb *urb)
struct vnt_usb_send_context *context = urb->context;
struct vnt_private *priv = context->pDevice;
u8 context_type = context->type;
- int status;

DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsBulkOutIoCompleteWrite\n");

switch (urb->status) {
case 0:
- case -ETIMEDOUT:
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "Write %d bytes\n", context->uBufLen);
break;
case -ECONNRESET:
case -ENOENT:
case -ESHUTDOWN:
context->bBoolInUse = false;
return;
+ case -ETIMEDOUT:
default:
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "BULK Out failed %d\n", urb->status);
break;
}

if (!netif_device_present(priv->dev))
return;

-
- status = urb->status;
-
- if (status == STATUS_SUCCESS) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
- "Write %d bytes\n", context->uBufLen);
- } else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
- "BULK Out failed %d\n", status);
- }
-
-
if (CONTEXT_DATA_PACKET == context_type) {
if (context->pPacket != NULL) {
dev_kfree_skb_irq(context->pPacket);
@@ -625,11 +616,6 @@ static void s_nsBulkOutIoCompleteWrite(struct urb *urb)
}

priv->dev->trans_start = jiffies;
-
- if (status != STATUS_SUCCESS) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
- "Send USB error! [%08xh]\n", status);
- }
}

if (priv->bLinkPass == true) {
--
1.9.0


2014-02-27 23:07:18

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 5/7] staging: vt6656: Remove unused variables packets*

These variables are unused and don't reach user.

Remove them all.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/device.h | 5 -----
drivers/staging/vt6656/usbpipe.c | 6 +-----
2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index 1124aa4..1aad3d3 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -441,11 +441,6 @@ struct vnt_private {
int bExistSWNetAddr;

/* Maintain statistical debug info. */
- unsigned long packetsReceived;
- unsigned long packetsReceivedDropped;
- unsigned long packetsReceivedOverflow;
- unsigned long packetsSent;
- unsigned long packetsSentDropped;
unsigned long SendContextsInUse;
unsigned long RcvBuffersInUse;

diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index 5ce583e..fb9200e 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -627,14 +627,10 @@ static void s_nsBulkOutIoCompleteWrite(struct urb *urb)

priv->dev->trans_start = jiffies;

- if (status == STATUS_SUCCESS) {
- priv->packetsSent++;
- } else {
+ if (status != STATUS_SUCCESS) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
"Send USB error! [%08xh]\n", status);
- priv->packetsSentDropped++;
}
-
}

if (priv->bLinkPass == true) {
--
1.9.0


2014-02-27 23:07:07

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 2/7] staging: vt6656: Remove all variables ulInt*

None of these variables reach user or used by debug messages.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/device.h | 6 ------
drivers/staging/vt6656/usbpipe.c | 3 ---
2 files changed, 9 deletions(-)

diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index 50262dc..2574029 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -423,12 +423,6 @@ struct vnt_private {
/* default config from file by user setting */
DEFAULT_CONFIG config_file;

- /* Statistic for USB */
- unsigned long ulIntInPosted;
- unsigned long ulIntInError;
- unsigned long ulIntInContCRCError;
- unsigned long ulIntInBytesRead;
-
/* Version control */
u16 wFirmwareVersion;
u8 byLocalID;
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index ce396b9..0a3aeec 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -306,7 +306,6 @@ int PIPEnsInterruptRead(struct vnt_private *priv)
return STATUS_FAILURE;

priv->int_buf.in_use = true;
- priv->ulIntInPosted++;

usb_fill_int_urb(priv->pInterruptURB,
priv->usb,
@@ -377,8 +376,6 @@ static void s_nsInterruptUsbIoCompleteRead(struct urb *urb)
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
"IntUSBIoCompleteControl STATUS = %d\n", status);
} else {
- priv->ulIntInBytesRead += (unsigned long)urb->actual_length;
- priv->ulIntInContCRCError = 0;
priv->bEventAvailable = true;
INTnsProcessData(priv);
}
--
1.9.0


2014-02-27 23:07:21

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 6/7] staging: vt6656: s_nsBulkOutIoCompleteWrite remove buf_len.

Use context->uBufLen directly which is unsigned int.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/usbpipe.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index fb9200e..57efb7f 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -584,7 +584,6 @@ static void s_nsBulkOutIoCompleteWrite(struct urb *urb)
struct vnt_usb_send_context *context = urb->context;
struct vnt_private *priv = context->pDevice;
u8 context_type = context->type;
- unsigned long buf_len = context->uBufLen;
int status;

DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsBulkOutIoCompleteWrite\n");
@@ -610,7 +609,7 @@ static void s_nsBulkOutIoCompleteWrite(struct urb *urb)

if (status == STATUS_SUCCESS) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
- "Write %d bytes\n", (int)buf_len);
+ "Write %d bytes\n", context->uBufLen);
} else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
"BULK Out failed %d\n", status);
@@ -622,7 +621,7 @@ static void s_nsBulkOutIoCompleteWrite(struct urb *urb)
dev_kfree_skb_irq(context->pPacket);
context->pPacket = NULL;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
- "tx %d bytes\n", (int)buf_len);
+ "tx %d bytes\n", context->uBufLen);
}

priv->dev->trans_start = jiffies;
--
1.9.0