Re: [PATCH] Staging: vt6655: staticfy variable

2014-07-30 Thread Guillaume Clement
Hello,

> Add static to variable.
> Signed-off-by: Fernando Apesteguia 
> ---
>  drivers/staging/vt6655/ioctl.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/vt6655/ioctl.c
> b/drivers/staging/vt6655/ioctl.c
> index 65e5933..cc6e47b 100644
> --- a/drivers/staging/vt6655/ioctl.c
> +++ b/drivers/staging/vt6655/ioctl.c
> @@ -41,7 +41,7 @@
>  static int msglevel = MSG_LEVEL_INFO;
>
>  #ifdef WPA_SM_Transtatus
> -SWPAResult wpa_Result;
> +static SWPAResult wpa_Result;
>  #endif

This changes breaks the compilation (actually the linking). wpa_Result
is actually used in device_main.c in device_open with the following:

> #ifdef WPA_SM_Transtatus
>   extern SWPAResult wpa_Result;
> #endif
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: vt6655: fix direct dereferencing of user pointer

2014-07-25 Thread Guillaume Clement
Sparse reported that the data from tagSCmdRequest is given by
userspace, so it should be tagged as such.

Later, we were memcomparing and dereferencing it without first copying
it, fix that as well.

Signed-off-by: Guillaume Clement 
---
 drivers/staging/vt6655/iocmd.h |  2 +-
 drivers/staging/vt6655/iwctl.c | 32 ++--
 drivers/staging/vt6655/iwctl.h |  6 +++---
 3 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/vt6655/iocmd.h b/drivers/staging/vt6655/iocmd.h
index e499f1b..dd12498 100644
--- a/drivers/staging/vt6655/iocmd.h
+++ b/drivers/staging/vt6655/iocmd.h
@@ -100,7 +100,7 @@ typedef enum tagWZONETYPE {
 #pragma pack(1)
 typedef struct tagSCmdRequest {
u8  name[16];
-   void*data;
+   void __user *data;
u16 wResult;
u16 wCmdCode;
 } SCmdRequest, *PSCmdRequest;
diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c
index 501cd64..7ce23b5 100644
--- a/drivers/staging/vt6655/iwctl.c
+++ b/drivers/staging/vt6655/iwctl.c
@@ -1621,17 +1621,24 @@ int iwctl_giwauth(struct net_device *dev,
 int iwctl_siwgenie(struct net_device *dev,
   struct iw_request_info *info,
   struct iw_point *wrq,
-  char *extra)
+  char __user *extra)
 {
PSDevicepDevice = (PSDevice)netdev_priv(dev);
PSMgmtObjectpMgmt = &(pDevice->sMgmtObj);
int ret = 0;
+   char length;
 
if (wrq->length) {
-   if ((wrq->length < 2) || (extra[1]+2 != wrq->length)) {
-   ret = -EINVAL;
-   goto out;
-   }
+   if (wrq->length < 2)
+   return -EINVAL;
+
+   ret = get_user(length, extra + 1);
+   if (ret)
+   return ret;
+
+   if (length + 2 != wrq->length)
+   return -EINVAL;
+
if (wrq->length > MAX_WPA_IE_LEN) {
ret = -ENOMEM;
goto out;
@@ -1654,7 +1661,7 @@ out://not completely ...not necessary in wpa_supplicant 
0.5.8
 int iwctl_giwgenie(struct net_device *dev,
   struct iw_request_info *info,
   struct iw_point *wrq,
-  char *extra)
+  char __user *extra)
 {
PSDevicepDevice = (PSDevice)netdev_priv(dev);
PSMgmtObjectpMgmt = &(pDevice->sMgmtObj);
@@ -1801,18 +1808,23 @@ int iwctl_giwencodeext(struct net_device *dev,
 int iwctl_siwmlme(struct net_device *dev,
  struct iw_request_info *info,
  struct iw_point *wrq,
- char *extra)
+ char __user *extra)
 {
PSDevicepDevice = (PSDevice)netdev_priv(dev);
PSMgmtObjectpMgmt = &(pDevice->sMgmtObj);
-   struct iw_mlme *mlme = (struct iw_mlme *)extra;
+   struct iw_mlme mime;
+
int ret = 0;
 
-   if (memcmp(pMgmt->abyCurrBSSID, mlme->addr.sa_data, ETH_ALEN)) {
+   ret = copy_from_user(&mime, extra, sizeof(mime));
+   if (ret)
+   return -EFAULT;
+
+   if (memcmp(pMgmt->abyCurrBSSID, mime.addr.sa_data, ETH_ALEN)) {
ret = -EINVAL;
return ret;
}
-   switch (mlme->cmd) {
+   switch (mime.cmd) {
case IW_MLME_DEAUTH:
//this command seems to be not complete,please test it 
--einsnliu
//bScheduleCommand((void *) pDevice, WLAN_CMD_DEAUTH, (unsigned 
char *)&reason);
diff --git a/drivers/staging/vt6655/iwctl.h b/drivers/staging/vt6655/iwctl.h
index de0a337..7dd6310 100644
--- a/drivers/staging/vt6655/iwctl.h
+++ b/drivers/staging/vt6655/iwctl.h
@@ -176,12 +176,12 @@ int iwctl_giwauth(struct net_device *dev,
 int iwctl_siwgenie(struct net_device *dev,
   struct iw_request_info *info,
   struct iw_point *wrq,
-  char *extra);
+  char __user *extra);
 
 int iwctl_giwgenie(struct net_device *dev,
   struct iw_request_info *info,
   struct iw_point *wrq,
-  char *extra);
+  char __user *extra);
 
 int iwctl_siwencodeext(struct net_device *dev,
   struct iw_request_info *info,
@@ -196,7 +196,7 @@ int iwctl_giwencodeext(struct net_device *dev,
 int iwctl_siwmlme(struct net_device *dev,
  struct iw_request_info *info,
  struct iw_point *wrq,
- char *extra);
+ char __user *extra);
 #endif // #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
 //End Add -- //2008-0409-07,  by Einsn Liu
 
-- 
1.8.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel

[PATCH 2/5] staging:nvec: Remove unnessary out of memory message.

2014-07-07 Thread Guillaume Clement
Logging messages that show some type of "out of memory" error
are generally unnecessary as there is a generic message and
a stack dump done by the memory subsystem.

Signed-off-by: Guillaume Clément 
---
 drivers/staging/nvec/nvec.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 8a3dd47..d325048 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -806,10 +806,9 @@ static int tegra_nvec_probe(struct platform_device *pdev)
}
 
nvec = devm_kzalloc(&pdev->dev, sizeof(struct nvec_chip), GFP_KERNEL);
-   if (nvec == NULL) {
-   dev_err(&pdev->dev, "failed to reserve memory\n");
+   if (nvec == NULL)
return -ENOMEM;
-   }
+
platform_set_drvdata(pdev, nvec);
nvec->dev = &pdev->dev;
 
-- 
1.8.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging:nvec: Fix several coding style warnings

2014-07-07 Thread Guillaume Clement
This fixes several warnings in the nvec staging driver.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/5] staging:nvec: Fix "unnecessary else" coding style warning.

2014-07-07 Thread Guillaume Clement
The last else is unnessary as all the if statements end with a return.

Signed-off-by: Guillaume Clément 
---
 drivers/staging/nvec/nvec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 90f1c4d..8a3dd47 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -232,8 +232,7 @@ static size_t nvec_msg_size(struct nvec_msg *msg)
return 2;
else if (event_length == NVEC_3BYTES)
return 3;
-   else
-   return 0;
+   return 0;
 }
 
 /**
-- 
1.8.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/5] staging:nvec: Add missing blank line after declarations.

2014-07-07 Thread Guillaume Clement
Signed-off-by: Guillaume Clément 
---
 drivers/staging/nvec/nvec_paz00.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/nvec/nvec_paz00.c 
b/drivers/staging/nvec/nvec_paz00.c
index 934b796..e2e675a 100644
--- a/drivers/staging/nvec/nvec_paz00.c
+++ b/drivers/staging/nvec/nvec_paz00.c
@@ -35,6 +35,7 @@ static void nvec_led_brightness_set(struct led_classdev 
*led_cdev,
 {
struct nvec_led *led = to_nvec_led(led_cdev);
unsigned char buf[] = NVEC_LED_REQ;
+
buf[4] = value;
 
nvec_write_async(led->nvec, buf, sizeof(buf));
-- 
1.8.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/5] staging:nvec: Add missing blank line after declarations.

2014-07-07 Thread Guillaume Clement
Signed-off-by: Guillaume Clément 
---
 drivers/staging/nvec/nvec_ps2.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c
index 45b2f13..f56f1db 100644
--- a/drivers/staging/nvec/nvec_ps2.c
+++ b/drivers/staging/nvec/nvec_ps2.c
@@ -53,12 +53,14 @@ static struct nvec_ps2 ps2_dev;
 static int ps2_startstreaming(struct serio *ser_dev)
 {
unsigned char buf[] = { NVEC_PS2, AUTO_RECEIVE_N, PACKET_SIZE };
+
return nvec_write_async(ps2_dev.nvec, buf, sizeof(buf));
 }
 
 static void ps2_stopstreaming(struct serio *ser_dev)
 {
unsigned char buf[] = { NVEC_PS2, CANCEL_AUTO_RECEIVE };
+
nvec_write_async(ps2_dev.nvec, buf, sizeof(buf));
 }
 
-- 
1.8.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/5] staging:nvec: Add missing blank line after declarations.

2014-07-07 Thread Guillaume Clement
Signed-off-by: Guillaume Clément 
---
 drivers/staging/nvec/nvec_power.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/nvec/nvec_power.c 
b/drivers/staging/nvec/nvec_power.c
index aacfcd6..6446e15 100644
--- a/drivers/staging/nvec/nvec_power.c
+++ b/drivers/staging/nvec/nvec_power.c
@@ -226,6 +226,7 @@ static int nvec_power_get_property(struct power_supply *psy,
   union power_supply_propval *val)
 {
struct nvec_power *power = dev_get_drvdata(psy->dev->parent);
+
switch (psp) {
case POWER_SUPPLY_PROP_ONLINE:
val->intval = power->on;
-- 
1.8.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/5] staging: vt6655:fix warning for unexported non-static functions

2014-07-22 Thread Guillaume Clement
There is one function in aes_ccmp.c which is exported, but sparse sees
it unexported because it doesn't include the header that exports it.

Signed-off-by: Guillaume Clement 
---
 drivers/staging/vt6655/aes_ccmp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/vt6655/aes_ccmp.c 
b/drivers/staging/vt6655/aes_ccmp.c
index 4ccfe06..a25e6cf 100644
--- a/drivers/staging/vt6655/aes_ccmp.c
+++ b/drivers/staging/vt6655/aes_ccmp.c
@@ -35,6 +35,7 @@
 
 #include "device.h"
 #include "80211hdr.h"
+#include "aes_ccmp.h"
 
 /*-  Static Definitions -*/
 
-- 
1.8.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/5] staging: vt6655: remove unused functions

2014-07-22 Thread Guillaume Clement
The IEEE11hbMgrRxAction is not exported and never used. Deleting it
allows to delete other functions that were only used by
IEEE11hbMgrRxAction.

This allows to fix several warnings reported by sparse.

Signed-off-by: Guillaume Clement 
---
 drivers/staging/vt6655/IEEE11h.c | 175 ---
 1 file changed, 175 deletions(-)

diff --git a/drivers/staging/vt6655/IEEE11h.c b/drivers/staging/vt6655/IEEE11h.c
index 6cfad1c..180a27c 100644
--- a/drivers/staging/vt6655/IEEE11h.c
+++ b/drivers/staging/vt6655/IEEE11h.c
@@ -41,7 +41,6 @@
 #include "channel.h"
 
 /*-  Static Definitions -*/
-static int  msglevel= MSG_LEVEL_INFO;
 
 #pragma pack(1)
 
@@ -98,185 +97,11 @@ typedef struct _WLAN_FRAME_TPCREP {
 /*-  Static Variables  --*/
 
 /*-  Static Functions  --*/
-static bool s_bRxMSRReq(PSMgmtObject pMgmt, PWLAN_FRAME_MSRREQ pMSRReq,
-   unsigned int uLength)
-{
-   size_tuNumOfEIDs = 0;
-   bool bResult = true;
-
-   if (uLength <= WLAN_A3FR_MAXLEN)
-   memcpy(pMgmt->abyCurrentMSRReq, pMSRReq, uLength);
-   uNumOfEIDs = ((uLength - offsetof(WLAN_FRAME_MSRREQ,
- sMSRReqEIDs))/
- (sizeof(WLAN_IE_MEASURE_REQ)));
-   pMgmt->pCurrMeasureEIDRep = &(((PWLAN_FRAME_MSRREP)
-  
(pMgmt->abyCurrentMSRRep))->sMSRRepEIDs[0]);
-   pMgmt->uLengthOfRepEIDs = 0;
-   bResult = CARDbStartMeasure(pMgmt->pAdapter,
-   ((PWLAN_FRAME_MSRREQ)
-(pMgmt->abyCurrentMSRReq))->sMSRReqEIDs,
-   uNumOfEIDs
-);
-   return bResult;
-}
-
-static bool s_bRxTPCReq(PSMgmtObject pMgmt,
-   PWLAN_FRAME_TPCREQ pTPCReq,
-   unsigned char byRate,
-   unsigned char byRSSI)
-{
-   PWLAN_FRAME_TPCREP  pFrame;
-   PSTxMgmtPacket  pTxPacket = NULL;
-
-   pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
-   memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN);
-   pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket +
-   sizeof(STxMgmtPacket));
-
-   pFrame = (PWLAN_FRAME_TPCREP)((unsigned char *)pTxPacket +
- sizeof(STxMgmtPacket));
-
-   pFrame->Header.wFrameCtl = (WLAN_SET_FC_FTYPE(WLAN_FTYPE_MGMT) |
-   WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_ACTION)
-);
-
-   memcpy(pFrame->Header.abyAddr1,
-  pTPCReq->Header.abyAddr2,
-  WLAN_ADDR_LEN);
-   memcpy(pFrame->Header.abyAddr2,
-  CARDpGetCurrentAddress(pMgmt->pAdapter),
-  WLAN_ADDR_LEN);
-   memcpy(pFrame->Header.abyAddr3,
-  pMgmt->abyCurrBSSID,
-  WLAN_BSSID_LEN);
-
-   pFrame->byCategory = 0;
-   pFrame->byAction = 3;
-   pFrame->byDialogToken = ((PWLAN_FRAME_MSRREQ)
-(pMgmt->abyCurrentMSRReq))->byDialogToken;
-
-   pFrame->sTPCRepEIDs.byElementID = WLAN_EID_TPC_REP;
-   pFrame->sTPCRepEIDs.len = 2;
-   pFrame->sTPCRepEIDs.byTxPower = CARDbyGetTransmitPower(pMgmt->pAdapter);
-   switch (byRate) {
-   case RATE_54M:
-   pFrame->sTPCRepEIDs.byLinkMargin = 65 - byRSSI;
-   break;
-   case RATE_48M:
-   pFrame->sTPCRepEIDs.byLinkMargin = 66 - byRSSI;
-   break;
-   case RATE_36M:
-   pFrame->sTPCRepEIDs.byLinkMargin = 70 - byRSSI;
-   break;
-   case RATE_24M:
-   pFrame->sTPCRepEIDs.byLinkMargin = 74 - byRSSI;
-   break;
-   case RATE_18M:
-   pFrame->sTPCRepEIDs.byLinkMargin = 77 - byRSSI;
-   break;
-   case RATE_12M:
-   pFrame->sTPCRepEIDs.byLinkMargin = 79 - byRSSI;
-   break;
-   case RATE_9M:
-   pFrame->sTPCRepEIDs.byLinkMargin = 81 - byRSSI;
-   break;
-   case RATE_6M:
-   default:
-   pFrame->sTPCRepEIDs.byLinkMargin = 82 - byRSSI;
-   break;
-   }
-
-   pTxPacket->cbMPDULen = sizeof(WLAN_FRAME_TPCREP);
-   pTxPacket->cbPayloadLen = sizeof(WLAN_FRAME_TPCREP) -
-   WLAN_HDR_ADDR3_LEN;
-   if (csMgmt_xmit(pMgmt->pAdapter, pTxPacket) != CMD_STATUS_PENDING)
-   return false;
-   return true;
-}
 
 /*-  Export Variables  --*/
 
 /*-  Export Functions  --*/
 
-/*+
- *
- * Description:
- *  Handles 

[PATCH 5/5] staging: vt6655: Fix unused function warning

2014-07-22 Thread Guillaume Clement
Sparse reports that MimeThread is not used. Actually, it can be used
if THREAD is defined. By enclosing the MimeThread function into the
same #ifdef as the caller of MimeThread, this fixes the sparse
warnings.

Signed-off-by: Guillaume Clement 
---
 drivers/staging/vt6655/device_main.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index 5576c30..fe9e13c 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -98,7 +98,9 @@ MODULE_AUTHOR("VIA Networking Technologies, Inc., 
");
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("VIA Networking Solomon-A/B/G Wireless LAN Adapter Driver");
 
+#ifdef THREAD
 static int mlme_kill;
+#endif
 
 #define DEVICE_PARAM(N, D)
 
@@ -1596,7 +1598,8 @@ void  InitRxManagementQueue(PSDevice  pDevice)
 //PLICE_DEBUG<-
 
 //PLICE_DEBUG ->
-int MlmeThread(
+#ifdef THREAD
+static int MlmeThread(
void *Context)
 {
PSDevicepDevice =  (PSDevice) Context;
@@ -1619,6 +1622,7 @@ int MlmeThread(
 
return 0;
 }
+#endif
 
 static int  device_open(struct net_device *dev) {
PSDevice pDevice = (PSDevice)netdev_priv(dev);
-- 
1.8.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/5] staging: vt6655: statify some variables

2014-07-22 Thread Guillaume Clement
Some variables are used only in the context of their .c file, which
gives warnings with sparse.

Signed-off-by: Guillaume Clement 
---
 drivers/staging/vt6655/baseband.c| 14 +++---
 drivers/staging/vt6655/bssdb.c   |  4 ++--
 drivers/staging/vt6655/card.c|  6 +++---
 drivers/staging/vt6655/device_main.c |  4 ++--
 drivers/staging/vt6655/wcmd.c|  2 +-
 drivers/staging/vt6655/wmgr.c| 10 +-
 6 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/vt6655/baseband.c 
b/drivers/staging/vt6655/baseband.c
index 0985563..67bc3b4 100644
--- a/drivers/staging/vt6655/baseband.c
+++ b/drivers/staging/vt6655/baseband.c
@@ -75,7 +75,7 @@ static int msglevel = MSG_LEVEL_INFO;
 /*-  Static Variables  --*/
 
 #define CB_VT3253_INIT_FOR_RFMD 446
-unsigned char byVT3253InitTab_RFMD[CB_VT3253_INIT_FOR_RFMD][2] = {
+static unsigned char byVT3253InitTab_RFMD[CB_VT3253_INIT_FOR_RFMD][2] = {
{0x00, 0x30},
{0x01, 0x00},
{0x02, 0x00},
@@ -525,7 +525,7 @@ unsigned char 
byVT3253InitTab_RFMD[CB_VT3253_INIT_FOR_RFMD][2] = {
 };
 
 #define CB_VT3253B0_INIT_FOR_RFMD 256
-unsigned char byVT3253B0_RFMD[CB_VT3253B0_INIT_FOR_RFMD][2] = {
+static unsigned char byVT3253B0_RFMD[CB_VT3253B0_INIT_FOR_RFMD][2] = {
{0x00, 0x31},
{0x01, 0x00},
{0x02, 0x00},
@@ -786,7 +786,7 @@ unsigned char byVT3253B0_RFMD[CB_VT3253B0_INIT_FOR_RFMD][2] 
= {
 
 #define CB_VT3253B0_AGC_FOR_RFMD2959 195
 /* For RFMD2959 */
-unsigned char byVT3253B0_AGC4_RFMD2959[CB_VT3253B0_AGC_FOR_RFMD2959][2] = {
+static unsigned char byVT3253B0_AGC4_RFMD2959[CB_VT3253B0_AGC_FOR_RFMD2959][2] 
= {
{0xF0, 0x00},
{0xF1, 0x3E},
{0xF0, 0x80},
@@ -986,7 +986,7 @@ unsigned char 
byVT3253B0_AGC4_RFMD2959[CB_VT3253B0_AGC_FOR_RFMD2959][2] = {
 
 #define CB_VT3253B0_INIT_FOR_AIROHA2230 256
 /* For AIROHA */
-unsigned char byVT3253B0_AIROHA2230[CB_VT3253B0_INIT_FOR_AIROHA2230][2] = {
+static unsigned char byVT3253B0_AIROHA2230[CB_VT3253B0_INIT_FOR_AIROHA2230][2] 
= {
{0x00, 0x31},
{0x01, 0x00},
{0x02, 0x00},
@@ -1247,7 +1247,7 @@ unsigned char 
byVT3253B0_AIROHA2230[CB_VT3253B0_INIT_FOR_AIROHA2230][2] = {
 
 #define CB_VT3253B0_INIT_FOR_UW2451 256
 /* For UW2451 */
-unsigned char byVT3253B0_UW2451[CB_VT3253B0_INIT_FOR_UW2451][2] = {
+static unsigned char byVT3253B0_UW2451[CB_VT3253B0_INIT_FOR_UW2451][2] = {
{0x00, 0x31},
{0x01, 0x00},
{0x02, 0x00},
@@ -1508,7 +1508,7 @@ unsigned char 
byVT3253B0_UW2451[CB_VT3253B0_INIT_FOR_UW2451][2] = {
 
 #define CB_VT3253B0_AGC 193
 /* For AIROHA */
-unsigned char byVT3253B0_AGC[CB_VT3253B0_AGC][2] = {
+static unsigned char byVT3253B0_AGC[CB_VT3253B0_AGC][2] = {
{0xF0, 0x00},
{0xF1, 0x00},
{0xF0, 0x80},
@@ -1704,7 +1704,7 @@ unsigned char byVT3253B0_AGC[CB_VT3253B0_AGC][2] = {
{0xF0, 0x00},
 };
 
-const unsigned short awcFrameTime[MAX_RATE] =
+static const unsigned short awcFrameTime[MAX_RATE] =
 {10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216};
 
 /*-  Static Functions  --*/
diff --git a/drivers/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c
index 59679cd..eb3474d 100644
--- a/drivers/staging/vt6655/bssdb.c
+++ b/drivers/staging/vt6655/bssdb.c
@@ -65,14 +65,14 @@
 /*-  Static Variables  --*/
 static int msglevel = MSG_LEVEL_INFO;
 
-const unsigned short awHWRetry0[5][5] = {
+static const unsigned short awHWRetry0[5][5] = {
{RATE_18M, RATE_18M, RATE_12M, RATE_12M, RATE_12M},
{RATE_24M, RATE_24M, RATE_18M, RATE_12M, RATE_12M},
{RATE_36M, RATE_36M, RATE_24M, RATE_18M, RATE_18M},
{RATE_48M, RATE_48M, RATE_36M, RATE_24M, RATE_24M},
{RATE_54M, RATE_54M, RATE_48M, RATE_36M, RATE_36M}
 };
-const unsigned short awHWRetry1[5][5] = {
+static const unsigned short awHWRetry1[5][5] = {
{RATE_18M, RATE_18M, RATE_12M, RATE_6M, RATE_6M},
{RATE_24M, RATE_24M, RATE_18M, RATE_6M, RATE_6M},
{RATE_36M, RATE_36M, RATE_24M, RATE_12M, RATE_12M},
diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index 988858b..e29dcd8 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -87,7 +87,7 @@ static unsigned char abyDefaultSuppRatesB[] = 
{WLAN_EID_SUPP_RATES, 4, 0x02, 0x0
 
 /*-  Static Variables  --*/
 
-const unsigned short cwRXBCNTSFOff[MAX_RATE] =
+static const unsigned short cwRXBCNTSFOff[MAX_RATE] =
 {17, 17, 17, 17, 34, 23, 17, 11, 8, 5, 4, 3};
 
 /*-  Static Functions  --*/
@@ -1576,7 +1576,7 @@ CARDvSafeResetRx(
  * Return Value: response Control frame rate
  *
  */
-unsigned short CARDwGetCCKControlRate(void *pDeviceHandler, unsigned short 
wRateIdx)
+static unsigned short CARDwGetCCKControlRate(void

[PATCH 1/5] staging: vt6655: change type of PortOffset to void __iomem *

2014-07-22 Thread Guillaume Clement
PortOffset was an unsigned long, but used as an pointer to io
memory. Sometimes it was not properly cast before use, which caused
many warning by sparse.

By updating its type to void __iomem *, and reflecting the changes
where it is needed, this removes most of those warnings.

Signed-off-by: Guillaume Clement 
---
 drivers/staging/vt6655/baseband.c|  30 +-
 drivers/staging/vt6655/baseband.h|  24 
 drivers/staging/vt6655/card.c|   8 +--
 drivers/staging/vt6655/card.h|   8 +--
 drivers/staging/vt6655/device.h  |   2 +-
 drivers/staging/vt6655/device_main.c |   6 +-
 drivers/staging/vt6655/key.c |  18 +++---
 drivers/staging/vt6655/key.h |  16 +++---
 drivers/staging/vt6655/mac.c | 104 +-
 drivers/staging/vt6655/mac.h | 106 +--
 drivers/staging/vt6655/rf.c  |  16 +++---
 drivers/staging/vt6655/rf.h  |   8 +--
 drivers/staging/vt6655/srom.c|  24 
 drivers/staging/vt6655/srom.h|  24 
 drivers/staging/vt6655/upc.h |  18 ++
 15 files changed, 203 insertions(+), 209 deletions(-)

diff --git a/drivers/staging/vt6655/baseband.c 
b/drivers/staging/vt6655/baseband.c
index 490ca96..0985563 100644
--- a/drivers/staging/vt6655/baseband.c
+++ b/drivers/staging/vt6655/baseband.c
@@ -1987,7 +1987,7 @@ BBvCalculateParameter(
  * Return Value: true if succeeded; false if failed.
  *
  */
-bool BBbReadEmbedded(unsigned long dwIoBase, unsigned char byBBAddr, unsigned 
char *pbyData)
+bool BBbReadEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned 
char *pbyData)
 {
unsigned short ww;
unsigned char byValue;
@@ -2029,7 +2029,7 @@ bool BBbReadEmbedded(unsigned long dwIoBase, unsigned 
char byBBAddr, unsigned ch
  * Return Value: true if succeeded; false if failed.
  *
  */
-bool BBbWriteEmbedded(unsigned long dwIoBase, unsigned char byBBAddr, unsigned 
char byData)
+bool BBbWriteEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned 
char byData)
 {
unsigned short ww;
unsigned char byValue;
@@ -2070,7 +2070,7 @@ bool BBbWriteEmbedded(unsigned long dwIoBase, unsigned 
char byBBAddr, unsigned c
  * Return Value: true if all TestBits are set; false otherwise.
  *
  */
-bool BBbIsRegBitsOn(unsigned long dwIoBase, unsigned char byBBAddr, unsigned 
char byTestBits)
+bool BBbIsRegBitsOn(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned 
char byTestBits)
 {
unsigned char byOrgData;
 
@@ -2092,7 +2092,7 @@ bool BBbIsRegBitsOn(unsigned long dwIoBase, unsigned char 
byBBAddr, unsigned cha
  * Return Value: true if all TestBits are clear; false otherwise.
  *
  */
-bool BBbIsRegBitsOff(unsigned long dwIoBase, unsigned char byBBAddr, unsigned 
char byTestBits)
+bool BBbIsRegBitsOff(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned 
char byTestBits)
 {
unsigned char byOrgData;
 
@@ -2119,7 +2119,7 @@ bool BBbVT3253Init(PSDevice pDevice)
 {
bool bResult = true;
intii;
-   unsigned long dwIoBase = pDevice->PortOffset;
+   void __iomem *dwIoBase = pDevice->PortOffset;
unsigned char byRFType = pDevice->byRFType;
unsigned char byLocalID = pDevice->byLocalID;
 
@@ -2285,7 +2285,7 @@ bool BBbVT3253Init(PSDevice pDevice)
  * Return Value: none
  *
  */
-void BBvReadAllRegs(unsigned long dwIoBase, unsigned char *pbyBBRegs)
+void BBvReadAllRegs(void __iomem *dwIoBase, unsigned char *pbyBBRegs)
 {
int  ii;
unsigned char byBase = 1;
@@ -2312,7 +2312,7 @@ void BBvReadAllRegs(unsigned long dwIoBase, unsigned char 
*pbyBBRegs)
 void BBvLoopbackOn(PSDevice pDevice)
 {
unsigned char byData;
-   unsigned long dwIoBase = pDevice->PortOffset;
+   void __iomem *dwIoBase = pDevice->PortOffset;
 
/* CR C9 = 0x00 */
BBbReadEmbedded(dwIoBase, 0xC9, &pDevice->byBBCRc9); /* CR201 */
@@ -2365,7 +2365,7 @@ void BBvLoopbackOn(PSDevice pDevice)
 void BBvLoopbackOff(PSDevice pDevice)
 {
unsigned char byData;
-   unsigned long dwIoBase = pDevice->PortOffset;
+   void __iomem *dwIoBase = pDevice->PortOffset;
 
BBbWriteEmbedded(dwIoBase, 0xC9, pDevice->byBBCRc9); /* CR201 */
BBbWriteEmbedded(dwIoBase, 0x88, pDevice->byBBCR88); /* CR136 */
@@ -2448,7 +2448,7 @@ void BBvSetVGAGainOffset(PSDevice pDevice, unsigned char 
byData)
  *
  */
 void
-BBvSoftwareReset(unsigned long dwIoBase)
+BBvSoftwareReset(void __iomem *dwIoBase)
 {
BBbWriteEmbedded(dwIoBase, 0x50, 0x40);
BBbWriteEmbedded(dwIoBase, 0x50, 0);
@@ -2469,7 +2469,7 @@ BBvSoftwareReset(unsigned long dwIoBase)
  *
  */
 void
-BBvPowerSaveModeON(unsigned long dwIoBase)
+BBvPowerSaveModeON(void __iomem *dwIoBase)
 {
unsigned char byOrgData;
 
@@ -2491,7 +2491,7 @@ BBvPowerSaveModeON(unsigned long dwIoBase)
  *
  */
 void
-BBvPowerSaveModeOFF(unsigned lon

[PATCH 0/5] staging: vt6655: fix sparse issues

2014-07-22 Thread Guillaume Clement
Those patches fix warnings reported by sparse on the vt6655
driver. This will allow to more easily find real errors with sparse
later if one appears.


Note that checkpatch does return an error for patch 1 and 2 (line over
80 characters) but the line length was not increased by this patch. If
needed, I can do another patch set to fix the 80 column warnings too.

[PATCH 1/5] staging: vt6655: change type of PortOffset to void
[PATCH 2/5] staging: vt6655:fix warning for unexported non-static
[PATCH 3/5] staging: vt6655: statify some variables
[PATCH 4/5] staging: vt6655: remove unused functions
[PATCH 5/5] staging: vt6655: Fix unused function warning
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 06/14] staging: vt6655: fix static position in inline function

2014-07-24 Thread Guillaume Clement
This should be "static inline", not "inline static". Reported by
checkpatch.

Signed-off-by: Guillaume Clement 
---
 drivers/staging/vt6655/device.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h
index 7c7fec4..a707984 100644
--- a/drivers/staging/vt6655/device.h
+++ b/drivers/staging/vt6655/device.h
@@ -778,7 +778,7 @@ inline  static  void   EnQueue(PSDevice pDevice, 
PSRxMgmtPacket  pRxMgmtPacket)
}
 }
 
-inline  static  PSRxMgmtPacket DeQueue(PSDevice pDevice)
+static inline PSRxMgmtPacket DeQueue(PSDevice pDevice)
 {
PSRxMgmtPacket  pRxMgmtPacket;
 
@@ -800,7 +800,7 @@ voidInitRxManagementQueue(PSDevice   pDevice);
 
 //PLICE_DEBUG<-
 
-inline static bool device_get_ip(PSDevice pInfo) {
+static inline bool device_get_ip(PSDevice pInfo) {
struct in_device *in_dev = (struct in_device *)pInfo->dev->ip_ptr;
struct in_ifaddr *ifa;
 
-- 
1.8.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 00/14] staging: vt6655: Sparse and checkpatch fixes

2014-07-24 Thread Guillaume Clement
This patchset fixes a lot of minor checkpatch and sparse warnings.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 13/14] staging: vt6655: remove unused macro

2014-07-24 Thread Guillaume Clement
The MAC_MAX_CONTEXT_SIZE macro was not enclosed into parenthesis,
which might have caused hard to debug errors, and caused a sparse
warning.

Since it is unused, we might as well remove it.

Signed-off-by: Guillaume Clement 
---
 drivers/staging/vt6655/mac.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h
index 98ade83..0bf9375 100644
--- a/drivers/staging/vt6655/mac.h
+++ b/drivers/staging/vt6655/mac.h
@@ -44,7 +44,6 @@
 //
 #define MAC_MAX_CONTEXT_SIZE_PAGE0  256
 #define MAC_MAX_CONTEXT_SIZE_PAGE1  128
-#define MAC_MAX_CONTEXT_SIZEMAC_MAX_CONTEXT_SIZE_PAGE0 + 
MAC_MAX_CONTEXT_SIZE_PAGE1
 
 // Registers not related to 802.11b
 #define MAC_REG_BCFG0   0x00
-- 
1.8.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 14/14] staging: vt6655: Remove NULL pointer sparse warning

2014-07-24 Thread Guillaume Clement
We were using 0 instead of NULL to initialize a pointer, which caused
a sparse warning.

Signed-off-by: Guillaume Clement 
---
 drivers/staging/vt6655/device_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index 33a25bc..3e18987 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1610,7 +1610,7 @@ static void device_free_tx_buf(PSDevice pDevice, PSTxDesc 
pDesc)
dev_kfree_skb_irq(skb);
 
pTDInfo->skb_dma = 0;
-   pTDInfo->skb = 0;
+   pTDInfo->skb = NULL;
pTDInfo->byFlags = 0;
 }
 
-- 
1.8.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: vt6655: tag data as __user in struct tagSCmdRequest

2014-07-24 Thread Guillaume Clement
Sparse reported that the data from tagSCmdRequest is given by
userspace, so it should be tagged as such.

Later, we were memcomparing and dereferencing it without first copying
it, fix that as well.

Signed-off-by: Guillaume Clement 
---
 drivers/staging/vt6655/iocmd.h |  2 +-
 drivers/staging/vt6655/iwctl.c | 22 +++---
 drivers/staging/vt6655/iwctl.h |  6 +++---
 3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/vt6655/iocmd.h b/drivers/staging/vt6655/iocmd.h
index e499f1b..dd12498 100644
--- a/drivers/staging/vt6655/iocmd.h
+++ b/drivers/staging/vt6655/iocmd.h
@@ -100,7 +100,7 @@ typedef enum tagWZONETYPE {
 #pragma pack(1)
 typedef struct tagSCmdRequest {
u8  name[16];
-   void*data;
+   void __user *data;
u16 wResult;
u16 wCmdCode;
 } SCmdRequest, *PSCmdRequest;
diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c
index 501cd64..9291259 100644
--- a/drivers/staging/vt6655/iwctl.c
+++ b/drivers/staging/vt6655/iwctl.c
@@ -1621,14 +1621,17 @@ int iwctl_giwauth(struct net_device *dev,
 int iwctl_siwgenie(struct net_device *dev,
   struct iw_request_info *info,
   struct iw_point *wrq,
-  char *extra)
+  char __user *extra)
 {
PSDevicepDevice = (PSDevice)netdev_priv(dev);
PSMgmtObjectpMgmt = &(pDevice->sMgmtObj);
int ret = 0;
+   char length;
 
if (wrq->length) {
-   if ((wrq->length < 2) || (extra[1]+2 != wrq->length)) {
+   if (get_user(length, extra + 1))
+   return -EFAULT;
+   if ((wrq->length < 2) || (length != wrq->length)) {
ret = -EINVAL;
goto out;
}
@@ -1654,7 +1657,7 @@ out://not completely ...not necessary in wpa_supplicant 
0.5.8
 int iwctl_giwgenie(struct net_device *dev,
   struct iw_request_info *info,
   struct iw_point *wrq,
-  char *extra)
+  char __user *extra)
 {
PSDevicepDevice = (PSDevice)netdev_priv(dev);
PSMgmtObjectpMgmt = &(pDevice->sMgmtObj);
@@ -1801,18 +1804,23 @@ int iwctl_giwencodeext(struct net_device *dev,
 int iwctl_siwmlme(struct net_device *dev,
  struct iw_request_info *info,
  struct iw_point *wrq,
- char *extra)
+ char __user *extra)
 {
PSDevicepDevice = (PSDevice)netdev_priv(dev);
PSMgmtObjectpMgmt = &(pDevice->sMgmtObj);
-   struct iw_mlme *mlme = (struct iw_mlme *)extra;
+   struct iw_mlme mime;
+
int ret = 0;
 
-   if (memcmp(pMgmt->abyCurrBSSID, mlme->addr.sa_data, ETH_ALEN)) {
+   ret = copy_from_user(&mime, extra, sizeof(mime));
+   if (ret)
+   return -EFAULT;
+
+   if (memcmp(pMgmt->abyCurrBSSID, mime.addr.sa_data, ETH_ALEN)) {
ret = -EINVAL;
return ret;
}
-   switch (mlme->cmd) {
+   switch (mime.cmd) {
case IW_MLME_DEAUTH:
//this command seems to be not complete,please test it 
--einsnliu
//bScheduleCommand((void *) pDevice, WLAN_CMD_DEAUTH, (unsigned 
char *)&reason);
diff --git a/drivers/staging/vt6655/iwctl.h b/drivers/staging/vt6655/iwctl.h
index de0a337..7dd6310 100644
--- a/drivers/staging/vt6655/iwctl.h
+++ b/drivers/staging/vt6655/iwctl.h
@@ -176,12 +176,12 @@ int iwctl_giwauth(struct net_device *dev,
 int iwctl_siwgenie(struct net_device *dev,
   struct iw_request_info *info,
   struct iw_point *wrq,
-  char *extra);
+  char __user *extra);
 
 int iwctl_giwgenie(struct net_device *dev,
   struct iw_request_info *info,
   struct iw_point *wrq,
-  char *extra);
+  char __user *extra);
 
 int iwctl_siwencodeext(struct net_device *dev,
   struct iw_request_info *info,
@@ -196,7 +196,7 @@ int iwctl_giwencodeext(struct net_device *dev,
 int iwctl_siwmlme(struct net_device *dev,
  struct iw_request_info *info,
  struct iw_point *wrq,
- char *extra);
+ char __user *extra);
 #endif // #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
 //End Add -- //2008-0409-07,  by Einsn Liu
 
-- 
1.8.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 05/14] staging: vt6655: fix braces at newline for structs

2014-07-24 Thread Guillaume Clement
For structs definitions, the braces should be at the end of the
line. Reported by checkpatch.

Signed-off-by: Guillaume Clement 
---
 drivers/staging/vt6655/bssdb.h  |  3 +--
 drivers/staging/vt6655/device.h | 15 +--
 drivers/staging/vt6655/key.h|  9 +++--
 drivers/staging/vt6655/wmgr.h   | 12 
 4 files changed, 13 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/vt6655/bssdb.h b/drivers/staging/vt6655/bssdb.h
index a0938b7..0dbb2ca 100644
--- a/drivers/staging/vt6655/bssdb.h
+++ b/drivers/staging/vt6655/bssdb.h
@@ -77,8 +77,7 @@
 // IEEE 802.11 Structures and definitions
 //
 
-typedef enum _NDIS_802_11_NETWORK_TYPE
-{
+typedef enum _NDIS_802_11_NETWORK_TYPE {
Ndis802_11FH,
Ndis802_11DS,
Ndis802_11OFDM5,
diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h
index f33ecf0..7c7fec4 100644
--- a/drivers/staging/vt6655/device.h
+++ b/drivers/staging/vt6655/device.h
@@ -201,8 +201,7 @@ typedef enum __device_init_type {
 // PMKID Structures
 typedef unsigned char NDIS_802_11_PMKID_VALUE[16];
 
-typedef enum _NDIS_802_11_WEP_STATUS
-{
+typedef enum _NDIS_802_11_WEP_STATUS {
Ndis802_11WEPEnabled,
Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
Ndis802_11WEPDisabled,
@@ -218,8 +217,7 @@ typedef enum _NDIS_802_11_WEP_STATUS
 } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
 
-typedef enum _NDIS_802_11_STATUS_TYPE
-{
+typedef enum _NDIS_802_11_STATUS_TYPE {
Ndis802_11StatusType_Authentication,
Ndis802_11StatusType_MediaStreamMode,
Ndis802_11StatusType_PMKID_CandidateList,
@@ -232,8 +230,7 @@ struct pmkid_candidate {
unsigned long Flags;
 };
 
-typedef struct _BSSID_INFO
-{
+typedef struct _BSSID_INFO {
NDIS_802_11_MAC_ADDRESS BSSID;
NDIS_802_11_PMKID_VALUE PMKID;
 } BSSID_INFO, *PBSSID_INFO;
@@ -293,8 +290,7 @@ typedef struct tagSCache {
 
 #define CB_MAX_RX_FRAG 64
 // DeFragment Control Block, used for collecting fragments prior to reassembly
-typedef struct tagSDeFragControlBlock
-{
+typedef struct tagSDeFragControlBlock {
unsigned short wSequence;
unsigned short wFragNum;
unsigned char abyAddr2[ETH_ALEN];
@@ -334,8 +330,7 @@ typedef struct tagSDeFragControlBlock
 
 //PLICE_DEBUG->
 
-typedefstruct _RxManagementQueue
-{
+typedefstruct _RxManagementQueue {
int packet_num;
int head, tail;
PSRxMgmtPacket  Q[NUM];
diff --git a/drivers/staging/vt6655/key.h b/drivers/staging/vt6655/key.h
index 4eee192..3eb881b 100644
--- a/drivers/staging/vt6655/key.h
+++ b/drivers/staging/vt6655/key.h
@@ -53,8 +53,7 @@
 #define KEY_CTL_CCMP0x03
 #define KEY_CTL_INVALID 0xFF
 
-typedef struct tagSKeyItem
-{
+typedef struct tagSKeyItem {
bool bKeyValid;
unsigned long uKeyLength;
unsigned char abyKey[MAX_KEY_LEN];
@@ -67,8 +66,7 @@ typedef struct tagSKeyItem
void *pvKeyTable;
 } SKeyItem, *PSKeyItem; //64
 
-typedef struct tagSKeyTable
-{
+typedef struct tagSKeyTable {
unsigned char abyBSSID[ETH_ALEN];  //6
unsigned char byReserved0[2];  //8
SKeyItemPairwiseKey;
@@ -82,8 +80,7 @@ typedef struct tagSKeyTable
unsigned char byReserved1[6];
 } SKeyTable, *PSKeyTable; //348
 
-typedef struct tagSKeyManagement
-{
+typedef struct tagSKeyManagement {
SKeyTable   KeyTable[MAX_KEY_TABLE];
 } SKeyManagement, *PSKeyManagement;
 
diff --git a/drivers/staging/vt6655/wmgr.h b/drivers/staging/vt6655/wmgr.h
index 2312d71..a71daed 100644
--- a/drivers/staging/vt6655/wmgr.h
+++ b/drivers/staging/vt6655/wmgr.h
@@ -83,22 +83,19 @@ typedef void (*TimerFunction)(unsigned long);
 //+++ NDIS related
 
 typedef unsigned char NDIS_802_11_MAC_ADDRESS[6];
-typedef struct _NDIS_802_11_AI_REQFI
-{
+typedef struct _NDIS_802_11_AI_REQFI {
unsigned short Capabilities;
unsigned short ListenInterval;
NDIS_802_11_MAC_ADDRESS  CurrentAPAddress;
 } NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI;
 
-typedef struct _NDIS_802_11_AI_RESFI
-{
+typedef struct _NDIS_802_11_AI_RESFI {
unsigned short Capabilities;
unsigned short StatusCode;
unsigned short AssociationId;
 } NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI;
 
-typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
-{
+typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION {
unsigned long Length;
unsigned short  AvailableRequestFixedIEs;
NDIS_802_11_AI_REQFIRequestFixedIEs;
@@ -187,8 +184,7 @@ typedef struct tagSRxMgmtPacket {
unsigned char byRxChannel;
 } SRxMgmtPacket, *PSRxMgmtPacket;
 
-typedef struct tagSMgmtObject
-{
+typedef struct tagSMgmtObject {
void *pAdapter;
// MAC address
unsigned char abyMACAddr[WLAN_ADDR_LEN];
-- 
1.8.5.5

--
To unsubscribe from this list: send the l

[PATCH 12/14] staging: vt6655: fix braces at newline in if statements

2014-07-24 Thread Guillaume Clement
Braces should not be in a separate line for multi-line if
statements. This fixes warnings reported by checkpatch.

Signed-off-by: Guillaume Clement 
---
 drivers/staging/vt6655/wcmd.c | 5 +++--
 drivers/staging/vt6655/wpa.c  | 8 
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/vt6655/wcmd.c b/drivers/staging/vt6655/wcmd.c
index 0c38fcf..f12eef0 100644
--- a/drivers/staging/vt6655/wcmd.c
+++ b/drivers/staging/vt6655/wcmd.c
@@ -432,9 +432,10 @@ vCommandTimer(
vAdHocBeaconRestart(pDevice);
 //2008-0409-07,  by Einsn Liu
 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
-   if (pMgmt->eScanType == WMAC_SCAN_PASSIVE)
-   {//send scan event to wpa_Supplicant
+   if (pMgmt->eScanType == WMAC_SCAN_PASSIVE) {
+   //send scan event to wpa_Supplicant
union iwreq_data wrqu;
+
memset(&wrqu, 0, sizeof(wrqu));
wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, 
NULL);
}
diff --git a/drivers/staging/vt6655/wpa.c b/drivers/staging/vt6655/wpa.c
index 2bd9e1f..7b1bab9 100644
--- a/drivers/staging/vt6655/wpa.c
+++ b/drivers/staging/vt6655/wpa.c
@@ -123,8 +123,8 @@ WPA_ParseRSN(
&& (pRSN->wVersion == 1)) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Legal RSN\n");
// update each variable if pRSN is long enough to contain the 
variable
-   if (pRSN->len >= 10) //oui1(4)+ver(2)+GKSuite(4)
-   {
+   if (pRSN->len >= 10) {
+   //OUI1(4)+ver(2)+GKSuite(4)
if (!memcmp(pRSN->abyMulticast, abyOUI01, 4))
pBSSList->byGKType = WPA_WEP40;
else if (!memcmp(pRSN->abyMulticast, abyOUI02, 4))
@@ -142,8 +142,8 @@ WPA_ParseRSN(
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "byGKType: %x\n", 
pBSSList->byGKType);
}
 
-   if (pRSN->len >= 12) //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)
-   {
+   if (pRSN->len >= 12) {
+   //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)
j = 0;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wPKCount: %d, 
sizeof(pBSSList->abyPKType): %zu\n", pRSN->wPKCount, 
sizeof(pBSSList->abyPKType));
for (i = 0; (i < pRSN->wPKCount) && (j < 
ARRAY_SIZE(pBSSList->abyPKType)); i++) {
-- 
1.8.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 04/14] staging: vt6655: fix function braces not on the proper line

2014-07-24 Thread Guillaume Clement
Function braces should be on a separate line. Reported by checkpatch.

Signed-off-by: Guillaume Clement 
---
 drivers/staging/vt6655/device_main.c | 90 
 drivers/staging/vt6655/rxtx.c|  6 ++-
 2 files changed, 64 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index f1b4d58..8c035d5 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -743,7 +743,8 @@ MACvStart(pDevice->PortOffset);
 netif_stop_queue(pDevice->dev);
 }
 
-static void device_init_diversity_timer(PSDevice pDevice) {
+static void device_init_diversity_timer(PSDevice pDevice)
+{
init_timer(&pDevice->TimerSQ3Tmax1);
pDevice->TimerSQ3Tmax1.data = (unsigned long) pDevice;
pDevice->TimerSQ3Tmax1.function = (TimerFunction)TimerSQ3CallBack;
@@ -999,7 +1000,8 @@ static void vt6655_init_info(struct pci_dev *pcid, 
PSDevice *ppDevice,
spin_lock_init(&((*ppDevice)->lock));
 }
 
-static bool device_get_pci_info(PSDevice pDevice, struct pci_dev *pcid) {
+static bool device_get_pci_info(PSDevice pDevice, struct pci_dev *pcid)
+{
u16 pci_cmd;
u8  b;
unsigned int cis_addr;
@@ -1046,7 +1048,8 @@ static bool device_get_pci_info(PSDevice pDevice, struct 
pci_dev *pcid) {
return true;
 }
 
-static void device_free_info(PSDevice pDevice) {
+static void device_free_info(PSDevice pDevice)
+{
PSDevice ptr;
struct net_device *dev = pDevice->dev;
 
@@ -1090,7 +1093,8 @@ static void device_free_info(PSDevice pDevice) {
free_netdev(dev);
 }
 
-static bool device_init_rings(PSDevice pDevice) {
+static bool device_init_rings(PSDevice pDevice)
+{
void *vir_pool;
 
/*allocate all RD/TD rings a single pool*/
@@ -1165,7 +1169,8 @@ static bool device_init_rings(PSDevice pDevice) {
return true;
 }
 
-static void device_free_rings(PSDevice pDevice) {
+static void device_free_rings(PSDevice pDevice)
+{
pci_free_consistent(pDevice->pcid,
pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) +
pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) +
@@ -1185,7 +1190,8 @@ static void device_free_rings(PSDevice pDevice) {
);
 }
 
-static void device_init_rd0_ring(PSDevice pDevice) {
+static void device_init_rd0_ring(PSDevice pDevice)
+{
int i;
dma_addr_t  curr = pDevice->rd0_pool_dma;
PSRxDescpDesc;
@@ -1209,7 +1215,8 @@ static void device_init_rd0_ring(PSDevice pDevice) {
pDevice->pCurrRD[0] = &(pDevice->aRD0Ring[0]);
 }
 
-static void device_init_rd1_ring(PSDevice pDevice) {
+static void device_init_rd1_ring(PSDevice pDevice)
+{
int i;
dma_addr_t  curr = pDevice->rd1_pool_dma;
PSRxDescpDesc;
@@ -1233,7 +1240,8 @@ static void device_init_rd1_ring(PSDevice pDevice) {
pDevice->pCurrRD[1] = &(pDevice->aRD1Ring[0]);
 }
 
-static void device_init_defrag_cb(PSDevice pDevice) {
+static void device_init_defrag_cb(PSDevice pDevice)
+{
int i;
PSDeFragControlBlock pDeF;
 
@@ -1249,7 +1257,8 @@ static void device_init_defrag_cb(PSDevice pDevice) {
pDevice->cbFreeDFCB = pDevice->cbDFCB;
 }
 
-static void device_free_rd0_ring(PSDevice pDevice) {
+static void device_free_rd0_ring(PSDevice pDevice)
+{
int i;
 
for (i = 0; i < pDevice->sOpts.nRxDescs0; i++) {
@@ -1265,7 +1274,8 @@ static void device_free_rd0_ring(PSDevice pDevice) {
}
 }
 
-static void device_free_rd1_ring(PSDevice pDevice) {
+static void device_free_rd1_ring(PSDevice pDevice)
+{
int i;
 
for (i = 0; i < pDevice->sOpts.nRxDescs1; i++) {
@@ -1281,7 +1291,8 @@ static void device_free_rd1_ring(PSDevice pDevice) {
}
 }
 
-static void device_free_frag_buf(PSDevice pDevice) {
+static void device_free_frag_buf(PSDevice pDevice)
+{
PSDeFragControlBlock pDeF;
int i;
 
@@ -1294,7 +1305,8 @@ static void device_free_frag_buf(PSDevice pDevice) {
}
 }
 
-static void device_init_td0_ring(PSDevice pDevice) {
+static void device_init_td0_ring(PSDevice pDevice)
+{
int i;
dma_addr_t  curr;
PSTxDescpDesc;
@@ -1318,7 +1330,8 @@ static void device_init_td0_ring(PSDevice pDevice) {
pDevice->apTailTD[0] = pDevice->apCurrTD[0] = &(pDevice->apTD0Rings[0]);
 }
 
-static void device_init_td1_ring(PSDevice pDevice) {
+static void device_init_td1_ring(PSDevice pDevice)
+{
int i;
dma_addr_t  curr;
PSTxDescpDesc;
@@ -1343,7 +1356,8 @@ static void device_init_td1_ring(PSDevice pDevice) {
pDevice->apTailTD[1] = pDevice->apCurrTD[1] = &(pDevice->apTD1Rings[0]);
 }
 
-static void device_free_td0_ring(PSDevice pDevice) {
+static void device_free_td0_ring

[PATCH 10/14] staging: vt6655: add missing whitespace

2014-07-24 Thread Guillaume Clement
Some whitespace were missing, causing checkpatch warnings and altering
readability.

Signed-off-by: Guillaume Clement 
---
 drivers/staging/vt6655/device_main.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index 7bd728c..33a25bc 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -2619,12 +2619,12 @@ static int Config_FileGetParameter(unsigned char 
*string,
return true;
 }
 
-int Config_FileOperation(PSDevice pDevice,bool fwrite,unsigned char *Parameter)
+int Config_FileOperation(PSDevice pDevice, bool fwrite, unsigned char 
*Parameter)
 {
unsigned char *buffer = kmalloc(1024, GFP_KERNEL);
unsigned char tmpbuffer[20];
struct file *file;
-   int result=0;
+   int result = 0;
 
if (!buffer) {
pr_err("allocate mem for file fail?\n");
@@ -2649,11 +2649,11 @@ int Config_FileOperation(PSDevice pDevice,bool 
fwrite,unsigned char *Parameter)
goto error1;
}
 
-   if (memcmp(tmpbuffer,"USA",3)==0) {
+   if (memcmp(tmpbuffer, "USA", 3) == 0) {
result = ZoneType_USA;
-   } else if(memcmp(tmpbuffer,"JAPAN",5)==0) {
+   } else if(memcmp(tmpbuffer, "JAPAN", 5) == 0) {
result = ZoneType_Japan;
-   } else if(memcmp(tmpbuffer,"EUROPE",5)==0) {
+   } else if(memcmp(tmpbuffer, "EUROPE", 5) == 0) {
result = ZoneType_Europe;
} else {
result = -1;
-- 
1.8.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 11/14] staging: vt6655: remove braces for single statements if

2014-07-24 Thread Guillaume Clement
This fixes several "braces {} are not necessary for single statement
blocks" checkpatch warnings.

Signed-off-by: Guillaume Clement 
---
 drivers/staging/vt6655/power.c   | 3 +--
 drivers/staging/vt6655/vntwifi.c | 3 +--
 drivers/staging/vt6655/wmgr.c| 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/vt6655/power.c b/drivers/staging/vt6655/power.c
index e41d3bc..2a21cbd 100644
--- a/drivers/staging/vt6655/power.c
+++ b/drivers/staging/vt6655/power.c
@@ -248,9 +248,8 @@ PSvSendPSPOLL(
pTxPacket->cbMPDULen = WLAN_HDR_ADDR2_LEN;
pTxPacket->cbPayloadLen = 0;
// send the frame
-   if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) {
+   if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING)
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send PS-Poll packet 
failed..\n");
-   }
 }
 
 /*+
diff --git a/drivers/staging/vt6655/vntwifi.c b/drivers/staging/vt6655/vntwifi.c
index 160707d..4d425e0 100644
--- a/drivers/staging/vt6655/vntwifi.c
+++ b/drivers/staging/vt6655/vntwifi.c
@@ -684,9 +684,8 @@ VNTWIFIbMeasureReport(
pMgmt->uLengthOfRepEIDs += (2 + pMgmt->pCurrMeasureEIDRep->len);
pMgmt->pCurrMeasureEIDRep = (PWLAN_IE_MEASURE_REP) 
pbyCurrentEID;
}
-   if (bEndOfReport) {
+   if (bEndOfReport)
IEEE11hbMSRRepTx(pMgmt);
-   }
 
return true;
 }
diff --git a/drivers/staging/vt6655/wmgr.c b/drivers/staging/vt6655/wmgr.c
index 57373c9..e88e116 100644
--- a/drivers/staging/vt6655/wmgr.c
+++ b/drivers/staging/vt6655/wmgr.c
@@ -4114,9 +4114,8 @@ s_vMgrRxProbeRequest(
if (pTxPacket != NULL) {
/* send the frame */
Status = csMgmt_xmit(pDevice, pTxPacket);
-   if (Status != CMD_STATUS_PENDING) {
+   if (Status != CMD_STATUS_PENDING)
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Probe 
response tx failed\n");
-   }
}
}
 }
-- 
1.8.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 08/14] staging: vt6655: break single line if statements

2014-07-24 Thread Guillaume Clement
This fixes the "trailing statements should be on next line" checkpatch
warning.

Signed-off-by: Guillaume Clement 
---
 drivers/staging/vt6655/card.c| 6 --
 drivers/staging/vt6655/device_main.c | 6 --
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index 58d707f..4ae8d93 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -934,8 +934,10 @@ bool CARDbRadioPowerOn(void *pDeviceHandler)
 
pr_debug("chester power on\n");
if (pDevice->bRadioControlOff == true) {
-   if (pDevice->bHWRadioOff == true) pr_debug("chester 
bHWRadioOff\n");
-   if (pDevice->bRadioControlOff == true) pr_debug("chester 
bRadioControlOff\n");
+   if (pDevice->bHWRadioOff == true)
+   pr_debug("chester bHWRadioOff\n");
+   if (pDevice->bRadioControlOff == true)
+   pr_debug("chester bRadioControlOff\n");
return false; }
 
if (pDevice->bRadioOff == false) {
diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index c3cae50..7bd728c 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -388,7 +388,8 @@ device_set_options(PSDevice pDevice) {
pDevice->b11hEnable = (pDevice->sOpts.flags & DEVICE_FLAGS_80211h_MODE) 
? 1 : 0;
pDevice->bDiversityRegCtlON = (pDevice->sOpts.flags & 
DEVICE_FLAGS_DiversityANT) ? 1 : 0;
pDevice->uConnectionRate = pDevice->sOpts.data_rate;
-   if (pDevice->uConnectionRate < RATE_AUTO) pDevice->bFixRate = true;
+   if (pDevice->uConnectionRate < RATE_AUTO)
+   pDevice->bFixRate = true;
pDevice->byBBType = pDevice->sOpts.bbp_type;
pDevice->byPacketType = pDevice->byBBType;
 
@@ -2889,7 +2890,8 @@ static int  device_ioctl(struct net_device *dev, struct 
ifreq *rq, int cmd)
char abyKey[WLAN_WEP232_KEYLEN];
 
rc = iwctl_giwencode(dev, NULL, &(wrq->u.encoding), 
abyKey);
-   if (rc != 0) break;
+   if (rc != 0)
+   break;
if (wrq->u.encoding.pointer) {
if (copy_to_user(wrq->u.encoding.pointer,
 abyKey,
-- 
1.8.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 03/14] staging: vt6655: Remove spaces before quoted newlines

2014-07-24 Thread Guillaume Clement
This fixes several spaces added just before a newline in debug
strings, reported by checkpatch.

Signed-off-by: Guillaume Clement 
---
 drivers/staging/vt6655/card.c|  2 +-
 drivers/staging/vt6655/device_main.c | 53 -
 drivers/staging/vt6655/dpc.c | 13 ---
 drivers/staging/vt6655/hostap.c  | 46 +++---
 drivers/staging/vt6655/iwctl.c   | 75 ++--
 drivers/staging/vt6655/key.c | 14 +++
 drivers/staging/vt6655/power.c   |  2 +-
 drivers/staging/vt6655/rxtx.c|  2 +-
 drivers/staging/vt6655/wcmd.c| 18 -
 drivers/staging/vt6655/wmgr.c| 22 +--
 10 files changed, 125 insertions(+), 122 deletions(-)

diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index fdeb805..ac49fba 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -2090,6 +2090,6 @@ void CARDvUpdateNextTBTT(void __iomem *dwIoBase, QWORD 
qwTSF, unsigned short wBe
VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT, LODWORD(qwTSF));
VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT + 4, HIDWORD(qwTSF));
MACvRegBitsOn(dwIoBase, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN);
-   DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Card:Update Next TBTT[%8xh:%8xh] 
\n",
+   DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Card:Update Next TBTT[%8xh:%8xh]\n",
(unsigned int) HIDWORD(qwTSF), (unsigned int) LODWORD(qwTSF));
 }
diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index b3b2ee6..f1b4d58 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -818,7 +818,7 @@ vt6655_probe(struct pci_dev *pcid, const struct 
pci_device_id *ent)
pDevice = (PSDevice) netdev_priv(dev);
 
if (dev == NULL) {
-   printk(KERN_ERR DEVICE_NAME ": allocate net device failed \n");
+   printk(KERN_ERR DEVICE_NAME ": allocate net device failed\n");
return -ENOMEM;
}
 
@@ -967,11 +967,11 @@ static void device_print_info(PSDevice pDevice)
DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "%s: MAC=%pM", dev->name, 
dev->dev_addr);
 #ifdef IO_MAP
DBG_PRT(MSG_LEVEL_INFO, KERN_INFO " IO=0x%lx  ", (unsigned 
long)pDevice->ioaddr);
-   DBG_PRT(MSG_LEVEL_INFO, KERN_INFO " IRQ=%d \n", pDevice->dev->irq);
+   DBG_PRT(MSG_LEVEL_INFO, KERN_INFO " IRQ=%d\n", pDevice->dev->irq);
 #else
DBG_PRT(MSG_LEVEL_INFO, KERN_INFO " IO=0x%lx Mem=0x%lx ",
(unsigned long)pDevice->ioaddr, (unsigned 
long)pDevice->PortOffset);
-   DBG_PRT(MSG_LEVEL_INFO, KERN_INFO " IRQ=%d \n", pDevice->dev->irq);
+   DBG_PRT(MSG_LEVEL_INFO, KERN_INFO " IRQ=%d\n", pDevice->dev->irq);
 #endif
 }
 
@@ -1498,7 +1498,7 @@ static int device_tx_srv(PSDevice pDevice, unsigned int 
uIdx) {
 
if ((pTD->pTDInfo->byFlags & TD_FLAGS_PRIV_SKB) != 0) {
if (pDevice->bEnableHostapd) {
-   DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "tx 
call back netif.. \n");
+   DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "tx 
call back netif..\n");
skb = pTD->pTDInfo->skb;
skb->dev = pDevice->apdev;
skb_reset_mac_header(skb);
@@ -1720,7 +1720,7 @@ static int  device_open(struct net_device *dev) {
}
pDevice->flags |= DEVICE_FLAGS_OPENED;
 
-   DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_open success.. \n");
+   DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_open success..\n");
return 0;
 }
 
@@ -1772,7 +1772,7 @@ static int  device_close(struct net_device *dev) {
//2008-0714-01by chester
device_release_WPADEV(pDevice);
 
-   DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_close.. \n");
+   DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_close..\n");
return 0;
 }
 
@@ -1879,7 +1879,7 @@ bool device_dma0_xmit(PSDevice pDevice, struct sk_buff 
*skb, unsigned int uNodeI
else
pDevice->byPreambleType = PREAMBLE_LONG;
 
-   DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dma0: pDevice->wCurrentRate = %d 
\n", pDevice->wCurrentRate);
+   DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dma0: pDevice->wCurrentRate = 
%d\n", pDevice->wCurrentRate);
 
if (pDevice->wCurrentRate <= RATE_11M) {
byPktType = PK_TYPE_11B;
@@ -2022,7 +2022,7 @@ static int  device_xmit(struct sk_buff *skb, struct 
net_device *dev) {
}
 
if (!bNodeExist) {
-   DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBU

[PATCH 02/14] staging: vt6655: Add missing blank lines after declarations

2014-07-24 Thread Guillaume Clement
This patch fixes the missing blank lines after declarations in vt6655
reported by checkpatch.

Signed-off-by: Guillaume Clement 
---
 drivers/staging/vt6655/80211mgr.c|  1 +
 drivers/staging/vt6655/baseband.c|  1 +
 drivers/staging/vt6655/bssdb.c   |  7 +++
 drivers/staging/vt6655/card.c|  1 +
 drivers/staging/vt6655/device.h  |  1 +
 drivers/staging/vt6655/device_main.c | 11 +++
 drivers/staging/vt6655/dpc.c |  3 +++
 drivers/staging/vt6655/iwctl.c   |  8 
 drivers/staging/vt6655/rc4.c |  1 +
 drivers/staging/vt6655/rf.c  |  2 ++
 drivers/staging/vt6655/rxtx.c|  8 
 drivers/staging/vt6655/vntwifi.c |  3 +++
 drivers/staging/vt6655/wcmd.c|  1 +
 drivers/staging/vt6655/wmgr.c|  2 ++
 drivers/staging/vt6655/wpa.c |  1 +
 drivers/staging/vt6655/wpactl.c  |  1 +
 16 files changed, 52 insertions(+)

diff --git a/drivers/staging/vt6655/80211mgr.c 
b/drivers/staging/vt6655/80211mgr.c
index acdbbbd..96b0d61 100644
--- a/drivers/staging/vt6655/80211mgr.c
+++ b/drivers/staging/vt6655/80211mgr.c
@@ -546,6 +546,7 @@ vMgrDecodeReassocRequest(
 )
 {
PWLAN_IE   pItem;
+
pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
 
/* Fixed Fields */
diff --git a/drivers/staging/vt6655/baseband.c 
b/drivers/staging/vt6655/baseband.c
index c96bc7a..f212b88 100644
--- a/drivers/staging/vt6655/baseband.c
+++ b/drivers/staging/vt6655/baseband.c
@@ -2289,6 +2289,7 @@ void BBvReadAllRegs(void __iomem *dwIoBase, unsigned char 
*pbyBBRegs)
 {
int  ii;
unsigned char byBase = 1;
+
for (ii = 0; ii < BB_MAX_CONTEXT_SIZE; ii++) {
BBbReadEmbedded(dwIoBase, (unsigned char)(ii*byBase), 
pbyBBRegs);
pbyBBRegs += byBase;
diff --git a/drivers/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c
index 5f9fd2b..58f85e8 100644
--- a/drivers/staging/vt6655/bssdb.c
+++ b/drivers/staging/vt6655/bssdb.c
@@ -422,6 +422,7 @@ BSSbInsertToBSSList(
 
if (pRSN != NULL) {
unsigned int uLen = pRSN->len + 2;
+
if (uLen <= (uIELength - (unsigned int)((unsigned char *)pRSN - 
pbyIEs))) {
pBSSList->wRSNLen = uLen;
memcpy(pBSSList->byRSNIE, pRSN, uLen);
@@ -598,6 +599,7 @@ BSSbUpdateToBSSList(
 
if (pRSNWPA != NULL) {
unsigned int uLen = pRSNWPA->len + 2;
+
if (uLen <= (uIELength - (unsigned int)((unsigned char 
*)pRSNWPA - pbyIEs))) {
pBSSList->wWPALen = uLen;
memcpy(pBSSList->byWPAIE, pRSNWPA, uLen);
@@ -609,6 +611,7 @@ BSSbUpdateToBSSList(
 
if (pRSN != NULL) {
unsigned int uLen = pRSN->len + 2;
+
if (uLen <= (uIELength - (unsigned int)((unsigned char *)pRSN - 
pbyIEs))) {
pBSSList->wRSNLen = uLen;
memcpy(pBSSList->byRSNIE, pRSN, uLen);
@@ -988,6 +991,7 @@ start:
 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
{
union iwreq_data  wrqu;
+
memset(&wrqu, 0, sizeof(wrqu));
wrqu.ap_addr.sa_family = ARPHRD_ETHER;

PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n");
@@ -1167,6 +1171,7 @@ start:
 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
{
union iwreq_data  wrqu;
+
memset(&wrqu, 0, sizeof(wrqu));
wrqu.ap_addr.sa_family = ARPHRD_ETHER;

PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n");
@@ -1267,6 +1272,7 @@ BSSvUpdateNodeTxCounter(
unsigned short wFallBackRate = RATE_1M;
unsigned char byFallBack;
unsigned int ii;
+
pTxBufHead = (PSTxBufHead) pbyBuffer;
if (pTxBufHead->wFIFOCtl & FIFOCTL_AUTO_FB_0)
byFallBack = AUTO_FB_0;
@@ -1451,6 +1457,7 @@ void s_vCheckSensitivity(
/* Update BB Reg if RSSI is too strong */
longLocalldBmAverage = 0;
longuNumofdBm = 0;
+
for (ii = 0; ii < RSSI_STAT_COUNT; ii++) {
if (pBSSList->ldBmAverage[ii] != 0) {
uNumofdBm++;
diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index f2674b4..fdeb805 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -1770,6 +1770,7 @@ void vUpdateIFS(void *pDeviceHandler)
PSDevice pDevice = (PSDevice) pDeviceHandler;
 
unsigned char byMaxMin = 0;
+
if (pDevice->byPacketType == PK_TYPE_11A) {//   00

[PATCH 09/14] staging: vt6655: Remove unreachable break statements

2014-07-24 Thread Guillaume Clement
This fixes break "break is not useful after a goto or return"
checkpatch warnings.

Signed-off-by: Guillaume Clement 
---
 drivers/staging/vt6655/rf.c  | 2 --
 drivers/staging/vt6655/wpa.c | 1 -
 2 files changed, 3 deletions(-)

diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c
index d2d7dff..42b257f 100644
--- a/drivers/staging/vt6655/rf.c
+++ b/drivers/staging/vt6655/rf.c
@@ -873,11 +873,9 @@ bool RFvWriteWakeProgSyn(void __iomem *dwIoBase, unsigned 
char byRFType, unsigne
 
case RF_NOTHING:
return true;
-   break;
 
default:
return false;
-   break;
}
 
MACvSetMISCFifo(dwIoBase, MISCFIFO_SYNINFO_IDX, (unsigned 
long)MAKEWORD(bySleepCount, byInitCount));
diff --git a/drivers/staging/vt6655/wpa.c b/drivers/staging/vt6655/wpa.c
index 505c895..2bd9e1f 100644
--- a/drivers/staging/vt6655/wpa.c
+++ b/drivers/staging/vt6655/wpa.c
@@ -262,7 +262,6 @@ WPA_SearchRSN(
return false;
}
return true;
-   break;
 
default:
break;
-- 
1.8.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 07/14] staging: vt6655: Use pr_* functions instead of printk

2014-07-24 Thread Guillaume Clement
Lots of printk are used in vt6655, replace them with the pr_*
equivalent.

Signed-off-by: Guillaume Clement 
---
 drivers/staging/vt6655/card.c| 12 +++---
 drivers/staging/vt6655/device_cfg.h  |  2 +-
 drivers/staging/vt6655/device_main.c | 71 ++--
 drivers/staging/vt6655/ioctl.c   |  8 ++--
 drivers/staging/vt6655/iwctl.c   | 16 
 drivers/staging/vt6655/vntwifi.c |  2 +-
 drivers/staging/vt6655/wcmd.c| 11 +++---
 drivers/staging/vt6655/wmgr.c|  9 +++--
 drivers/staging/vt6655/wpactl.c  |  4 +-
 9 files changed, 69 insertions(+), 66 deletions(-)

diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index ac49fba..58d707f 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -910,7 +910,7 @@ bool CARDbRadioPowerOff(void *pDeviceHandler)
 
pDevice->bRadioOff = true;
//2007-0409-03, by chester
-   printk("chester power off\n");
+   pr_debug("chester power off\n");
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_GPIOCTL0, LED_ACTSET);  
//LED issue
return bResult;
 }
@@ -932,14 +932,14 @@ bool CARDbRadioPowerOn(void *pDeviceHandler)
PSDevicepDevice = (PSDevice) pDeviceHandler;
bool bResult = true;
 
-   printk("chester power on\n");
+   pr_debug("chester power on\n");
if (pDevice->bRadioControlOff == true) {
-   if (pDevice->bHWRadioOff == true) printk("chester 
bHWRadioOff\n");
-   if (pDevice->bRadioControlOff == true) printk("chester 
bRadioControlOff\n");
+   if (pDevice->bHWRadioOff == true) pr_debug("chester 
bHWRadioOff\n");
+   if (pDevice->bRadioControlOff == true) pr_debug("chester 
bRadioControlOff\n");
return false; }
 
if (pDevice->bRadioOff == false) {
-   printk("chester pbRadioOff\n");
+   pr_debug("chester pbRadioOff\n");
return true; }
 
BBvExitDeepSleep(pDevice->PortOffset, pDevice->byLocalID);
@@ -963,7 +963,7 @@ bool CARDbRadioPowerOn(void *pDeviceHandler)
 
pDevice->bRadioOff = false;
 //  2007-0409-03, by chester
-   printk("chester power on\n");
+   pr_debug("chester power on\n");
MACvRegBitsOff(pDevice->PortOffset, MAC_REG_GPIOCTL0, LED_ACTSET); 
//LED issue
return bResult;
 }
diff --git a/drivers/staging/vt6655/device_cfg.h 
b/drivers/staging/vt6655/device_cfg.h
index 1137ade..af28924 100644
--- a/drivers/staging/vt6655/device_cfg.h
+++ b/drivers/staging/vt6655/device_cfg.h
@@ -81,7 +81,7 @@ typedef enum  _chip_type {
 #define ASSERT(x)  \
 do {   \
if (!(x)) { \
-   printk(KERN_ERR "assertion %s failed: file %s line %d\n", \
+   pr_err("assertion %s failed: file %s line %d\n", \
   #x, __func__, __LINE__); \
*(int *)0 = 0;  \
}   \
diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index 8c035d5..c3cae50 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -579,12 +579,12 @@ static void device_init_registers(PSDevice pDevice, 
DEVICE_INIT_TYPE InitType)
 
else {
if (zonetype != 
pDevice->abyEEPROM[EEP_OFS_ZONETYPE])
-   printk("zonetype in file[%02x] mismatch 
with in EEPROM[%02x]\n", zonetype, pDevice->abyEEPROM[EEP_OFS_ZONETYPE]);
+   pr_debug("zonetype in file[%02x] 
mismatch with in EEPROM[%02x]\n", zonetype, 
pDevice->abyEEPROM[EEP_OFS_ZONETYPE]);
else
-   printk("Read Zonetype file success,use 
default zonetype setting[%02x]\n", zonetype);
+   pr_debug("Read Zonetype file 
success,use default zonetype setting[%02x]\n", zonetype);
}
} else
-   printk("Read Zonetype file fail,use default zonetype 
setting[%02x]\n", SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ZONETYPE));
+   pr_debug("Read Zonetype file fail,use default zonetype 
setting[%02x]\n", SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ZONETYPE));
 
// Get RFType
pDevice->byRFType = SROMbyReadEmbedded(pDevice->PortOffset, 
EEP_O

[PATCH 01/14] staging: vt6655: remove useless return statements

2014-07-24 Thread Guillaume Clement
Many return statements in void function were present at the end of
functions, with no effect. They now are removed.

This fixes a bunch of checkpatch warnings.

Signed-off-by: Guillaume Clement 
---
 drivers/staging/vt6655/80211mgr.c| 36 ---
 drivers/staging/vt6655/baseband.c|  3 ---
 drivers/staging/vt6655/bssdb.c   |  8 ---
 drivers/staging/vt6655/card.c|  4 
 drivers/staging/vt6655/datarate.c|  2 --
 drivers/staging/vt6655/device_main.c |  2 --
 drivers/staging/vt6655/hostap.c  |  2 --
 drivers/staging/vt6655/key.c |  1 -
 drivers/staging/vt6655/power.c   |  4 
 drivers/staging/vt6655/rxtx.c|  4 
 drivers/staging/vt6655/vntwifi.c |  3 ---
 drivers/staging/vt6655/wcmd.c|  2 --
 drivers/staging/vt6655/wmgr.c| 41 
 13 files changed, 112 deletions(-)

diff --git a/drivers/staging/vt6655/80211mgr.c 
b/drivers/staging/vt6655/80211mgr.c
index 9aa2e46..acdbbbd 100644
--- a/drivers/staging/vt6655/80211mgr.c
+++ b/drivers/staging/vt6655/80211mgr.c
@@ -102,8 +102,6 @@ vMgrEncodeBeacon(
 WLAN_BEACON_OFF_CAPINFO);
 
pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_BEACON_OFF_SSID;
-
-   return;
 }
 
 /*+
@@ -228,8 +226,6 @@ vMgrDecodeBeacon(
}
pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
}
-
-   return;
 }
 
 /*+
@@ -250,8 +246,6 @@ vMgrEncodeIBSSATIM(
 {
pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
pFrame->len = WLAN_HDR_ADDR3_LEN;
-
-   return;
 }
 
 /*+
@@ -271,8 +265,6 @@ vMgrDecodeIBSSATIM(
 )
 {
pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
-
-   return;
 }
 
 /*+
@@ -299,8 +291,6 @@ vMgrEncodeDisassociation(
WLAN_DISASSOC_OFF_REASON);
pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_DISASSOC_OFF_REASON +
  sizeof(*(pFrame->pwReason));
-
-   return;
 }
 
 /*+
@@ -325,8 +315,6 @@ vMgrDecodeDisassociation(
pFrame->pwReason = (unsigned short *)
   (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
WLAN_DISASSOC_OFF_REASON);
-
-   return;
 }
 
 /*+
@@ -355,7 +343,6 @@ vMgrEncodeAssocRequest(
WLAN_ASSOCREQ_OFF_LISTEN_INT);
pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_ASSOCREQ_OFF_LISTEN_INT +
  sizeof(*(pFrame->pwListenInterval));
-   return;
 }
 
 /*+
@@ -426,7 +413,6 @@ vMgrDecodeAssocRequest(
}
pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
}
-   return;
 }
 
 /*+
@@ -459,8 +445,6 @@ vMgrEncodeAssocResponse(
 WLAN_ASSOCRESP_OFF_AID);
pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_ASSOCRESP_OFF_AID +
  sizeof(*(pFrame->pwAid));
-
-   return;
 }
 
 /*+
@@ -511,7 +495,6 @@ vMgrDecodeAssocResponse(
} else {
pFrame->pExtSuppRates = NULL;
}
-   return;
 }
 
 /*+
@@ -544,8 +527,6 @@ vMgrEncodeReassocRequest(
   WLAN_REASSOCREQ_OFF_CURR_AP);
pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCREQ_OFF_CURR_AP +
  sizeof(*(pFrame->pAddrCurrAP));
-
-   return;
 }
 
 /*+
@@ -619,7 +600,6 @@ vMgrDecodeReassocRequest(
}
pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
}
-   return;
 }
 
 /*+
@@ -640,7 +620,6 @@ vMgrEncodeProbeRequest(
 {
pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
pFrame->len = WLAN_HDR_ADDR3_LEN;
-   return;
 }
 
 /*+
@@ -694,7 +673,6 @@ vMgrDecodeProbeRequest(
 
pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 +  pItem->len);
}
-   return;
 }
 
 /*+
@@ -728,8 +706,6 @@ vMgrEncodeProbeResponse(
 
pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_PROBERESP_OFF_CAP_INFO +
  sizeof(*(pFrame->pwCapInfo));
-
-   return;
 }
 
 /*+
@@ -850,7 +826,6 @@ vMgrDecodeProbeResponse(
 
pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 +  pItem->len);
}
-   return;
 }
 
 /*+
@@ -883,8 +858,6 @@ vMgrEncodeAuthen(
WLAN_AUTHEN_OFF_STATUS);
pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_AUTHEN_OFF_STATUS +
  sizeof(*(pFrame->pwStatus));
-
-   return;
 }
 
 /*+
@@ -925,8 +898,6 @@ vMgrDecodeAuthen(
if (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len) &&
pItem->byElementID == WLAN_EID_CHALLENGE)
pFrame->pChallenge = (PWLAN_IE_CHALLENGE)pItem;
-
-   return;
 }
 
 /*+
@@ -953,8 +924,6 @@ vMgrEncodeDeauthen(
WLAN_DEAUTHEN_OFF_REASON);
pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_DEAUTHEN_OFF_REASON