Skip to content

Commit

Permalink
Staging: rtxxx0: remove superfluous RT30xx ifdefs
Browse files Browse the repository at this point in the history
* add !RT30xx version of IS_RT3090() macro
* remove superfluous RT30xx ifdefs
* unify RT30xx and !RT30xx code where possible
* kill RT28XX_UPDATE_PROTECT() macro
* remove needless variable initializations
* kill some needless function prototypes

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Bartlomiej Zolnierkiewicz authored and Greg Kroah-Hartman committed Sep 15, 2009
1 parent bf5f6ca commit 3784339
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 193 deletions.
11 changes: 2 additions & 9 deletions drivers/staging/rt2860/common/action.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,15 +528,8 @@ VOID SendRefreshBAR(
sizeof(FRAME_BAR), &FrameBar,
END_OF_ARGS);

if (1) // Now we always send BAR.
{
#ifndef RT30xx
MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen);
#endif
#ifdef RT30xx
MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen);
#endif
}
MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen);

MlmeFreeMemory(pAd, pOutBuffer);
}
}
Expand Down
8 changes: 0 additions & 8 deletions drivers/staging/rt2860/common/ba_action.c
Original file line number Diff line number Diff line change
Expand Up @@ -1391,10 +1391,8 @@ VOID SendPSMPAction(
//ULONG Idx;
FRAME_PSMP_ACTION Frame;
ULONG FrameLen;
#ifdef RT30xx
UCHAR bbpdata=0;
UINT32 macdata;
#endif // RT30xx //

NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory
if (NStatus != NDIS_STATUS_SUCCESS)
Expand All @@ -1410,7 +1408,6 @@ VOID SendPSMPAction(
switch (Psmp)
{
case MMPS_ENABLE:
#ifdef RT30xx
if (IS_RT3090(pAd))
{
// disable MMPS BBP control register
Expand All @@ -1423,11 +1420,9 @@ VOID SendPSMPAction(
macdata &= ~(0x09); //bit 0, 3
RTMP_IO_WRITE32(pAd, 0x1210, macdata);
}
#endif // RT30xx //
Frame.Psmp = 0;
break;
case MMPS_DYNAMIC:
#ifdef RT30xx
if (IS_RT3090(pAd))
{
// enable MMPS BBP control register
Expand All @@ -1440,11 +1435,9 @@ VOID SendPSMPAction(
macdata |= 0x09; //bit 0, 3
RTMP_IO_WRITE32(pAd, 0x1210, macdata);
}
#endif // RT30xx //
Frame.Psmp = 3;
break;
case MMPS_STATIC:
#ifdef RT30xx
if (IS_RT3090(pAd))
{
// enable MMPS BBP control register
Expand All @@ -1457,7 +1450,6 @@ VOID SendPSMPAction(
macdata |= 0x09; //bit 0, 3
RTMP_IO_WRITE32(pAd, 0x1210, macdata);
}
#endif // RT30xx //
Frame.Psmp = 1;
break;
}
Expand Down
4 changes: 3 additions & 1 deletion drivers/staging/rt2860/common/cmm_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -2616,7 +2616,9 @@ BOOLEAN MacTableDeleteEntry(
AsicUpdateProtect(pAd, 0 /*pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode*/, (ALLN_SETPROTECT), TRUE, 0 /*pAd->MacTab.fAnyStationNonGF*/);
#endif
#ifdef RT30xx
RT28XX_UPDATE_PROTECT(pAd); // edit by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet
// edit by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet
// Set MAC register value according operation mode
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_UPDATE_PROTECT, NULL, 0);
#endif
}

Expand Down
18 changes: 3 additions & 15 deletions drivers/staging/rt2860/common/eeprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,12 @@ USHORT ShiftInBits(
RaiseClock(pAd, &x);

RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
#ifdef RT30xx
LowerClock(pAd, &x); //prevent read failed
#endif

LowerClock(pAd, &x); /* prevent read failed */

x &= ~(EEDI);
if(x & EEDO)
data |= 1;

#ifndef RT30xx
LowerClock(pAd, &x);
#endif
}

return data;
Expand Down Expand Up @@ -201,17 +197,13 @@ USHORT RTMP_EEPROM_READ16(
x |= EECS;
RTMP_IO_WRITE32(pAd, E2PROM_CSR, x);

#ifdef RT30xx
// patch can not access e-Fuse issue
if (!IS_RT3090(pAd))
{
#endif
// kick a pulse
RaiseClock(pAd, &x);
LowerClock(pAd, &x);
#ifdef RT30xx
}
#endif

// output the read_opcode and register number in that order
ShiftOutBits(pAd, EEPROM_READ_OPCODE, 3);
Expand Down Expand Up @@ -262,17 +254,13 @@ VOID RTMP_EEPROM_WRITE16(
x |= EECS;
RTMP_IO_WRITE32(pAd, E2PROM_CSR, x);

#ifdef RT30xx
// patch can not access e-Fuse issue
if (!IS_RT3090(pAd))
{
#endif
// kick a pulse
RaiseClock(pAd, &x);
LowerClock(pAd, &x);
#ifdef RT30xx
}
#endif

// output the read_opcode ,register number and data in that order
ShiftOutBits(pAd, EEPROM_WRITE_OPCODE, 3);
Expand Down
65 changes: 12 additions & 53 deletions drivers/staging/rt2860/common/mlme.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,13 +449,7 @@ FREQUENCY_ITEM FreqItems3020[] =
{13, 247, 2, 2},
{14, 248, 2, 4},
};
#ifndef RT30xx
#define NUM_OF_3020_CHNL (sizeof(FreqItems3020) / sizeof(FREQUENCY_ITEM))
#endif
#ifdef RT30xx
//2008/07/10:KH Modified to share this variable
UCHAR NUM_OF_3020_CHNL=(sizeof(FreqItems3020) / sizeof(FREQUENCY_ITEM));
#endif

/*
==========================================================================
Expand Down Expand Up @@ -3949,14 +3943,12 @@ VOID BssTableSsidSort(
continue;

// check group cipher
if (
#ifndef RT30xx
if ((pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher) &&
(pInBss->WPA.GroupCipher != Ndis802_11GroupWEP40Enabled) &&
(pInBss->WPA.GroupCipher != Ndis802_11GroupWEP104Enabled))
#endif
#ifdef RT30xx
if (pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher)
pInBss->WPA.GroupCipher != Ndis802_11GroupWEP40Enabled &&
pInBss->WPA.GroupCipher != Ndis802_11GroupWEP104Enabled &&
#endif
pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher)
continue;

// check pairwise cipher, skip if none matched
Expand All @@ -3975,14 +3967,12 @@ VOID BssTableSsidSort(
continue;

// check group cipher
if (
#ifndef RT30xx
if ((pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher) &&
(pInBss->WPA2.GroupCipher != Ndis802_11GroupWEP40Enabled) &&
(pInBss->WPA2.GroupCipher != Ndis802_11GroupWEP104Enabled))
#endif
#ifdef RT30xx
if (pAd->StaCfg.WepStatus < pInBss->WPA2.GroupCipher)
pInBss->WPA2.GroupCipher != Ndis802_11GroupWEP40Enabled &&
pInBss->WPA2.GroupCipher != Ndis802_11GroupWEP104Enabled &&
#endif
pAd->StaCfg.WepStatus < pInBss->WPA2.GroupCipher)
continue;

// check pairwise cipher, skip if none matched
Expand Down Expand Up @@ -8229,7 +8219,6 @@ VOID AsicSetRxAnt(
IN PRTMP_ADAPTER pAd,
IN UCHAR Ant)
{
#ifdef RT30xx
UINT32 Value;
UINT32 x;

Expand Down Expand Up @@ -8268,7 +8257,6 @@ VOID AsicSetRxAnt(
RTMP_IO_WRITE32(pAd, GPIO_CTRL_CFG, Value);
DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to aux antenna\n"));
}
#endif // RT30xx //
}
#endif /* RT30xx */

Expand Down Expand Up @@ -8330,9 +8318,7 @@ VOID AsicEvaluateRxAnt(
fRTMP_ADAPTER_NIC_NOT_EXIST |
fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS) ||
OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)
#ifdef RT30xx
|| (pAd->EepromAccess)
#endif // RT30xx //
)
return;

Expand Down Expand Up @@ -8822,27 +8808,13 @@ VOID AsicStaBbpTuning(
{
R66 = 0x1C + 2*GET_LNA_GAIN(pAd) + 0x20;
if (OrigR66Value != R66)
{
#ifndef RT30xx
RTUSBWriteBBPRegister(pAd, BBP_R66, R66);
#endif
#ifdef RT30xx
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66);
#endif
}
}
else
{
R66 = 0x1C + 2*GET_LNA_GAIN(pAd);
if (OrigR66Value != R66)
{
#ifndef RT30xx
RTUSBWriteBBPRegister(pAd, BBP_R66, R66);
#endif
#ifdef RT30xx
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66);
#endif
}
}
}
else
Expand Down Expand Up @@ -9051,15 +9023,13 @@ VOID AsicTurnOffRFClk(
UCHAR index;
RTMP_RF_REGS *RFRegTable;

#ifdef RT30xx
// The RF programming sequence is difference between 3xxx and 2xxx
if (IS_RT3090(pAd))
{
RT30xxLoadRFSleepModeSetup(pAd); // add by johnli, RF power sequence setup, load RF sleep-mode setup
return;
}
else
{
#endif // RT30xx //

RFRegTable = RF2850RegTable;

switch (pAd->RfIcType)
Expand Down Expand Up @@ -9101,10 +9071,6 @@ VOID AsicTurnOffRFClk(
default:
break;
}
#ifdef RT30xx
}
#endif // RT30xx //

}


Expand All @@ -9118,14 +9084,10 @@ VOID AsicTurnOnRFClk(
UCHAR index;
RTMP_RF_REGS *RFRegTable;

#ifdef RT30xx
// The RF programming sequence is difference between 3xxx and 2xxx
if (IS_RT3090(pAd))
{
}
else
{
#endif // RT30xx //
return;

RFRegTable = RF2850RegTable;

switch (pAd->RfIcType)
Expand Down Expand Up @@ -9178,8 +9140,5 @@ VOID AsicTurnOnRFClk(
pAd->RfIcType,
R2));
#endif
#ifdef RT30xx
}
#endif // RT30xx //
}

6 changes: 1 addition & 5 deletions drivers/staging/rt2860/common/rtmp_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1675,7 +1675,6 @@ VOID NICReadEEPROMParameters(
Antenna.word = pAd->EEPROMDefaultValue[0];
if (Antenna.word == 0xFFFF)
{
#ifdef RT30xx
if(IS_RT3090(pAd))
{
Antenna.word = 0;
Expand All @@ -1685,15 +1684,12 @@ VOID NICReadEEPROMParameters(
}
else
{
#endif // RT30xx //
Antenna.word = 0;
Antenna.field.RfIcType = RFIC_2820;
Antenna.field.TxPath = 1;
Antenna.field.RxPath = 2;
DBGPRINT(RT_DEBUG_WARN, ("E2PROM error, hard code as 0x%04x\n", Antenna.word));
#ifdef RT30xx
}
#endif // RT30xx //
}

// Choose the desired Tx&Rx stream.
Expand Down Expand Up @@ -2445,7 +2441,6 @@ NDIS_STATUS NICInitializeAsic(
}
}

#ifdef RT30xx
// Initialize RT3070 serial MAc registers which is different from RT2870 serial
if (IS_RT3090(pAd))
{
Expand All @@ -2468,6 +2463,7 @@ NDIS_STATUS NICInitializeAsic(
RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x0);
}
}
#ifdef RT30xx
else if (IS_RT3070(pAd))
{
RTMP_IO_WRITE32(pAd, TX_SW_CFG1, 0);
Expand Down
8 changes: 1 addition & 7 deletions drivers/staging/rt2860/oid.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,10 +535,8 @@ typedef enum _NDIS_802_11_WEP_STATUS
Ndis802_11Encryption3KeyAbsent,
Ndis802_11Encryption4Enabled, // TKIP or AES mix
Ndis802_11Encryption4KeyAbsent,
#ifndef RT30xx
Ndis802_11GroupWEP40Enabled,
Ndis802_11GroupWEP104Enabled,
#endif
} NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;

Expand Down Expand Up @@ -626,17 +624,13 @@ typedef struct _NDIS_802_11_CAPABILITY
NDIS_802_11_AUTHENTICATION_ENCRYPTION AuthenticationEncryptionSupported[1];
} NDIS_802_11_CAPABILITY, *PNDIS_802_11_CAPABILITY;

#ifdef RT30xx
#define RT_PRIV_IOCTL_EXT (SIOCIWFIRSTPRIV + 0x01) // Sync. with AP for wsc upnp daemon
#endif
#define RTPRIV_IOCTL_SET (SIOCIWFIRSTPRIV + 0x02)

#ifdef DBG
#define RTPRIV_IOCTL_BBP (SIOCIWFIRSTPRIV + 0x03)
#define RTPRIV_IOCTL_MAC (SIOCIWFIRSTPRIV + 0x05)
#ifdef RT30xx
#define RTPRIV_IOCTL_RF (SIOCIWFIRSTPRIV + 0x13)
#endif
#define RTPRIV_IOCTL_E2P (SIOCIWFIRSTPRIV + 0x07)
#endif

Expand All @@ -660,7 +654,7 @@ enum {
RAIO_OFF = 10,
RAIO_ON = 11,
SHOW_CFG_VALUE = 20,
#if !defined(RT2860) && !defined(RT30xx)
#if !defined(RT2860)
SHOW_ADHOC_ENTRY_INFO = 21,
#endif
};
Expand Down
Loading

0 comments on commit 3784339

Please sign in to comment.