Commit 96b3c83d authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Greg Kroah-Hartman

Staging: rt28x0: run common/*.c files through Lindent

Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 66cd8d6e
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -35,50 +35,41 @@ ...@@ -35,50 +35,41 @@
--------- ---------- ---------------------------------------------- --------- ---------- ----------------------------------------------
*/ */
#include "../rt_config.h" #include "../rt_config.h"
char *GetPhyMode(int Mode)
char* GetPhyMode(
int Mode)
{ {
switch(Mode) switch (Mode) {
{ case MODE_CCK:
case MODE_CCK: return "CCK";
return "CCK";
case MODE_OFDM:
case MODE_OFDM: return "OFDM";
return "OFDM"; case MODE_HTMIX:
case MODE_HTMIX: return "HTMIX";
return "HTMIX";
case MODE_HTGREENFIELD:
case MODE_HTGREENFIELD: return "GREEN";
return "GREEN"; default:
default: return "N/A";
return "N/A";
} }
} }
char *GetBW(int BW)
char* GetBW(
int BW)
{ {
switch(BW) switch (BW) {
{ case BW_10:
case BW_10: return "10M";
return "10M";
case BW_20:
case BW_20: return "20M";
return "20M"; case BW_40:
case BW_40: return "40M";
return "40M"; default:
default: return "N/A";
return "N/A";
} }
} }
/* /*
========================================================================== ==========================================================================
Description: Description:
...@@ -89,46 +80,37 @@ char* GetBW( ...@@ -89,46 +80,37 @@ char* GetBW(
TRUE if all parameters are OK, FALSE otherwise TRUE if all parameters are OK, FALSE otherwise
========================================================================== ==========================================================================
*/ */
INT RT_CfgSetCountryRegion( INT RT_CfgSetCountryRegion(IN PRTMP_ADAPTER pAd, IN PSTRING arg, IN INT band)
IN PRTMP_ADAPTER pAd,
IN PSTRING arg,
IN INT band)
{ {
LONG region, regionMax; LONG region, regionMax;
UCHAR *pCountryRegion; UCHAR *pCountryRegion;
region = simple_strtol(arg, 0, 10); region = simple_strtol(arg, 0, 10);
if (band == BAND_24G) if (band == BAND_24G) {
{
pCountryRegion = &pAd->CommonCfg.CountryRegion; pCountryRegion = &pAd->CommonCfg.CountryRegion;
regionMax = REGION_MAXIMUM_BG_BAND; regionMax = REGION_MAXIMUM_BG_BAND;
} } else {
else
{
pCountryRegion = &pAd->CommonCfg.CountryRegionForABand; pCountryRegion = &pAd->CommonCfg.CountryRegionForABand;
regionMax = REGION_MAXIMUM_A_BAND; regionMax = REGION_MAXIMUM_A_BAND;
} }
// TODO: Is it neccesay for following check??? // TODO: Is it neccesay for following check???
// Country can be set only when EEPROM not programmed // Country can be set only when EEPROM not programmed
if (*pCountryRegion & 0x80) if (*pCountryRegion & 0x80) {
{ DBGPRINT(RT_DEBUG_ERROR,
DBGPRINT(RT_DEBUG_ERROR, ("CfgSetCountryRegion():CountryRegion in eeprom was programmed\n")); ("CfgSetCountryRegion():CountryRegion in eeprom was programmed\n"));
return FALSE; return FALSE;
} }
if((region >= 0) && (region <= REGION_MAXIMUM_BG_BAND)) if ((region >= 0) && (region <= REGION_MAXIMUM_BG_BAND)) {
{
*pCountryRegion= (UCHAR) region;
}
else if ((region == REGION_31_BG_BAND) && (band == BAND_24G))
{
*pCountryRegion = (UCHAR) region; *pCountryRegion = (UCHAR) region;
} } else if ((region == REGION_31_BG_BAND) && (band == BAND_24G)) {
else *pCountryRegion = (UCHAR) region;
{ } else {
DBGPRINT(RT_DEBUG_ERROR, ("CfgSetCountryRegion():region(%ld) out of range!\n", region)); DBGPRINT(RT_DEBUG_ERROR,
("CfgSetCountryRegion():region(%ld) out of range!\n",
region));
return FALSE; return FALSE;
} }
...@@ -136,7 +118,6 @@ INT RT_CfgSetCountryRegion( ...@@ -136,7 +118,6 @@ INT RT_CfgSetCountryRegion(
} }
/* /*
========================================================================== ==========================================================================
Description: Description:
...@@ -145,18 +126,15 @@ INT RT_CfgSetCountryRegion( ...@@ -145,18 +126,15 @@ INT RT_CfgSetCountryRegion(
TRUE if all parameters are OK, FALSE otherwise TRUE if all parameters are OK, FALSE otherwise
========================================================================== ==========================================================================
*/ */
INT RT_CfgSetWirelessMode( INT RT_CfgSetWirelessMode(IN PRTMP_ADAPTER pAd, IN PSTRING arg)
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
{ {
INT MaxPhyMode = PHY_11G; INT MaxPhyMode = PHY_11G;
LONG WirelessMode; LONG WirelessMode;
MaxPhyMode = PHY_11N_5G; MaxPhyMode = PHY_11N_5G;
WirelessMode = simple_strtol(arg, 0, 10); WirelessMode = simple_strtol(arg, 0, 10);
if (WirelessMode <= MaxPhyMode) if (WirelessMode <= MaxPhyMode) {
{
pAd->CommonCfg.PhyMode = WirelessMode; pAd->CommonCfg.PhyMode = WirelessMode;
return TRUE; return TRUE;
} }
...@@ -165,10 +143,7 @@ INT RT_CfgSetWirelessMode( ...@@ -165,10 +143,7 @@ INT RT_CfgSetWirelessMode(
} }
INT RT_CfgSetShortSlot(IN PRTMP_ADAPTER pAd, IN PSTRING arg)
INT RT_CfgSetShortSlot(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
{ {
LONG ShortSlot; LONG ShortSlot;
...@@ -179,12 +154,11 @@ INT RT_CfgSetShortSlot( ...@@ -179,12 +154,11 @@ INT RT_CfgSetShortSlot(
else if (ShortSlot == 0) else if (ShortSlot == 0)
pAd->CommonCfg.bUseShortSlotTime = FALSE; pAd->CommonCfg.bUseShortSlotTime = FALSE;
else else
return FALSE; //Invalid argument return FALSE; //Invalid argument
return TRUE; return TRUE;
} }
/* /*
========================================================================== ==========================================================================
Description: Description:
...@@ -193,54 +167,53 @@ INT RT_CfgSetShortSlot( ...@@ -193,54 +167,53 @@ INT RT_CfgSetShortSlot(
TRUE if all parameters are OK, FALSE otherwise TRUE if all parameters are OK, FALSE otherwise
========================================================================== ==========================================================================
*/ */
INT RT_CfgSetWepKey( INT RT_CfgSetWepKey(IN PRTMP_ADAPTER pAd,
IN PRTMP_ADAPTER pAd, IN PSTRING keyString,
IN PSTRING keyString, IN CIPHER_KEY * pSharedKey, IN INT keyIdx)
IN CIPHER_KEY *pSharedKey,
IN INT keyIdx)
{ {
INT KeyLen; INT KeyLen;
INT i; INT i;
UCHAR CipherAlg = CIPHER_NONE; UCHAR CipherAlg = CIPHER_NONE;
BOOLEAN bKeyIsHex = FALSE; BOOLEAN bKeyIsHex = FALSE;
// TODO: Shall we do memset for the original key info?? // TODO: Shall we do memset for the original key info??
memset(pSharedKey, 0, sizeof(CIPHER_KEY)); memset(pSharedKey, 0, sizeof(CIPHER_KEY));
KeyLen = strlen(keyString); KeyLen = strlen(keyString);
switch (KeyLen) switch (KeyLen) {
{ case 5: //wep 40 Ascii type
case 5: //wep 40 Ascii type case 13: //wep 104 Ascii type
case 13: //wep 104 Ascii type bKeyIsHex = FALSE;
bKeyIsHex = FALSE; pSharedKey->KeyLen = KeyLen;
pSharedKey->KeyLen = KeyLen; NdisMoveMemory(pSharedKey->Key, keyString, KeyLen);
NdisMoveMemory(pSharedKey->Key, keyString, KeyLen); break;
break;
case 10: //wep 40 Hex type
case 10: //wep 40 Hex type case 26: //wep 104 Hex type
case 26: //wep 104 Hex type for (i = 0; i < KeyLen; i++) {
for(i=0; i < KeyLen; i++) if (!isxdigit(*(keyString + i)))
{ return FALSE; //Not Hex value;
if( !isxdigit(*(keyString+i)) ) }
return FALSE; //Not Hex value; bKeyIsHex = TRUE;
} pSharedKey->KeyLen = KeyLen / 2;
bKeyIsHex = TRUE; AtoH(keyString, pSharedKey->Key, pSharedKey->KeyLen);
pSharedKey->KeyLen = KeyLen/2 ; break;
AtoH(keyString, pSharedKey->Key, pSharedKey->KeyLen);
break; default: //Invalid argument
DBGPRINT(RT_DEBUG_TRACE,
default: //Invalid argument ("RT_CfgSetWepKey(keyIdx=%d):Invalid argument (arg=%s)\n",
DBGPRINT(RT_DEBUG_TRACE, ("RT_CfgSetWepKey(keyIdx=%d):Invalid argument (arg=%s)\n", keyIdx, keyString)); keyIdx, keyString));
return FALSE; return FALSE;
} }
pSharedKey->CipherAlg = ((KeyLen % 5) ? CIPHER_WEP128 : CIPHER_WEP64); pSharedKey->CipherAlg = ((KeyLen % 5) ? CIPHER_WEP128 : CIPHER_WEP64);
DBGPRINT(RT_DEBUG_TRACE, ("RT_CfgSetWepKey:(KeyIdx=%d,type=%s, Alg=%s)\n", DBGPRINT(RT_DEBUG_TRACE,
keyIdx, (bKeyIsHex == FALSE ? "Ascii" : "Hex"), CipherName[CipherAlg])); ("RT_CfgSetWepKey:(KeyIdx=%d,type=%s, Alg=%s)\n", keyIdx,
(bKeyIsHex == FALSE ? "Ascii" : "Hex"),
CipherName[CipherAlg]));
return TRUE; return TRUE;
} }
/* /*
========================================================================== ==========================================================================
Description: Description:
...@@ -257,33 +230,28 @@ INT RT_CfgSetWepKey( ...@@ -257,33 +230,28 @@ INT RT_CfgSetWepKey(
TRUE if all parameters are OK, FALSE otherwise TRUE if all parameters are OK, FALSE otherwise
========================================================================== ==========================================================================
*/ */
INT RT_CfgSetWPAPSKKey( INT RT_CfgSetWPAPSKKey(IN RTMP_ADAPTER * pAd,
IN RTMP_ADAPTER *pAd, IN PSTRING keyString,
IN PSTRING keyString, IN UCHAR * pHashStr,
IN UCHAR *pHashStr, IN INT hashStrLen, OUT PUCHAR pPMKBuf)
IN INT hashStrLen,
OUT PUCHAR pPMKBuf)
{ {
int keyLen; int keyLen;
UCHAR keyMaterial[40]; UCHAR keyMaterial[40];
keyLen = strlen(keyString); keyLen = strlen(keyString);
if ((keyLen < 8) || (keyLen > 64)) if ((keyLen < 8) || (keyLen > 64)) {
{ DBGPRINT(RT_DEBUG_TRACE,
DBGPRINT(RT_DEBUG_TRACE, ("WPAPSK Key length(%d) error, required 8 ~ 64 characters!(keyStr=%s)\n", ("WPAPSK Key length(%d) error, required 8 ~ 64 characters!(keyStr=%s)\n",
keyLen, keyString)); keyLen, keyString));
return FALSE; return FALSE;
} }
memset(pPMKBuf, 0, 32); memset(pPMKBuf, 0, 32);
if (keyLen == 64) if (keyLen == 64) {
{ AtoH(keyString, pPMKBuf, 32);
AtoH(keyString, pPMKBuf, 32); } else {
} PasswordHash(keyString, pHashStr, hashStrLen, keyMaterial);
else NdisMoveMemory(pPMKBuf, keyMaterial, 32);
{
PasswordHash(keyString, pHashStr, hashStrLen, keyMaterial);
NdisMoveMemory(pPMKBuf, keyMaterial, 32);
} }
return TRUE; return TRUE;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -52,17 +52,13 @@ ...@@ -52,17 +52,13 @@
======================================================================== ========================================================================
*/ */
BOOLEAN RadarChannelCheck( BOOLEAN RadarChannelCheck(IN PRTMP_ADAPTER pAd, IN UCHAR Ch)
IN PRTMP_ADAPTER pAd,
IN UCHAR Ch)
{ {
INT i; INT i;
BOOLEAN result = FALSE; BOOLEAN result = FALSE;
for (i=0; i<pAd->ChannelListNum; i++) for (i = 0; i < pAd->ChannelListNum; i++) {
{ if (Ch == pAd->ChannelList[i].Channel) {
if (Ch == pAd->ChannelList[i].Channel)
{
result = pAd->ChannelList[i].DfsReq; result = pAd->ChannelList[i].DfsReq;
break; break;
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment