[PATCH 2/3] staging: vt6656: hostap.c: Code cleanup

Marcos Paulo de Souza marcos.mage at gmail.com
Fri Dec 2 19:02:45 UTC 2011


This patch just removes commented code and fix the coding style of the
headers of functions.

Signed-off-by: Marcos Paulo de Souza <marcos.mage at gmail.com>
Cc: Greg Kroah-Hartman <gregkh at suse.de>
Cc: devel at driverdev.osuosl.org
---
 drivers/staging/vt6656/hostap.c |  284 ++-------------------------------------
 1 files changed, 12 insertions(+), 272 deletions(-)

diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c
index 51b5adf..89b6611 100644
--- a/drivers/staging/vt6656/hostap.c
+++ b/drivers/staging/vt6656/hostap.c
@@ -49,37 +49,9 @@
 #define HOSTAP_CRYPT_ERR_TX_KEY_SET_FAILED 6
 #define HOSTAP_CRYPT_ERR_CARD_CONF_FAILED 7
 
-
-/*---------------------  Static Definitions -------------------------*/
-
-/*---------------------  Static Classes  ----------------------------*/
-
-/*---------------------  Static Variables  --------------------------*/
-//static int          msglevel                =MSG_LEVEL_DEBUG;
 static int          msglevel                =MSG_LEVEL_INFO;
 
-/*---------------------  Static Functions  --------------------------*/
-
-
-
-
-/*---------------------  Export Variables  --------------------------*/
-
-
-/*
- * Description:
- *      register net_device (AP) for hostap deamon
- *
- * Parameters:
- *  In:
- *      pDevice             -
- *      rtnl_locked         -
- *  Out:
- *
- * Return Value:
- *
- */
-
+/* register net_device (AP) for hostap deamon */
 static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
 {
     PSDevice apdev_priv;
@@ -126,20 +98,7 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
 	return 0;
 }
 
-/*
- * Description:
- *      unregister net_device(AP)
- *
- * Parameters:
- *  In:
- *      pDevice             -
- *      rtnl_locked         -
- *  Out:
- *
- * Return Value:
- *
- */
-
+/* unregister net_device(AP) */
 static int hostap_disable_hostapd(PSDevice pDevice, int rtnl_locked)
 {
 
@@ -162,21 +121,7 @@ static int hostap_disable_hostapd(PSDevice pDevice, int rtnl_locked)
 	return 0;
 }
 
-
-/*
- * Description:
- *      Set enable/disable hostapd mode
- *
- * Parameters:
- *  In:
- *      pDevice             -
- *      rtnl_locked         -
- *  Out:
- *
- * Return Value:
- *
- */
-
+/* Set enable/disable hostapd mode */
 int vt6656_hostap_set_hostapd(PSDevice pDevice, int val, int rtnl_locked)
 {
 	if (val < 0 || val > 1)
@@ -193,20 +138,7 @@ int vt6656_hostap_set_hostapd(PSDevice pDevice, int val, int rtnl_locked)
 		return hostap_disable_hostapd(pDevice, rtnl_locked);
 }
 
-
-/*
- * Description:
- *      remove station function supported for hostap deamon
- *
- * Parameters:
- *  In:
- *      pDevice   -
- *      param     -
- *  Out:
- *
- * Return Value:
- *
- */
+/* remove station function supported for hostap deamon */
 static int hostap_remove_sta(PSDevice pDevice,
 				     struct viawget_hostapd_param *param)
 {
@@ -222,19 +154,7 @@ static int hostap_remove_sta(PSDevice pDevice,
 	return 0;
 }
 
-/*
- * Description:
- *      add a station from hostap deamon
- *
- * Parameters:
- *  In:
- *      pDevice   -
- *      param     -
- *  Out:
- *
- * Return Value:
- *
- */
+/*  add a station from hostap deamon */
 static int hostap_add_sta(PSDevice pDevice,
 				  struct viawget_hostapd_param *param)
 {
@@ -266,35 +186,10 @@ static int hostap_add_sta(PSDevice pDevice,
 
     pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer = jiffies;
 
-    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Add STA AID= %d \n", pMgmt->sNodeDBTable[uNodeIndex].wAID);
-    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X \n",
-               param->sta_addr[0],
-               param->sta_addr[1],
-               param->sta_addr[2],
-               param->sta_addr[3],
-               param->sta_addr[4],
-               param->sta_addr[5]
-              ) ;
-    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Max Support rate = %d \n",
-               pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate);
-
 	return 0;
 }
 
-/*
- * Description:
- *      get station info
- *
- * Parameters:
- *  In:
- *      pDevice   -
- *      param     -
- *  Out:
- *
- * Return Value:
- *
- */
-
+/* get station info */
 static int hostap_get_info_sta(PSDevice pDevice,
 				       struct viawget_hostapd_param *param)
 {
@@ -305,7 +200,6 @@ static int hostap_get_info_sta(PSDevice pDevice,
 	    param->u.get_info_sta.inactive_sec =
 	        (jiffies - pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer) / HZ;
 
-	    //param->u.get_info_sta.txexc = pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts;
 	}
 	else {
 	    return -ENOENT;
@@ -314,51 +208,7 @@ static int hostap_get_info_sta(PSDevice pDevice,
 	return 0;
 }
 
-/*
- * Description:
- *      reset txexec
- *
- * Parameters:
- *  In:
- *      pDevice   -
- *      param     -
- *  Out:
- *      TURE, FALSE
- *
- * Return Value:
- *
- */
-/*
-static int hostap_reset_txexc_sta(PSDevice pDevice,
-					  struct viawget_hostapd_param *param)
-{
-    PSMgmtObject    pMgmt = &(pDevice->sMgmtObj);
-	unsigned int uNodeIndex;
-
-    if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) {
-        pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts = 0;
-	}
-	else {
-	    return -ENOENT;
-	}
-
-	return 0;
-}
-*/
-
-/*
- * Description:
- *      set station flag
- *
- * Parameters:
- *  In:
- *      pDevice   -
- *      param     -
- *  Out:
- *
- * Return Value:
- *
- */
+/* set station flag */
 static int hostap_set_flags_sta(PSDevice pDevice,
 					struct viawget_hostapd_param *param)
 {
@@ -378,28 +228,12 @@ static int hostap_set_flags_sta(PSDevice pDevice,
 	return 0;
 }
 
-
-
-/*
- * Description:
- *      set generic element (wpa ie)
- *
- * Parameters:
- *  In:
- *      pDevice   -
- *      param     -
- *  Out:
- *
- * Return Value:
- *
- */
+/* set generic element (wpa ie) */
 static int hostap_set_generic_element(PSDevice pDevice,
 					struct viawget_hostapd_param *param)
 {
     PSMgmtObject    pMgmt = &(pDevice->sMgmtObj);
 
-
-
     memcpy( pMgmt->abyWPAIE,
             param->u.generic_elem.data,
             param->u.generic_elem.len
@@ -407,8 +241,6 @@ static int hostap_set_generic_element(PSDevice pDevice,
 
     pMgmt->wWPAIELen = 	param->u.generic_elem.len;
 
-    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pMgmt->wWPAIELen = %d\n",  pMgmt->wWPAIELen);
-
     // disable wpa
     if (pMgmt->wWPAIELen == 0) {
         pMgmt->eAuthenMode = WMAC_AUTH_OPEN;
@@ -426,41 +258,15 @@ static int hostap_set_generic_element(PSDevice pDevice,
 	return 0;
 }
 
-/*
- * Description:
- *      flush station nodes table.
- *
- * Parameters:
- *  In:
- *      pDevice   -
- *  Out:
- *
- * Return Value:
- *
- */
-
+/* flush station nodes table */
 static void hostap_flush_sta(PSDevice pDevice)
 {
     // reserved node index =0 for multicast node.
     BSSvClearNodeDBTable(pDevice, 1);
     pDevice->uAssocCount = 0;
-
-    return;
 }
 
-/*
- * Description:
- *      set each stations encryption key
- *
- * Parameters:
- *  In:
- *      pDevice   -
- *      param     -
- *  Out:
- *
- * Return Value:
- *
- */
+/* set each stations encryption key */
 static int hostap_set_encryption(PSDevice pDevice,
 				       struct viawget_hostapd_param *param,
 				       int param_len)
@@ -477,19 +283,11 @@ static int hostap_set_encryption(PSDevice pDevice,
 	BOOL    bKeyTableFull = FALSE;
 	WORD    wKeyCtl = 0;
 
-
 	param->u.crypt.err = 0;
-/*
-	if (param_len !=
-	    (int) ((char *) param->u.crypt.key - (char *) param) +
-	    param->u.crypt.key_len)
-		return -EINVAL;
-*/
 
 	if (param->u.crypt.alg > WPA_ALG_CCMP)
 		return -EINVAL;
 
-
 	if ((param->u.crypt.idx > 3) || (param->u.crypt.key_len > MAX_KEY_LEN)) {
 		param->u.crypt.err = HOSTAP_CRYPT_ERR_KEY_SET_FAILED;
 		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " HOSTAP_CRYPT_ERR_KEY_SET_FAILED\n");
@@ -510,8 +308,6 @@ static int hostap_set_encryption(PSDevice pDevice,
 	        return -EINVAL;
 	    }
 	}
-    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " hostap_set_encryption: sta_index %d \n", iNodeIndex);
-    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " hostap_set_encryption: alg %d \n", param->u.crypt.alg);
 
 	if (param->u.crypt.alg == WPA_ALG_NONE) {
 
@@ -581,7 +377,6 @@ static int hostap_set_encryption(PSDevice pDevice,
                             KEY_CTL_WEP
                            ) == TRUE) {
 
-
                 pMgmt->sNodeDBTable[iNodeIndex].bOnFly = TRUE;
 
             } else {
@@ -627,7 +422,6 @@ static int hostap_set_encryption(PSDevice pDevice,
         pMgmt->byCSSGK = KEY_CTL_CCMP;
     }
 
-
     if (iNodeIndex == 0) {
        KeybSetDefaultKey(  pDevice,
                            &(pDevice->sKey),
@@ -659,7 +453,6 @@ static int hostap_set_encryption(PSDevice pDevice,
             bKeyTableFull = TRUE;
             DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Key Table Full\n");
         }
-
     }
 
     if (bKeyTableFull == TRUE) {
@@ -668,21 +461,8 @@ static int hostap_set_encryption(PSDevice pDevice,
         wKeyCtl |= (byKeyDecMode);
         wKeyCtl |= 0x0044;              // use group key for all address
         wKeyCtl |= 0x4000;              // disable KeyTable[MAX_KEY_TABLE-1] on-fly to genernate rx int
-// Todo.. xxxxxx
-        //MACvSetDefaultKeyCtl(pDevice->PortOffset, wKeyCtl, MAX_KEY_TABLE-1, pDevice->byLocalID);
     }
 
-    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set key sta_index= %d \n", iNodeIndex);
-    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " tx_index=%d len=%d \n", param->u.crypt.idx,
-               param->u.crypt.key_len );
-    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " key=%x-%x-%x-%x-%x-xxxxx \n",
-               pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0],
-               pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[1],
-               pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[2],
-               pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[3],
-               pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[4]
-              );
-
 	// set wep key
     pDevice->bEncryptionEnable = TRUE;
     pMgmt->sNodeDBTable[iNodeIndex].byCipherSuite = byKeyDecMode;
@@ -693,21 +473,7 @@ static int hostap_set_encryption(PSDevice pDevice,
 	return ret;
 }
 
-
-
-/*
- * Description:
- *      get each stations encryption key
- *
- * Parameters:
- *  In:
- *      pDevice   -
- *      param     -
- *  Out:
- *
- * Return Value:
- *
- */
+/* get each stations encryption key */
 static int hostap_get_encryption(PSDevice pDevice,
 				       struct viawget_hostapd_param *param,
 				       int param_len)
@@ -717,7 +483,6 @@ static int hostap_get_encryption(PSDevice pDevice,
 	int     ii;
 	int     iNodeIndex =0;
 
-
 	param->u.crypt.err = 0;
 
 	if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
@@ -731,7 +496,6 @@ static int hostap_get_encryption(PSDevice pDevice,
 	        return -EINVAL;
 	    }
 	}
-	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "hostap_get_encryption: %d\n", iNodeIndex);
     memset(param->u.crypt.seq, 0, 8);
     for (ii = 0 ; ii < 8 ; ii++) {
         param->u.crypt.seq[ii] = (BYTE)pMgmt->sNodeDBTable[iNodeIndex].KeyRSC >> (ii * 8);
@@ -740,21 +504,7 @@ static int hostap_get_encryption(PSDevice pDevice,
 	return ret;
 }
 
-
-/*
- * Description:
- *      vt6656_hostap_ioctl main function supported for hostap deamon.
- *
- * Parameters:
- *  In:
- *      pDevice   -
- *      iw_point  -
- *  Out:
- *
- * Return Value:
- *
- */
-
+/* vt6656_hostap_ioctl main function supported for hostap deamon  */
 int vt6656_hostap_ioctl(PSDevice pDevice, struct iw_point *p)
 {
 	struct viawget_hostapd_param *param;
@@ -814,12 +564,6 @@ int vt6656_hostap_ioctl(PSDevice pDevice, struct iw_point *p)
 		 ret = hostap_get_info_sta(pDevice, param);
 		 ap_ioctl = 1;
 		break;
-/*
-	case VIAWGET_HOSTAPD_RESET_TXEXC_STA:
-	    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_RESET_TXEXC_STA \n");
-		 ret = hostap_reset_txexc_sta(pDevice, param);
-		break;
-*/
 	case VIAWGET_HOSTAPD_SET_FLAGS_STA:
 	    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_FLAGS_STA \n");
 		 ret = hostap_set_flags_sta(pDevice, param);
@@ -849,17 +593,13 @@ int vt6656_hostap_ioctl(PSDevice pDevice, struct iw_point *p)
 		break;
 	}
 
-
 	if ((ret == 0) && ap_ioctl) {
 		if (copy_to_user(p->pointer, param, p->length)) {
 			ret = -EFAULT;
 			goto out;
 		}
 	}
-
  out:
 	kfree(param);
-
 	return ret;
 }
-
-- 
1.7.4.4




More information about the devel mailing list