2015-11-22 09:08:08

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 1/8] staging: vt6655: channel.c replace pDevice with priv

Removing camel case.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/channel.c | 58 ++++++++++++++++++++--------------------
1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/vt6655/channel.c b/drivers/staging/vt6655/channel.c
index 7a71782..6edccb42 100644
--- a/drivers/staging/vt6655/channel.c
+++ b/drivers/staging/vt6655/channel.c
@@ -176,62 +176,62 @@ void vnt_init_bands(struct vnt_private *priv)
*/
bool set_channel(void *pDeviceHandler, struct ieee80211_channel *ch)
{
- struct vnt_private *pDevice = pDeviceHandler;
+ struct vnt_private *priv = pDeviceHandler;
bool bResult = true;

- if (pDevice->byCurrentCh == ch->hw_value)
+ if (priv->byCurrentCh == ch->hw_value)
return bResult;

/* Set VGA to max sensitivity */
- if (pDevice->bUpdateBBVGA &&
- pDevice->byBBVGACurrent != pDevice->abyBBVGA[0]) {
- pDevice->byBBVGACurrent = pDevice->abyBBVGA[0];
+ if (priv->bUpdateBBVGA &&
+ priv->byBBVGACurrent != priv->abyBBVGA[0]) {
+ priv->byBBVGACurrent = priv->abyBBVGA[0];

- BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent);
+ BBvSetVGAGainOffset(priv, priv->byBBVGACurrent);
}

/* clear NAV */
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MACCR, MACCR_CLRNAV);
+ MACvRegBitsOn(priv->PortOffset, MAC_REG_MACCR, MACCR_CLRNAV);

/* TX_PE will reserve 3 us for MAX2829 A mode only,
it is for better TX throughput */

- if (pDevice->byRFType == RF_AIROHA7230)
- RFbAL7230SelectChannelPostProcess(pDevice, pDevice->byCurrentCh,
+ if (priv->byRFType == RF_AIROHA7230)
+ RFbAL7230SelectChannelPostProcess(priv, priv->byCurrentCh,
ch->hw_value);

- pDevice->byCurrentCh = ch->hw_value;
- bResult &= RFbSelectChannel(pDevice, pDevice->byRFType,
+ priv->byCurrentCh = ch->hw_value;
+ bResult &= RFbSelectChannel(priv, priv->byRFType,
ch->hw_value);

/* Init Synthesizer Table */
- if (pDevice->bEnablePSMode)
- RFvWriteWakeProgSyn(pDevice, pDevice->byRFType, ch->hw_value);
+ if (priv->bEnablePSMode)
+ RFvWriteWakeProgSyn(priv, priv->byRFType, ch->hw_value);

- BBvSoftwareReset(pDevice);
+ BBvSoftwareReset(priv);

- if (pDevice->byLocalID > REV_ID_VT3253_B1) {
+ if (priv->byLocalID > REV_ID_VT3253_B1) {
unsigned long flags;

- spin_lock_irqsave(&pDevice->lock, flags);
+ spin_lock_irqsave(&priv->lock, flags);

/* set HW default power register */
- MACvSelectPage1(pDevice->PortOffset);
- RFbSetPower(pDevice, RATE_1M, pDevice->byCurrentCh);
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_PWRCCK,
- pDevice->byCurPwr);
- RFbSetPower(pDevice, RATE_6M, pDevice->byCurrentCh);
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_PWROFDM,
- pDevice->byCurPwr);
- MACvSelectPage0(pDevice->PortOffset);
-
- spin_unlock_irqrestore(&pDevice->lock, flags);
+ MACvSelectPage1(priv->PortOffset);
+ RFbSetPower(priv, RATE_1M, priv->byCurrentCh);
+ VNSvOutPortB(priv->PortOffset + MAC_REG_PWRCCK,
+ priv->byCurPwr);
+ RFbSetPower(priv, RATE_6M, priv->byCurrentCh);
+ VNSvOutPortB(priv->PortOffset + MAC_REG_PWROFDM,
+ priv->byCurPwr);
+ MACvSelectPage0(priv->PortOffset);
+
+ spin_unlock_irqrestore(&priv->lock, flags);
}

- if (pDevice->byBBType == BB_TYPE_11B)
- RFbSetPower(pDevice, RATE_1M, pDevice->byCurrentCh);
+ if (priv->byBBType == BB_TYPE_11B)
+ RFbSetPower(priv, RATE_1M, priv->byCurrentCh);
else
- RFbSetPower(pDevice, RATE_6M, pDevice->byCurrentCh);
+ RFbSetPower(priv, RATE_6M, priv->byCurrentCh);

return bResult;
}
--
2.6.2



2015-11-22 09:08:12

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 4/8] staging: vt6655: rf.c rename bResult ret.

Removing camel case and reflecting return value.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/rf.c | 138 ++++++++++++++++++++++----------------------
1 file changed, 69 insertions(+), 69 deletions(-)

diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c
index 4c22bb3..1c0691d 100644
--- a/drivers/staging/vt6655/rf.c
+++ b/drivers/staging/vt6655/rf.c
@@ -420,9 +420,9 @@ static bool s_bAL7230Init(struct vnt_private *priv)
{
void __iomem *dwIoBase = priv->PortOffset;
int ii;
- bool bResult;
+ bool ret;

- bResult = true;
+ ret = true;

/* 3-wire control for normal mode */
VNSvOutPortB(dwIoBase + MAC_REG_SOFTPWRCTL, 0);
@@ -432,7 +432,7 @@ static bool s_bAL7230Init(struct vnt_private *priv)
BBvPowerSaveModeOFF(priv); /* RobertYu:20050106, have DC value for Calibration */

for (ii = 0; ii < CB_AL7230_INIT_SEQ; ii++)
- bResult &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[ii]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[ii]);

/* PLL On */
MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);
@@ -440,13 +440,13 @@ static bool s_bAL7230Init(struct vnt_private *priv)
/* Calibration */
MACvTimer0MicroSDelay(dwIoBase, 150);/* 150us */
/* TXDCOC:active, RCK:disable */
- bResult &= IFRFbWriteEmbedded(priv, (0x9ABA8F00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW));
+ ret &= IFRFbWriteEmbedded(priv, (0x9ABA8F00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW));
MACvTimer0MicroSDelay(dwIoBase, 30);/* 30us */
/* TXDCOC:disable, RCK:active */
- bResult &= IFRFbWriteEmbedded(priv, (0x3ABA8F00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW));
+ ret &= IFRFbWriteEmbedded(priv, (0x3ABA8F00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW));
MACvTimer0MicroSDelay(dwIoBase, 30);/* 30us */
/* TXDCOC:disable, RCK:disable */
- bResult &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[CB_AL7230_INIT_SEQ-1]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[CB_AL7230_INIT_SEQ-1]);

MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE3 |
SOFTPWRCTL_SWPE2 |
@@ -459,7 +459,7 @@ static bool s_bAL7230Init(struct vnt_private *priv)
/* 3-wire control for power saving mode */
VNSvOutPortB(dwIoBase + MAC_REG_PSPWRSIG, (PSSIG_WPE3 | PSSIG_WPE2)); /* 1100 0000 */

- return bResult;
+ return ret;
}

/* Need to Pull PLLON low when writing channel registers through
@@ -467,16 +467,16 @@ static bool s_bAL7230Init(struct vnt_private *priv)
static bool s_bAL7230SelectChannel(struct vnt_private *priv, unsigned char byChannel)
{
void __iomem *dwIoBase = priv->PortOffset;
- bool bResult;
+ bool ret;

- bResult = true;
+ ret = true;

/* PLLON Off */
MACvWordRegBitsOff(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);

- bResult &= IFRFbWriteEmbedded(priv, dwAL7230ChannelTable0[byChannel - 1]);
- bResult &= IFRFbWriteEmbedded(priv, dwAL7230ChannelTable1[byChannel - 1]);
- bResult &= IFRFbWriteEmbedded(priv, dwAL7230ChannelTable2[byChannel - 1]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL7230ChannelTable0[byChannel - 1]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL7230ChannelTable1[byChannel - 1]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL7230ChannelTable2[byChannel - 1]);

/* PLLOn On */
MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);
@@ -487,7 +487,7 @@ static bool s_bAL7230SelectChannel(struct vnt_private *priv, unsigned char byCha
/* Set Channel[7] = 1 to tell H/W channel change is done. */
VNSvOutPortB(dwIoBase + MAC_REG_CHANNEL, (byChannel | 0x80));

- return bResult;
+ return ret;
}

/*
@@ -540,9 +540,9 @@ static bool RFbAL2230Init(struct vnt_private *priv)
{
void __iomem *dwIoBase = priv->PortOffset;
int ii;
- bool bResult;
+ bool ret;

- bResult = true;
+ ret = true;

/* 3-wire control for normal mode */
VNSvOutPortB(dwIoBase + MAC_REG_SOFTPWRCTL, 0);
@@ -556,18 +556,18 @@ static bool RFbAL2230Init(struct vnt_private *priv)
IFRFbWriteEmbedded(priv, (0x07168700+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW));

for (ii = 0; ii < CB_AL2230_INIT_SEQ; ii++)
- bResult &= IFRFbWriteEmbedded(priv, dwAL2230InitTable[ii]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL2230InitTable[ii]);
MACvTimer0MicroSDelay(dwIoBase, 30); /* delay 30 us */

/* PLL On */
MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);

MACvTimer0MicroSDelay(dwIoBase, 150);/* 150us */
- bResult &= IFRFbWriteEmbedded(priv, (0x00d80f00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW));
+ ret &= IFRFbWriteEmbedded(priv, (0x00d80f00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW));
MACvTimer0MicroSDelay(dwIoBase, 30);/* 30us */
- bResult &= IFRFbWriteEmbedded(priv, (0x00780f00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW));
+ ret &= IFRFbWriteEmbedded(priv, (0x00780f00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW));
MACvTimer0MicroSDelay(dwIoBase, 30);/* 30us */
- bResult &= IFRFbWriteEmbedded(priv, dwAL2230InitTable[CB_AL2230_INIT_SEQ-1]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL2230InitTable[CB_AL2230_INIT_SEQ-1]);

MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE3 |
SOFTPWRCTL_SWPE2 |
@@ -577,18 +577,18 @@ static bool RFbAL2230Init(struct vnt_private *priv)
/* 3-wire control for power saving mode */
VNSvOutPortB(dwIoBase + MAC_REG_PSPWRSIG, (PSSIG_WPE3 | PSSIG_WPE2)); /* 1100 0000 */

- return bResult;
+ return ret;
}

static bool RFbAL2230SelectChannel(struct vnt_private *priv, unsigned char byChannel)
{
void __iomem *dwIoBase = priv->PortOffset;
- bool bResult;
+ bool ret;

- bResult = true;
+ ret = true;

- bResult &= IFRFbWriteEmbedded(priv, dwAL2230ChannelTable0[byChannel - 1]);
- bResult &= IFRFbWriteEmbedded(priv, dwAL2230ChannelTable1[byChannel - 1]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL2230ChannelTable0[byChannel - 1]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL2230ChannelTable1[byChannel - 1]);

/* Set Channel[7] = 0 to tell H/W channel is changing now. */
VNSvOutPortB(dwIoBase + MAC_REG_CHANNEL, (byChannel & 0x7F));
@@ -596,7 +596,7 @@ static bool RFbAL2230SelectChannel(struct vnt_private *priv, unsigned char byCha
/* Set Channel[7] = 1 to tell H/W channel change is done. */
VNSvOutPortB(dwIoBase + MAC_REG_CHANNEL, (byChannel | 0x80));

- return bResult;
+ return ret;
}

/*
@@ -616,26 +616,26 @@ bool RFbInit(
struct vnt_private *priv
)
{
- bool bResult = true;
+ bool ret = true;

switch (priv->byRFType) {
case RF_AIROHA:
case RF_AL2230S:
priv->byMaxPwrLevel = AL2230_PWR_IDX_LEN;
- bResult = RFbAL2230Init(priv);
+ ret = RFbAL2230Init(priv);
break;
case RF_AIROHA7230:
priv->byMaxPwrLevel = AL7230_PWR_IDX_LEN;
- bResult = s_bAL7230Init(priv);
+ ret = s_bAL7230Init(priv);
break;
case RF_NOTHING:
- bResult = true;
+ ret = true;
break;
default:
- bResult = false;
+ ret = false;
break;
}
- return bResult;
+ return ret;
}

/*
@@ -654,26 +654,26 @@ bool RFbInit(
bool RFbSelectChannel(struct vnt_private *priv, unsigned char byRFType,
u16 byChannel)
{
- bool bResult = true;
+ bool ret = true;

switch (byRFType) {
case RF_AIROHA:
case RF_AL2230S:
- bResult = RFbAL2230SelectChannel(priv, byChannel);
+ ret = RFbAL2230SelectChannel(priv, byChannel);
break;
/*{{ RobertYu: 20050104 */
case RF_AIROHA7230:
- bResult = s_bAL7230SelectChannel(priv, byChannel);
+ ret = s_bAL7230SelectChannel(priv, byChannel);
break;
/*}} RobertYu */
case RF_NOTHING:
- bResult = true;
+ ret = true;
break;
default:
- bResult = false;
+ ret = false;
break;
}
- return bResult;
+ return ret;
}

/*
@@ -772,7 +772,7 @@ bool RFbSetPower(
u16 uCH
)
{
- bool bResult = true;
+ bool ret = true;
unsigned char byPwr = 0;
unsigned char byDec = 0;

@@ -818,11 +818,11 @@ bool RFbSetPower(
if (priv->byCurPwr == byPwr)
return true;

- bResult = RFbRawSetPower(priv, byPwr, rate);
- if (bResult)
+ ret = RFbRawSetPower(priv, byPwr, rate);
+ if (ret)
priv->byCurPwr = byPwr;

- return bResult;
+ return ret;
}

/*
@@ -845,7 +845,7 @@ bool RFbRawSetPower(
unsigned int rate
)
{
- bool bResult = true;
+ bool ret = true;
unsigned long dwMax7230Pwr = 0;

if (byPwr >= priv->byMaxPwrLevel)
@@ -853,22 +853,22 @@ bool RFbRawSetPower(

switch (priv->byRFType) {
case RF_AIROHA:
- bResult &= IFRFbWriteEmbedded(priv, dwAL2230PowerTable[byPwr]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL2230PowerTable[byPwr]);
if (rate <= RATE_11M)
- bResult &= IFRFbWriteEmbedded(priv, 0x0001B400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
+ ret &= IFRFbWriteEmbedded(priv, 0x0001B400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
else
- bResult &= IFRFbWriteEmbedded(priv, 0x0005A400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
+ ret &= IFRFbWriteEmbedded(priv, 0x0005A400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);

break;

case RF_AL2230S:
- bResult &= IFRFbWriteEmbedded(priv, dwAL2230PowerTable[byPwr]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL2230PowerTable[byPwr]);
if (rate <= RATE_11M) {
- bResult &= IFRFbWriteEmbedded(priv, 0x040C1400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
- bResult &= IFRFbWriteEmbedded(priv, 0x00299B00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
+ ret &= IFRFbWriteEmbedded(priv, 0x040C1400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
+ ret &= IFRFbWriteEmbedded(priv, 0x00299B00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
} else {
- bResult &= IFRFbWriteEmbedded(priv, 0x0005A400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
- bResult &= IFRFbWriteEmbedded(priv, 0x00099B00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
+ ret &= IFRFbWriteEmbedded(priv, 0x0005A400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
+ ret &= IFRFbWriteEmbedded(priv, 0x00099B00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
}

break;
@@ -879,13 +879,13 @@ bool RFbRawSetPower(
dwMax7230Pwr = 0x080C0B00 | ((byPwr) << 12) |
(BY_AL7230_REG_LEN << 3) | IFREGCTL_REGW;

- bResult &= IFRFbWriteEmbedded(priv, dwMax7230Pwr);
+ ret &= IFRFbWriteEmbedded(priv, dwMax7230Pwr);
break;

default:
break;
}
- return bResult;
+ return ret;
}

/*+
@@ -934,32 +934,32 @@ bool RFbAL7230SelectChannelPostProcess(struct vnt_private *priv,
u16 byOldChannel,
u16 byNewChannel)
{
- bool bResult;
+ bool ret;

- bResult = true;
+ ret = true;

/* if change between 11 b/g and 11a need to update the following
* register
* Channel Index 1~14 */
if ((byOldChannel <= CB_MAX_CHANNEL_24G) && (byNewChannel > CB_MAX_CHANNEL_24G)) {
/* Change from 2.4G to 5G [Reg] */
- bResult &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[2]);
- bResult &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[3]);
- bResult &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[5]);
- bResult &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[7]);
- bResult &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[10]);
- bResult &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[12]);
- bResult &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[15]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[2]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[3]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[5]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[7]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[10]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[12]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[15]);
} else if ((byOldChannel > CB_MAX_CHANNEL_24G) && (byNewChannel <= CB_MAX_CHANNEL_24G)) {
/* Change from 5G to 2.4G [Reg] */
- bResult &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[2]);
- bResult &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[3]);
- bResult &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[5]);
- bResult &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[7]);
- bResult &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[10]);
- bResult &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[12]);
- bResult &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[15]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[2]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[3]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[5]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[7]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[10]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[12]);
+ ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[15]);
}

- return bResult;
+ return ret;
}
--
2.6.2


2015-11-22 09:08:13

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 6/8] staging: vt6655: rf.c/h Replace DeviceContext with vnt_private

Removing void and including device.h for power.h

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/power.c | 10 +++-------
drivers/staging/vt6655/power.h | 8 +++++---
2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/vt6655/power.c b/drivers/staging/vt6655/power.c
index e58afbd..ad44746 100644
--- a/drivers/staging/vt6655/power.c
+++ b/drivers/staging/vt6655/power.c
@@ -64,11 +64,10 @@

void
PSvEnablePowerSaving(
- void *hDeviceContext,
+ struct vnt_private *priv,
unsigned short wListenInterval
)
{
- struct vnt_private *priv = hDeviceContext;
u16 wAID = priv->current_aid | BIT(14) | BIT(15);

/* set period of power up before TBTT */
@@ -117,11 +116,9 @@ PSvEnablePowerSaving(

void
PSvDisablePowerSaving(
- void *hDeviceContext
+ struct vnt_private *priv
)
{
- struct vnt_private *priv = hDeviceContext;
-
/* disable power saving hw function */
MACbPSWakeup(priv->PortOffset);
/* clear AutoSleep */
@@ -149,10 +146,9 @@ PSvDisablePowerSaving(

bool
PSbIsNextTBTTWakeUp(
- void *hDeviceContext
+ struct vnt_private *priv
)
{
- struct vnt_private *priv = hDeviceContext;
struct ieee80211_hw *hw = priv->hw;
struct ieee80211_conf *conf = &hw->conf;
bool bWakeUp = false;
diff --git a/drivers/staging/vt6655/power.h b/drivers/staging/vt6655/power.h
index 538e685..d82dd8d 100644
--- a/drivers/staging/vt6655/power.h
+++ b/drivers/staging/vt6655/power.h
@@ -29,25 +29,27 @@
#ifndef __POWER_H__
#define __POWER_H__

+#include "device.h"
+
#define C_PWBT 1000 /* micro sec. power up before TBTT */
#define PS_FAST_INTERVAL 1 /* Fast power saving listen interval */
#define PS_MAX_INTERVAL 4 /* MAX power saving listen interval */

void
PSvDisablePowerSaving(
- void *hDeviceContext
+ struct vnt_private *
);

void
PSvEnablePowerSaving(
- void *hDeviceContext,
+ struct vnt_private *,
unsigned short wListenInterval
);


bool
PSbIsNextTBTTWakeUp(
- void *hDeviceContext
+ struct vnt_private *
);

#endif /* __POWER_H__ */
--
2.6.2


2015-11-23 00:31:42

by Julian Calaby

[permalink] [raw]
Subject: Re: [PATCH 3/8] staging: vt6655: set_channel replace bResult with ret

Hi Malcolm,

On Sun, Nov 22, 2015 at 8:07 PM, Malcolm Priestley <[email protected]> wrote:
> Removing camel case.
>
> Signed-off-by: Malcolm Priestley <[email protected]>
> ---
> drivers/staging/vt6655/channel.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/vt6655/channel.c b/drivers/staging/vt6655/channel.c
> index d1c9116..9ac1ef9 100644
> --- a/drivers/staging/vt6655/channel.c
> +++ b/drivers/staging/vt6655/channel.c
> @@ -176,10 +176,10 @@ void vnt_init_bands(struct vnt_private *priv)
> */
> bool set_channel(struct vnt_private *priv, struct ieee80211_channel *ch)
> {
> - bool bResult = true;
> + bool ret = true;
>
> if (priv->byCurrentCh == ch->hw_value)
> - return bResult;
> + return ret;

ret is always true here, right?

>
> /* Set VGA to max sensitivity */
> if (priv->bUpdateBBVGA &&
> @@ -200,8 +200,8 @@ bool set_channel(struct vnt_private *priv, struct ieee80211_channel *ch)
> ch->hw_value);
>
> priv->byCurrentCh = ch->hw_value;
> - bResult &= RFbSelectChannel(priv, priv->byRFType,
> - ch->hw_value);
> + ret &= RFbSelectChannel(priv, priv->byRFType,
> + ch->hw_value);

Isn't a &= b equivalent to a = a & b which is inappropriate for
boolean variables?

Also, wouldn't ret be true here, so the & is unnecessary?

Thanks,

--
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/

2015-11-22 09:08:16

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 8/8] staging: vt6655: mac.c replace void __iomem * with struct vnt_private

Moving void __iomem down one level in the following functions
MACbIsRegBitsOn
MACbIsRegBitsOff
MACbIsIntDisable
MACvSetShortRetryLimit
MACvSetLongRetryLimit
MACvGetLongRetryLimit
MACvSetLoopbackMode
MACvSaveContext
MACvRestoreContext
MACbSoftwareReset
MACbSafeSoftwareReset
MACbSafeRxOff
MACbSafeTxOff
MACbSafeStop
MACbShutdown
MACvInitialize
MACvSetCurrRx0DescAddr
MACvSetCurrRx1DescAddr
MACvSetCurrTXDescAddr
MACvSetCurrTx0DescAddrEx
MACvSetCurrAC0DescAddrEx
MACvSetCurrSyncDescAddrEx
MACvSetCurrATIMDescAddrEx
MACvTimer0MicroSDelay
MACvOneShotTimer1MicroSec
MACvSetMISCFifo
MACbPSWakeup
MACvSetKeyEntry
MACvDisableKeyEntry

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/card.c | 18 ++----
drivers/staging/vt6655/device_main.c | 24 ++++----
drivers/staging/vt6655/key.c | 8 +--
drivers/staging/vt6655/mac.c | 108 ++++++++++++++++++++++-------------
drivers/staging/vt6655/mac.h | 58 +++++++++----------
drivers/staging/vt6655/power.c | 2 +-
drivers/staging/vt6655/rf.c | 36 ++++++------
7 files changed, 137 insertions(+), 117 deletions(-)

diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index b6730a8..6c1b973 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -535,11 +535,9 @@ CARDvSafeResetTx(
}

/* set MAC TD pointer */
- MACvSetCurrTXDescAddr(TYPE_TXDMA0, priv->PortOffset,
- (priv->td0_pool_dma));
+ MACvSetCurrTXDescAddr(TYPE_TXDMA0, priv, priv->td0_pool_dma);

- MACvSetCurrTXDescAddr(TYPE_AC0DMA, priv->PortOffset,
- (priv->td1_pool_dma));
+ MACvSetCurrTXDescAddr(TYPE_AC0DMA, priv, priv->td1_pool_dma);

/* set MAC Beacon TX pointer */
MACvSetCurrBCNTxDescAddr(priv->PortOffset,
@@ -590,11 +588,9 @@ CARDvSafeResetRx(
MACvRx0PerPktMode(priv->PortOffset);
MACvRx1PerPktMode(priv->PortOffset);
/* set MAC RD pointer */
- MACvSetCurrRx0DescAddr(priv->PortOffset,
- priv->rd0_pool_dma);
+ MACvSetCurrRx0DescAddr(priv, priv->rd0_pool_dma);

- MACvSetCurrRx1DescAddr(priv->PortOffset,
- priv->rd1_pool_dma);
+ MACvSetCurrRx1DescAddr(priv, priv->rd1_pool_dma);
}

/*
@@ -839,8 +835,6 @@ unsigned char CARDbyGetPktType(struct vnt_private *priv)
*/
void CARDvSetLoopbackMode(struct vnt_private *priv, unsigned short wLoopbackMode)
{
- void __iomem *dwIoBase = priv->PortOffset;
-
switch (wLoopbackMode) {
case CARD_LB_NONE:
case CARD_LB_MAC:
@@ -850,7 +844,7 @@ void CARDvSetLoopbackMode(struct vnt_private *priv, unsigned short wLoopbackMode
break;
}
/* set MAC loopback */
- MACvSetLoopbackMode(dwIoBase, LOBYTE(wLoopbackMode));
+ MACvSetLoopbackMode(priv, LOBYTE(wLoopbackMode));
/* set Baseband loopback */
}

@@ -869,7 +863,7 @@ bool CARDbSoftwareReset(struct vnt_private *priv)
{

/* reset MAC */
- if (!MACbSafeSoftwareReset(priv->PortOffset))
+ if (!MACbSafeSoftwareReset(priv))
return false;

return true;
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index fefbf82..ad0fb84 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -211,11 +211,11 @@ static void device_init_registers(struct vnt_private *priv)
unsigned char byCCKPwrdBm = 0;
unsigned char byOFDMPwrdBm = 0;

- MACbShutdown(priv->PortOffset);
+ MACbShutdown(priv);
BBvSoftwareReset(priv);

/* Do MACbSoftwareReset in MACvInitialize */
- MACbSoftwareReset(priv->PortOffset);
+ MACbSoftwareReset(priv);

priv->bAES = false;

@@ -229,7 +229,7 @@ static void device_init_registers(struct vnt_private *priv)
priv->byTopCCKBasicRate = RATE_1M;

/* init MAC */
- MACvInitialize(priv->PortOffset);
+ MACvInitialize(priv);

/* Get Local ID */
VNSvInPortB(priv->PortOffset + MAC_REG_LOCALID, &priv->byLocalID);
@@ -357,8 +357,8 @@ static void device_init_registers(struct vnt_private *priv)
MAC_REG_CFG, (CFG_TKIPOPT | CFG_NOTXTIMEOUT));

/* set performance parameter by registry */
- MACvSetShortRetryLimit(priv->PortOffset, priv->byShortRetryLimit);
- MACvSetLongRetryLimit(priv->PortOffset, priv->byLongRetryLimit);
+ MACvSetShortRetryLimit(priv, priv->byShortRetryLimit);
+ MACvSetLongRetryLimit(priv, priv->byLongRetryLimit);

/* reset TSF counter */
VNSvOutPortB(priv->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST);
@@ -884,7 +884,7 @@ static void device_error(struct vnt_private *priv, unsigned short status)
if (status & ISR_FETALERR) {
dev_err(&priv->pcid->dev, "Hardware fatal error\n");

- MACbShutdown(priv->PortOffset);
+ MACbShutdown(priv);
return;
}
}
@@ -1012,7 +1012,7 @@ static void vnt_interrupt_process(struct vnt_private *priv)
if ((priv->op_mode == NL80211_IFTYPE_AP ||
priv->op_mode == NL80211_IFTYPE_ADHOC) &&
priv->vif->bss_conf.enable_beacon) {
- MACvOneShotTimer1MicroSec(priv->PortOffset,
+ MACvOneShotTimer1MicroSec(priv,
(priv->vif->bss_conf.beacon_int - MAKE_BEACON_RESERVED) << 10);
}

@@ -1197,8 +1197,8 @@ static void vnt_stop(struct ieee80211_hw *hw)

cancel_work_sync(&priv->interrupt_work);

- MACbShutdown(priv->PortOffset);
- MACbSoftwareReset(priv->PortOffset);
+ MACbShutdown(priv);
+ MACbSoftwareReset(priv);
CARDbRadioPowerOff(priv);

device_free_td0_ring(priv);
@@ -1636,13 +1636,13 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent)
INIT_WORK(&priv->interrupt_work, vnt_interrupt_work);

/* do reset */
- if (!MACbSoftwareReset(priv->PortOffset)) {
+ if (!MACbSoftwareReset(priv)) {
dev_err(&pcid->dev, ": Failed to access MAC hardware..\n");
device_free_info(priv);
return -ENODEV;
}
/* initial to reload eeprom */
- MACvInitialize(priv->PortOffset);
+ MACvInitialize(priv);
MACvReadEtherAddress(priv->PortOffset, priv->abyCurrentNetAddr);

/* Get RFType */
@@ -1690,7 +1690,7 @@ static int vt6655_suspend(struct pci_dev *pcid, pm_message_t state)

pci_save_state(pcid);

- MACbShutdown(priv->PortOffset);
+ MACbShutdown(priv);

pci_disable_device(pcid);
pci_set_power_state(pcid, pci_choose_state(pcid, state));
diff --git a/drivers/staging/vt6655/key.c b/drivers/staging/vt6655/key.c
index f2b3fea..ffcaf25 100644
--- a/drivers/staging/vt6655/key.c
+++ b/drivers/staging/vt6655/key.c
@@ -36,7 +36,7 @@ int vnt_key_init_table(struct vnt_private *priv)
u32 i;

for (i = 0; i < MAX_KEY_TABLE; i++)
- MACvDisableKeyEntry(priv->PortOffset, i);
+ MACvDisableKeyEntry(priv, i);

return 0;
}
@@ -104,7 +104,7 @@ static int vnt_set_keymode(struct ieee80211_hw *hw, u8 *mac_addr,
key->key[15] |= 0x80;
}

- MACvSetKeyEntry(priv->PortOffset, key_mode, entry, key_inx,
+ MACvSetKeyEntry(priv, key_mode, entry, key_inx,
bssid, (u32 *)key->key, priv->byLocalID);

return 0;
@@ -126,13 +126,13 @@ int vnt_set_keys(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
switch (key->cipher) {
case 0:
for (u = 0 ; u < MAX_KEY_TABLE; u++)
- MACvDisableKeyEntry(priv->PortOffset, u);
+ MACvDisableKeyEntry(priv, u);
return ret;

case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
for (u = 0; u < MAX_KEY_TABLE; u++)
- MACvDisableKeyEntry(priv->PortOffset, u);
+ MACvDisableKeyEntry(priv, u);

vnt_set_keymode(hw, mac_addr,
key, VNT_KEY_DEFAULTKEY, KEY_CTL_WEP, true);
diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c
index 688c3be..e74782a 100644
--- a/drivers/staging/vt6655/mac.c
+++ b/drivers/staging/vt6655/mac.c
@@ -70,9 +70,10 @@
* Return Value: true if all test bits On; otherwise false
*
*/
-bool MACbIsRegBitsOn(void __iomem *dwIoBase, unsigned char byRegOfs,
+bool MACbIsRegBitsOn(struct vnt_private *priv, unsigned char byRegOfs,
unsigned char byTestBits)
{
+ void __iomem *dwIoBase = priv->PortOffset;
unsigned char byData;

VNSvInPortB(dwIoBase + byRegOfs, &byData);
@@ -94,9 +95,10 @@ bool MACbIsRegBitsOn(void __iomem *dwIoBase, unsigned char byRegOfs,
* Return Value: true if all test bits Off; otherwise false
*
*/
-bool MACbIsRegBitsOff(void __iomem *dwIoBase, unsigned char byRegOfs,
+bool MACbIsRegBitsOff(struct vnt_private *priv, unsigned char byRegOfs,
unsigned char byTestBits)
{
+ void __iomem *dwIoBase = priv->PortOffset;
unsigned char byData;

VNSvInPortB(dwIoBase + byRegOfs, &byData);
@@ -116,8 +118,9 @@ bool MACbIsRegBitsOff(void __iomem *dwIoBase, unsigned char byRegOfs,
* Return Value: true if interrupt is disable; otherwise false
*
*/
-bool MACbIsIntDisable(void __iomem *dwIoBase)
+bool MACbIsIntDisable(struct vnt_private *priv)
{
+ void __iomem *dwIoBase = priv->PortOffset;
unsigned long dwData;

VNSvInPortD(dwIoBase + MAC_REG_IMR, &dwData);
@@ -141,8 +144,9 @@ bool MACbIsIntDisable(void __iomem *dwIoBase)
* Return Value: none
*
*/
-void MACvSetShortRetryLimit(void __iomem *dwIoBase, unsigned char byRetryLimit)
+void MACvSetShortRetryLimit(struct vnt_private *priv, unsigned char byRetryLimit)
{
+ void __iomem *dwIoBase = priv->PortOffset;
/* set SRT */
VNSvOutPortB(dwIoBase + MAC_REG_SRT, byRetryLimit);
}
@@ -162,8 +166,9 @@ void MACvSetShortRetryLimit(void __iomem *dwIoBase, unsigned char byRetryLimit)
* Return Value: none
*
*/
-void MACvSetLongRetryLimit(void __iomem *dwIoBase, unsigned char byRetryLimit)
+void MACvSetLongRetryLimit(struct vnt_private *priv, unsigned char byRetryLimit)
{
+ void __iomem *dwIoBase = priv->PortOffset;
/* set LRT */
VNSvOutPortB(dwIoBase + MAC_REG_LRT, byRetryLimit);
}
@@ -182,8 +187,9 @@ void MACvSetLongRetryLimit(void __iomem *dwIoBase, unsigned char byRetryLimit)
* Return Value: none
*
*/
-void MACvSetLoopbackMode(void __iomem *dwIoBase, unsigned char byLoopbackMode)
+void MACvSetLoopbackMode(struct vnt_private *priv, unsigned char byLoopbackMode)
{
+ void __iomem *dwIoBase = priv->PortOffset;
unsigned char byOrgValue;

byLoopbackMode <<= 6;
@@ -207,8 +213,9 @@ void MACvSetLoopbackMode(void __iomem *dwIoBase, unsigned char byLoopbackMode)
* Return Value: none
*
*/
-void MACvSaveContext(void __iomem *dwIoBase, unsigned char *pbyCxtBuf)
+void MACvSaveContext(struct vnt_private *priv, unsigned char *pbyCxtBuf)
{
+ void __iomem *dwIoBase = priv->PortOffset;
int ii;

/* read page0 register */
@@ -239,8 +246,9 @@ void MACvSaveContext(void __iomem *dwIoBase, unsigned char *pbyCxtBuf)
* Return Value: none
*
*/
-void MACvRestoreContext(void __iomem *dwIoBase, unsigned char *pbyCxtBuf)
+void MACvRestoreContext(struct vnt_private *priv, unsigned char *pbyCxtBuf)
{
+ void __iomem *dwIoBase = priv->PortOffset;
int ii;

MACvSelectPage1(dwIoBase);
@@ -293,8 +301,9 @@ void MACvRestoreContext(void __iomem *dwIoBase, unsigned char *pbyCxtBuf)
* Return Value: true if Reset Success; otherwise false
*
*/
-bool MACbSoftwareReset(void __iomem *dwIoBase)
+bool MACbSoftwareReset(struct vnt_private *priv)
{
+ void __iomem *dwIoBase = priv->PortOffset;
unsigned char byData;
unsigned short ww;

@@ -324,7 +333,7 @@ bool MACbSoftwareReset(void __iomem *dwIoBase)
* Return Value: true if success; otherwise false
*
*/
-bool MACbSafeSoftwareReset(void __iomem *dwIoBase)
+bool MACbSafeSoftwareReset(struct vnt_private *priv)
{
unsigned char abyTmpRegData[MAC_MAX_CONTEXT_SIZE_PAGE0+MAC_MAX_CONTEXT_SIZE_PAGE1];
bool bRetVal;
@@ -334,11 +343,11 @@ bool MACbSafeSoftwareReset(void __iomem *dwIoBase)
* reset, then restore register's value
*/
/* save MAC context */
- MACvSaveContext(dwIoBase, abyTmpRegData);
+ MACvSaveContext(priv, abyTmpRegData);
/* do reset */
- bRetVal = MACbSoftwareReset(dwIoBase);
+ bRetVal = MACbSoftwareReset(priv);
/* restore MAC context, except CR0 */
- MACvRestoreContext(dwIoBase, abyTmpRegData);
+ MACvRestoreContext(priv, abyTmpRegData);

return bRetVal;
}
@@ -356,8 +365,9 @@ bool MACbSafeSoftwareReset(void __iomem *dwIoBase)
* Return Value: true if success; otherwise false
*
*/
-bool MACbSafeRxOff(void __iomem *dwIoBase)
+bool MACbSafeRxOff(struct vnt_private *priv)
{
+ void __iomem *dwIoBase = priv->PortOffset;
unsigned short ww;
unsigned long dwData;
unsigned char byData;
@@ -414,8 +424,9 @@ bool MACbSafeRxOff(void __iomem *dwIoBase)
* Return Value: true if success; otherwise false
*
*/
-bool MACbSafeTxOff(void __iomem *dwIoBase)
+bool MACbSafeTxOff(struct vnt_private *priv)
{
+ void __iomem *dwIoBase = priv->PortOffset;
unsigned short ww;
unsigned long dwData;
unsigned char byData;
@@ -474,18 +485,19 @@ bool MACbSafeTxOff(void __iomem *dwIoBase)
* Return Value: true if success; otherwise false
*
*/
-bool MACbSafeStop(void __iomem *dwIoBase)
+bool MACbSafeStop(struct vnt_private *priv)
{
+ void __iomem *dwIoBase = priv->PortOffset;
MACvRegBitsOff(dwIoBase, MAC_REG_TCR, TCR_AUTOBCNTX);

- if (!MACbSafeRxOff(dwIoBase)) {
+ if (!MACbSafeRxOff(priv)) {
pr_debug(" MACbSafeRxOff == false)\n");
- MACbSafeSoftwareReset(dwIoBase);
+ MACbSafeSoftwareReset(priv);
return false;
}
- if (!MACbSafeTxOff(dwIoBase)) {
+ if (!MACbSafeTxOff(priv)) {
pr_debug(" MACbSafeTxOff == false)\n");
- MACbSafeSoftwareReset(dwIoBase);
+ MACbSafeSoftwareReset(priv);
return false;
}

@@ -507,17 +519,18 @@ bool MACbSafeStop(void __iomem *dwIoBase)
* Return Value: true if success; otherwise false
*
*/
-bool MACbShutdown(void __iomem *dwIoBase)
+bool MACbShutdown(struct vnt_private *priv)
{
+ void __iomem *dwIoBase = priv->PortOffset;
/* disable MAC IMR */
MACvIntDisable(dwIoBase);
- MACvSetLoopbackMode(dwIoBase, MAC_LB_INTERNAL);
+ MACvSetLoopbackMode(priv, MAC_LB_INTERNAL);
/* stop the adapter */
- if (!MACbSafeStop(dwIoBase)) {
- MACvSetLoopbackMode(dwIoBase, MAC_LB_NONE);
+ if (!MACbSafeStop(priv)) {
+ MACvSetLoopbackMode(priv, MAC_LB_NONE);
return false;
}
- MACvSetLoopbackMode(dwIoBase, MAC_LB_NONE);
+ MACvSetLoopbackMode(priv, MAC_LB_NONE);
return true;
}

@@ -534,8 +547,9 @@ bool MACbShutdown(void __iomem *dwIoBase)
* Return Value: none
*
*/
-void MACvInitialize(void __iomem *dwIoBase)
+void MACvInitialize(struct vnt_private *priv)
{
+ void __iomem *dwIoBase = priv->PortOffset;
/* clear sticky bits */
MACvClearStckDS(dwIoBase);
/* disable force PME-enable */
@@ -543,7 +557,7 @@ void MACvInitialize(void __iomem *dwIoBase)
/* only 3253 A */

/* do reset */
- MACbSoftwareReset(dwIoBase);
+ MACbSoftwareReset(priv);

/* reset TSF counter */
VNSvOutPortB(dwIoBase + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST);
@@ -565,8 +579,9 @@ void MACvInitialize(void __iomem *dwIoBase)
* Return Value: none
*
*/
-void MACvSetCurrRx0DescAddr(void __iomem *dwIoBase, unsigned long dwCurrDescAddr)
+void MACvSetCurrRx0DescAddr(struct vnt_private *priv, unsigned long dwCurrDescAddr)
{
+ void __iomem *dwIoBase = priv->PortOffset;
unsigned short ww;
unsigned char byData;
unsigned char byOrgDMACtl;
@@ -600,8 +615,9 @@ void MACvSetCurrRx0DescAddr(void __iomem *dwIoBase, unsigned long dwCurrDescAddr
* Return Value: none
*
*/
-void MACvSetCurrRx1DescAddr(void __iomem *dwIoBase, unsigned long dwCurrDescAddr)
+void MACvSetCurrRx1DescAddr(struct vnt_private *priv, unsigned long dwCurrDescAddr)
{
+ void __iomem *dwIoBase = priv->PortOffset;
unsigned short ww;
unsigned char byData;
unsigned char byOrgDMACtl;
@@ -636,9 +652,10 @@ void MACvSetCurrRx1DescAddr(void __iomem *dwIoBase, unsigned long dwCurrDescAddr
* Return Value: none
*
*/
-void MACvSetCurrTx0DescAddrEx(void __iomem *dwIoBase,
+void MACvSetCurrTx0DescAddrEx(struct vnt_private *priv,
unsigned long dwCurrDescAddr)
{
+ void __iomem *dwIoBase = priv->PortOffset;
unsigned short ww;
unsigned char byData;
unsigned char byOrgDMACtl;
@@ -673,9 +690,10 @@ void MACvSetCurrTx0DescAddrEx(void __iomem *dwIoBase,
*
*/
/* TxDMA1 = AC0DMA */
-void MACvSetCurrAC0DescAddrEx(void __iomem *dwIoBase,
+void MACvSetCurrAC0DescAddrEx(struct vnt_private *priv,
unsigned long dwCurrDescAddr)
{
+ void __iomem *dwIoBase = priv->PortOffset;
unsigned short ww;
unsigned char byData;
unsigned char byOrgDMACtl;
@@ -696,13 +714,13 @@ void MACvSetCurrAC0DescAddrEx(void __iomem *dwIoBase,
VNSvOutPortB(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_RUN);
}

-void MACvSetCurrTXDescAddr(int iTxType, void __iomem *dwIoBase,
+void MACvSetCurrTXDescAddr(int iTxType, struct vnt_private *priv,
unsigned long dwCurrDescAddr)
{
if (iTxType == TYPE_AC0DMA)
- MACvSetCurrAC0DescAddrEx(dwIoBase, dwCurrDescAddr);
+ MACvSetCurrAC0DescAddrEx(priv, dwCurrDescAddr);
else if (iTxType == TYPE_TXDMA0)
- MACvSetCurrTx0DescAddrEx(dwIoBase, dwCurrDescAddr);
+ MACvSetCurrTx0DescAddrEx(priv, dwCurrDescAddr);
}

/*
@@ -719,8 +737,9 @@ void MACvSetCurrTXDescAddr(int iTxType, void __iomem *dwIoBase,
* Return Value: none
*
*/
-void MACvTimer0MicroSDelay(void __iomem *dwIoBase, unsigned int uDelay)
+void MACvTimer0MicroSDelay(struct vnt_private *priv, unsigned int uDelay)
{
+ void __iomem *dwIoBase = priv->PortOffset;
unsigned char byValue;
unsigned int uu, ii;

@@ -754,16 +773,20 @@ void MACvTimer0MicroSDelay(void __iomem *dwIoBase, unsigned int uDelay)
* Return Value: none
*
*/
-void MACvOneShotTimer1MicroSec(void __iomem *dwIoBase, unsigned int uDelayTime)
+void MACvOneShotTimer1MicroSec(struct vnt_private *priv, unsigned int uDelayTime)
{
+ void __iomem *dwIoBase = priv->PortOffset;
+
VNSvOutPortB(dwIoBase + MAC_REG_TMCTL1, 0);
VNSvOutPortD(dwIoBase + MAC_REG_TMDATA1, uDelayTime);
VNSvOutPortB(dwIoBase + MAC_REG_TMCTL1, (TMCTL_TMD | TMCTL_TE));
}

-void MACvSetMISCFifo(void __iomem *dwIoBase, unsigned short wOffset,
+void MACvSetMISCFifo(struct vnt_private *priv, unsigned short wOffset,
unsigned long dwData)
{
+ void __iomem *dwIoBase = priv->PortOffset;
+
if (wOffset > 273)
return;
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
@@ -771,12 +794,13 @@ void MACvSetMISCFifo(void __iomem *dwIoBase, unsigned short wOffset,
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
}

-bool MACbPSWakeup(void __iomem *dwIoBase)
+bool MACbPSWakeup(struct vnt_private *priv)
{
+ void __iomem *dwIoBase = priv->PortOffset;
unsigned char byOrgValue;
unsigned int ww;
/* Read PSCTL */
- if (MACbIsRegBitsOff(dwIoBase, MAC_REG_PSCTL, PSCTL_PS))
+ if (MACbIsRegBitsOff(priv, MAC_REG_PSCTL, PSCTL_PS))
return true;

/* Disable PS */
@@ -810,11 +834,12 @@ bool MACbPSWakeup(void __iomem *dwIoBase)
*
*/

-void MACvSetKeyEntry(void __iomem *dwIoBase, unsigned short wKeyCtl,
+void MACvSetKeyEntry(struct vnt_private *priv, unsigned short wKeyCtl,
unsigned int uEntryIdx, unsigned int uKeyIdx,
unsigned char *pbyAddr, u32 *pdwKey,
unsigned char byLocalID)
{
+ void __iomem *dwIoBase = priv->PortOffset;
unsigned short wOffset;
u32 dwData;
int ii;
@@ -878,8 +903,9 @@ void MACvSetKeyEntry(void __iomem *dwIoBase, unsigned short wKeyCtl,
* Return Value: none
*
*/
-void MACvDisableKeyEntry(void __iomem *dwIoBase, unsigned int uEntryIdx)
+void MACvDisableKeyEntry(struct vnt_private *priv, unsigned int uEntryIdx)
{
+ void __iomem *dwIoBase = priv->PortOffset;
unsigned short wOffset;

wOffset = MISCFIFO_KEYETRY0;
diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h
index 8e0200a..192f466 100644
--- a/drivers/staging/vt6655/mac.h
+++ b/drivers/staging/vt6655/mac.h
@@ -890,57 +890,57 @@ do { \
#define MACvSetRFLE_LatchBase(dwIoBase) \
MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_RFLEOPT)

-bool MACbIsRegBitsOn(void __iomem *dwIoBase, unsigned char byRegOfs,
+bool MACbIsRegBitsOn(struct vnt_private *, unsigned char byRegOfs,
unsigned char byTestBits);
-bool MACbIsRegBitsOff(void __iomem *dwIoBase, unsigned char byRegOfs,
+bool MACbIsRegBitsOff(struct vnt_private *, unsigned char byRegOfs,
unsigned char byTestBits);

-bool MACbIsIntDisable(void __iomem *dwIoBase);
+bool MACbIsIntDisable(struct vnt_private *);

-void MACvSetShortRetryLimit(void __iomem *dwIoBase, unsigned char byRetryLimit);
+void MACvSetShortRetryLimit(struct vnt_private *, unsigned char byRetryLimit);

-void MACvSetLongRetryLimit(void __iomem *dwIoBase, unsigned char byRetryLimit);
-void MACvGetLongRetryLimit(void __iomem *dwIoBase,
+void MACvSetLongRetryLimit(struct vnt_private *, unsigned char byRetryLimit);
+void MACvGetLongRetryLimit(struct vnt_private *,
unsigned char *pbyRetryLimit);

-void MACvSetLoopbackMode(void __iomem *dwIoBase, unsigned char byLoopbackMode);
+void MACvSetLoopbackMode(struct vnt_private *, unsigned char byLoopbackMode);

-void MACvSaveContext(void __iomem *dwIoBase, unsigned char *pbyCxtBuf);
-void MACvRestoreContext(void __iomem *dwIoBase, unsigned char *pbyCxtBuf);
+void MACvSaveContext(struct vnt_private *, unsigned char *pbyCxtBuf);
+void MACvRestoreContext(struct vnt_private *, unsigned char *pbyCxtBuf);

-bool MACbSoftwareReset(void __iomem *dwIoBase);
-bool MACbSafeSoftwareReset(void __iomem *dwIoBase);
-bool MACbSafeRxOff(void __iomem *dwIoBase);
-bool MACbSafeTxOff(void __iomem *dwIoBase);
-bool MACbSafeStop(void __iomem *dwIoBase);
-bool MACbShutdown(void __iomem *dwIoBase);
-void MACvInitialize(void __iomem *dwIoBase);
-void MACvSetCurrRx0DescAddr(void __iomem *dwIoBase,
+bool MACbSoftwareReset(struct vnt_private *);
+bool MACbSafeSoftwareReset(struct vnt_private *);
+bool MACbSafeRxOff(struct vnt_private *);
+bool MACbSafeTxOff(struct vnt_private *);
+bool MACbSafeStop(struct vnt_private *);
+bool MACbShutdown(struct vnt_private *);
+void MACvInitialize(struct vnt_private *);
+void MACvSetCurrRx0DescAddr(struct vnt_private *,
unsigned long dwCurrDescAddr);
-void MACvSetCurrRx1DescAddr(void __iomem *dwIoBase,
+void MACvSetCurrRx1DescAddr(struct vnt_private *,
unsigned long dwCurrDescAddr);
-void MACvSetCurrTXDescAddr(int iTxType, void __iomem *dwIoBase,
+void MACvSetCurrTXDescAddr(int iTxType, struct vnt_private *,
unsigned long dwCurrDescAddr);
-void MACvSetCurrTx0DescAddrEx(void __iomem *dwIoBase,
+void MACvSetCurrTx0DescAddrEx(struct vnt_private *,
unsigned long dwCurrDescAddr);
-void MACvSetCurrAC0DescAddrEx(void __iomem *dwIoBase,
+void MACvSetCurrAC0DescAddrEx(struct vnt_private *,
unsigned long dwCurrDescAddr);
-void MACvSetCurrSyncDescAddrEx(void __iomem *dwIoBase,
+void MACvSetCurrSyncDescAddrEx(struct vnt_private *,
unsigned long dwCurrDescAddr);
-void MACvSetCurrATIMDescAddrEx(void __iomem *dwIoBase,
+void MACvSetCurrATIMDescAddrEx(struct vnt_private *,
unsigned long dwCurrDescAddr);
-void MACvTimer0MicroSDelay(void __iomem *dwIoBase, unsigned int uDelay);
-void MACvOneShotTimer1MicroSec(void __iomem *dwIoBase, unsigned int uDelayTime);
+void MACvTimer0MicroSDelay(struct vnt_private *, unsigned int uDelay);
+void MACvOneShotTimer1MicroSec(struct vnt_private *, unsigned int uDelayTime);

-void MACvSetMISCFifo(void __iomem *dwIoBase, unsigned short wOffset,
+void MACvSetMISCFifo(struct vnt_private *, unsigned short wOffset,
unsigned long dwData);

-bool MACbPSWakeup(void __iomem *dwIoBase);
+bool MACbPSWakeup(struct vnt_private *);

-void MACvSetKeyEntry(void __iomem *dwIoBase, unsigned short wKeyCtl,
+void MACvSetKeyEntry(struct vnt_private *, unsigned short wKeyCtl,
unsigned int uEntryIdx, unsigned int uKeyIdx,
unsigned char *pbyAddr, u32 *pdwKey,
unsigned char byLocalID);
-void MACvDisableKeyEntry(void __iomem *dwIoBase, unsigned int uEntryIdx);
+void MACvDisableKeyEntry(struct vnt_private *, unsigned int uEntryIdx);

#endif /* __MAC_H__ */
diff --git a/drivers/staging/vt6655/power.c b/drivers/staging/vt6655/power.c
index 5e968c9..bc8ca98 100644
--- a/drivers/staging/vt6655/power.c
+++ b/drivers/staging/vt6655/power.c
@@ -120,7 +120,7 @@ PSvDisablePowerSaving(
)
{
/* disable power saving hw function */
- MACbPSWakeup(priv->PortOffset);
+ MACbPSWakeup(priv);
/* clear AutoSleep */
MACvRegBitsOff(priv->PortOffset, MAC_REG_PSCFG, PSCFG_AUTOSLEEP);
/* clear HWUTSF */
diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c
index 1c0691d..3df430b 100644
--- a/drivers/staging/vt6655/rf.c
+++ b/drivers/staging/vt6655/rf.c
@@ -438,13 +438,13 @@ static bool s_bAL7230Init(struct vnt_private *priv)
MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);

/* Calibration */
- MACvTimer0MicroSDelay(dwIoBase, 150);/* 150us */
+ MACvTimer0MicroSDelay(priv, 150);/* 150us */
/* TXDCOC:active, RCK:disable */
ret &= IFRFbWriteEmbedded(priv, (0x9ABA8F00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW));
- MACvTimer0MicroSDelay(dwIoBase, 30);/* 30us */
+ MACvTimer0MicroSDelay(priv, 30);/* 30us */
/* TXDCOC:disable, RCK:active */
ret &= IFRFbWriteEmbedded(priv, (0x3ABA8F00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW));
- MACvTimer0MicroSDelay(dwIoBase, 30);/* 30us */
+ MACvTimer0MicroSDelay(priv, 30);/* 30us */
/* TXDCOC:disable, RCK:disable */
ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[CB_AL7230_INIT_SEQ-1]);

@@ -483,7 +483,7 @@ static bool s_bAL7230SelectChannel(struct vnt_private *priv, unsigned char byCha

/* Set Channel[7] = 0 to tell H/W channel is changing now. */
VNSvOutPortB(dwIoBase + MAC_REG_CHANNEL, (byChannel & 0x7F));
- MACvTimer0MicroSDelay(dwIoBase, SWITCH_CHANNEL_DELAY_AL7230);
+ MACvTimer0MicroSDelay(priv, SWITCH_CHANNEL_DELAY_AL7230);
/* Set Channel[7] = 1 to tell H/W channel change is done. */
VNSvOutPortB(dwIoBase + MAC_REG_CHANNEL, (byChannel | 0x80));

@@ -557,16 +557,16 @@ static bool RFbAL2230Init(struct vnt_private *priv)

for (ii = 0; ii < CB_AL2230_INIT_SEQ; ii++)
ret &= IFRFbWriteEmbedded(priv, dwAL2230InitTable[ii]);
- MACvTimer0MicroSDelay(dwIoBase, 30); /* delay 30 us */
+ MACvTimer0MicroSDelay(priv, 30); /* delay 30 us */

/* PLL On */
MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);

- MACvTimer0MicroSDelay(dwIoBase, 150);/* 150us */
+ MACvTimer0MicroSDelay(priv, 150);/* 150us */
ret &= IFRFbWriteEmbedded(priv, (0x00d80f00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW));
- MACvTimer0MicroSDelay(dwIoBase, 30);/* 30us */
+ MACvTimer0MicroSDelay(priv, 30);/* 30us */
ret &= IFRFbWriteEmbedded(priv, (0x00780f00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW));
- MACvTimer0MicroSDelay(dwIoBase, 30);/* 30us */
+ MACvTimer0MicroSDelay(priv, 30);/* 30us */
ret &= IFRFbWriteEmbedded(priv, dwAL2230InitTable[CB_AL2230_INIT_SEQ-1]);

MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE3 |
@@ -592,7 +592,7 @@ static bool RFbAL2230SelectChannel(struct vnt_private *priv, unsigned char byCha

/* Set Channel[7] = 0 to tell H/W channel is changing now. */
VNSvOutPortB(dwIoBase + MAC_REG_CHANNEL, (byChannel & 0x7F));
- MACvTimer0MicroSDelay(dwIoBase, SWITCH_CHANNEL_DELAY_AL2230);
+ MACvTimer0MicroSDelay(priv, SWITCH_CHANNEL_DELAY_AL2230);
/* Set Channel[7] = 1 to tell H/W channel change is done. */
VNSvOutPortB(dwIoBase + MAC_REG_CHANNEL, (byChannel | 0x80));

@@ -711,11 +711,11 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char byRFType,
return false;

for (ii = 0; ii < CB_AL2230_INIT_SEQ; ii++)
- MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL2230InitTable[ii]);
+ MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL2230InitTable[ii]);

- MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL2230ChannelTable0[uChannel-1]);
+ MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL2230ChannelTable0[uChannel-1]);
ii++;
- MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL2230ChannelTable1[uChannel-1]);
+ MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL2230ChannelTable1[uChannel-1]);
break;

/* Need to check, PLLON need to be low for channel setting */
@@ -728,17 +728,17 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char byRFType,

if (uChannel <= CB_MAX_CHANNEL_24G) {
for (ii = 0; ii < CB_AL7230_INIT_SEQ; ii++)
- MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230InitTable[ii]);
+ MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230InitTable[ii]);
} else {
for (ii = 0; ii < CB_AL7230_INIT_SEQ; ii++)
- MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230InitTableAMode[ii]);
+ MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230InitTableAMode[ii]);
}

- MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230ChannelTable0[uChannel-1]);
+ MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230ChannelTable0[uChannel-1]);
ii++;
- MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230ChannelTable1[uChannel-1]);
+ MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230ChannelTable1[uChannel-1]);
ii++;
- MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230ChannelTable2[uChannel-1]);
+ MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230ChannelTable2[uChannel-1]);
break;

case RF_NOTHING:
@@ -748,7 +748,7 @@ bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char byRFType,
return false;
}

- MACvSetMISCFifo(dwIoBase, MISCFIFO_SYNINFO_IDX, (unsigned long)MAKEWORD(bySleepCount, byInitCount));
+ MACvSetMISCFifo(priv, MISCFIFO_SYNINFO_IDX, (unsigned long)MAKEWORD(bySleepCount, byInitCount));

return true;
}
--
2.6.2


2015-11-22 09:08:14

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 7/8] staging: vt6655: PSbIsNextTBTTWakeUp Rename bWakeUp wake_up

Removing camel case.

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

diff --git a/drivers/staging/vt6655/power.c b/drivers/staging/vt6655/power.c
index ad44746..5e968c9 100644
--- a/drivers/staging/vt6655/power.c
+++ b/drivers/staging/vt6655/power.c
@@ -151,7 +151,7 @@ PSbIsNextTBTTWakeUp(
{
struct ieee80211_hw *hw = priv->hw;
struct ieee80211_conf *conf = &hw->conf;
- bool bWakeUp = false;
+ bool wake_up = false;

if (conf->listen_interval > 1) {
if (!priv->wake_up_count)
@@ -163,9 +163,9 @@ PSbIsNextTBTTWakeUp(
/* Turn on wake up to listen next beacon */
MACvRegBitsOn(priv->PortOffset,
MAC_REG_PSCTL, PSCTL_LNBCN);
- bWakeUp = true;
+ wake_up = true;
}
}

- return bWakeUp;
+ return wake_up;
}
--
2.6.2


2015-11-22 09:08:09

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 2/8] staging: vt6655: set_channel replace void handler.

Replace with struct vnt_private.

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

diff --git a/drivers/staging/vt6655/channel.c b/drivers/staging/vt6655/channel.c
index 6edccb42..d1c9116 100644
--- a/drivers/staging/vt6655/channel.c
+++ b/drivers/staging/vt6655/channel.c
@@ -174,9 +174,8 @@ void vnt_init_bands(struct vnt_private *priv)
* Return Value: true if succeeded; false if failed.
*
*/
-bool set_channel(void *pDeviceHandler, struct ieee80211_channel *ch)
+bool set_channel(struct vnt_private *priv, struct ieee80211_channel *ch)
{
- struct vnt_private *priv = pDeviceHandler;
bool bResult = true;

if (priv->byCurrentCh == ch->hw_value)
diff --git a/drivers/staging/vt6655/channel.h b/drivers/staging/vt6655/channel.h
index e2be6fc..2d613e7 100644
--- a/drivers/staging/vt6655/channel.h
+++ b/drivers/staging/vt6655/channel.h
@@ -27,6 +27,6 @@

void vnt_init_bands(struct vnt_private *);

-bool set_channel(void *pDeviceHandler, struct ieee80211_channel *);
+bool set_channel(struct vnt_private *, struct ieee80211_channel *);

#endif /* _CHANNEL_H_ */
--
2.6.2


2015-11-22 09:08:12

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 5/8] staging: vt6655: power.c replace pDevice with priv

Removing camel case.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/power.c | 56 +++++++++++++++++++++---------------------
1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/vt6655/power.c b/drivers/staging/vt6655/power.c
index 06e6b9d..e58afbd 100644
--- a/drivers/staging/vt6655/power.c
+++ b/drivers/staging/vt6655/power.c
@@ -68,40 +68,40 @@ PSvEnablePowerSaving(
unsigned short wListenInterval
)
{
- struct vnt_private *pDevice = hDeviceContext;
- u16 wAID = pDevice->current_aid | BIT(14) | BIT(15);
+ struct vnt_private *priv = hDeviceContext;
+ u16 wAID = priv->current_aid | BIT(14) | BIT(15);

/* set period of power up before TBTT */
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_PWBT, C_PWBT);
- if (pDevice->op_mode != NL80211_IFTYPE_ADHOC) {
+ VNSvOutPortW(priv->PortOffset + MAC_REG_PWBT, C_PWBT);
+ if (priv->op_mode != NL80211_IFTYPE_ADHOC) {
/* set AID */
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_AIDATIM, wAID);
+ VNSvOutPortW(priv->PortOffset + MAC_REG_AIDATIM, wAID);
} else {
/* set ATIM Window */
#if 0 /* TODO atim window */
- MACvWriteATIMW(pDevice->PortOffset, pMgmt->wCurrATIMWindow);
+ MACvWriteATIMW(priv->PortOffset, pMgmt->wCurrATIMWindow);
#endif
}
/* Set AutoSleep */
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCFG, PSCFG_AUTOSLEEP);
+ MACvRegBitsOn(priv->PortOffset, MAC_REG_PSCFG, PSCFG_AUTOSLEEP);
/* Set HWUTSF */
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TFTCTL, TFTCTL_HWUTSF);
+ MACvRegBitsOn(priv->PortOffset, MAC_REG_TFTCTL, TFTCTL_HWUTSF);

if (wListenInterval >= 2) {
/* clear always listen beacon */
- MACvRegBitsOff(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_ALBCN);
+ MACvRegBitsOff(priv->PortOffset, MAC_REG_PSCTL, PSCTL_ALBCN);
/* first time set listen next beacon */
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_LNBCN);
+ MACvRegBitsOn(priv->PortOffset, MAC_REG_PSCTL, PSCTL_LNBCN);
} else {
/* always listen beacon */
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_ALBCN);
+ MACvRegBitsOn(priv->PortOffset, MAC_REG_PSCTL, PSCTL_ALBCN);
}

/* enable power saving hw function */
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PSEN);
- pDevice->bEnablePSMode = true;
+ MACvRegBitsOn(priv->PortOffset, MAC_REG_PSCTL, PSCTL_PSEN);
+ priv->bEnablePSMode = true;

- pDevice->bPWBitOn = true;
+ priv->bPWBitOn = true;
pr_debug("PS:Power Saving Mode Enable...\n");
}

@@ -120,20 +120,20 @@ PSvDisablePowerSaving(
void *hDeviceContext
)
{
- struct vnt_private *pDevice = hDeviceContext;
+ struct vnt_private *priv = hDeviceContext;

/* disable power saving hw function */
- MACbPSWakeup(pDevice->PortOffset);
+ MACbPSWakeup(priv->PortOffset);
/* clear AutoSleep */
- MACvRegBitsOff(pDevice->PortOffset, MAC_REG_PSCFG, PSCFG_AUTOSLEEP);
+ MACvRegBitsOff(priv->PortOffset, MAC_REG_PSCFG, PSCFG_AUTOSLEEP);
/* clear HWUTSF */
- MACvRegBitsOff(pDevice->PortOffset, MAC_REG_TFTCTL, TFTCTL_HWUTSF);
+ MACvRegBitsOff(priv->PortOffset, MAC_REG_TFTCTL, TFTCTL_HWUTSF);
/* set always listen beacon */
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_ALBCN);
+ MACvRegBitsOn(priv->PortOffset, MAC_REG_PSCTL, PSCTL_ALBCN);

- pDevice->bEnablePSMode = false;
+ priv->bEnablePSMode = false;

- pDevice->bPWBitOn = false;
+ priv->bPWBitOn = false;
}


@@ -152,20 +152,20 @@ PSbIsNextTBTTWakeUp(
void *hDeviceContext
)
{
- struct vnt_private *pDevice = hDeviceContext;
- struct ieee80211_hw *hw = pDevice->hw;
+ struct vnt_private *priv = hDeviceContext;
+ struct ieee80211_hw *hw = priv->hw;
struct ieee80211_conf *conf = &hw->conf;
bool bWakeUp = false;

if (conf->listen_interval > 1) {
- if (!pDevice->wake_up_count)
- pDevice->wake_up_count = conf->listen_interval;
+ if (!priv->wake_up_count)
+ priv->wake_up_count = conf->listen_interval;

- --pDevice->wake_up_count;
+ --priv->wake_up_count;

- if (pDevice->wake_up_count == 1) {
+ if (priv->wake_up_count == 1) {
/* Turn on wake up to listen next beacon */
- MACvRegBitsOn(pDevice->PortOffset,
+ MACvRegBitsOn(priv->PortOffset,
MAC_REG_PSCTL, PSCTL_LNBCN);
bWakeUp = true;
}
--
2.6.2


2015-11-22 09:08:10

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 3/8] staging: vt6655: set_channel replace bResult with ret

Removing camel case.

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

diff --git a/drivers/staging/vt6655/channel.c b/drivers/staging/vt6655/channel.c
index d1c9116..9ac1ef9 100644
--- a/drivers/staging/vt6655/channel.c
+++ b/drivers/staging/vt6655/channel.c
@@ -176,10 +176,10 @@ void vnt_init_bands(struct vnt_private *priv)
*/
bool set_channel(struct vnt_private *priv, struct ieee80211_channel *ch)
{
- bool bResult = true;
+ bool ret = true;

if (priv->byCurrentCh == ch->hw_value)
- return bResult;
+ return ret;

/* Set VGA to max sensitivity */
if (priv->bUpdateBBVGA &&
@@ -200,8 +200,8 @@ bool set_channel(struct vnt_private *priv, struct ieee80211_channel *ch)
ch->hw_value);

priv->byCurrentCh = ch->hw_value;
- bResult &= RFbSelectChannel(priv, priv->byRFType,
- ch->hw_value);
+ ret &= RFbSelectChannel(priv, priv->byRFType,
+ ch->hw_value);

/* Init Synthesizer Table */
if (priv->bEnablePSMode)
@@ -232,5 +232,5 @@ bool set_channel(struct vnt_private *priv, struct ieee80211_channel *ch)
else
RFbSetPower(priv, RATE_6M, priv->byCurrentCh);

- return bResult;
+ return ret;
}
--
2.6.2


2015-11-23 00:39:51

by Julian Calaby

[permalink] [raw]
Subject: Re: [PATCH 4/8] staging: vt6655: rf.c rename bResult ret.

Hi Malcolm,

A couple of these comments apply to a few of the patches.

On Sun, Nov 22, 2015 at 8:07 PM, Malcolm Priestley <[email protected]> wrote:
> Removing camel case and reflecting return value.
>
> Signed-off-by: Malcolm Priestley <[email protected]>
> ---
> drivers/staging/vt6655/rf.c | 138 ++++++++++++++++++++++----------------------
> 1 file changed, 69 insertions(+), 69 deletions(-)
>
> diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c
> index 4c22bb3..1c0691d 100644
> --- a/drivers/staging/vt6655/rf.c
> +++ b/drivers/staging/vt6655/rf.c
> @@ -420,9 +420,9 @@ static bool s_bAL7230Init(struct vnt_private *priv)
> {
> void __iomem *dwIoBase = priv->PortOffset;
> int ii;
> - bool bResult;
> + bool ret;
>
> - bResult = true;
> + ret = true;

These two lines could be combined into one.

> /* 3-wire control for normal mode */
> VNSvOutPortB(dwIoBase + MAC_REG_SOFTPWRCTL, 0);
> @@ -432,7 +432,7 @@ static bool s_bAL7230Init(struct vnt_private *priv)
> BBvPowerSaveModeOFF(priv); /* RobertYu:20050106, have DC value for Calibration */
>
> for (ii = 0; ii < CB_AL7230_INIT_SEQ; ii++)
> - bResult &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[ii]);
> + ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[ii]);

Now that I understand why it's always ret &= ..., I'm truly horrified
by the error handling in this driver. =)

> /* PLL On */
> MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);

> @@ -616,26 +616,26 @@ bool RFbInit(
> struct vnt_private *priv
> )
> {
> - bool bResult = true;
> + bool ret = true;
>
> switch (priv->byRFType) {
> case RF_AIROHA:
> case RF_AL2230S:
> priv->byMaxPwrLevel = AL2230_PWR_IDX_LEN;
> - bResult = RFbAL2230Init(priv);
> + ret = RFbAL2230Init(priv);
> break;
> case RF_AIROHA7230:
> priv->byMaxPwrLevel = AL7230_PWR_IDX_LEN;
> - bResult = s_bAL7230Init(priv);
> + ret = s_bAL7230Init(priv);
> break;
> case RF_NOTHING:
> - bResult = true;
> + ret = true;
> break;
> default:
> - bResult = false;
> + ret = false;
> break;
> }
> - return bResult;
> + return ret;
> }
>
> /*
> @@ -654,26 +654,26 @@ bool RFbInit(
> bool RFbSelectChannel(struct vnt_private *priv, unsigned char byRFType,
> u16 byChannel)
> {
> - bool bResult = true;
> + bool ret = true;
>
> switch (byRFType) {
> case RF_AIROHA:
> case RF_AL2230S:
> - bResult = RFbAL2230SelectChannel(priv, byChannel);
> + ret = RFbAL2230SelectChannel(priv, byChannel);
> break;
> /*{{ RobertYu: 20050104 */
> case RF_AIROHA7230:
> - bResult = s_bAL7230SelectChannel(priv, byChannel);
> + ret = s_bAL7230SelectChannel(priv, byChannel);
> break;
> /*}} RobertYu */
> case RF_NOTHING:
> - bResult = true;
> + ret = true;

Isn't this line unnecessary?

> break;
> default:
> - bResult = false;
> + ret = false;
> break;
> }
> - return bResult;
> + return ret;
> }
>
> /*

> @@ -879,13 +879,13 @@ bool RFbRawSetPower(
> dwMax7230Pwr = 0x080C0B00 | ((byPwr) << 12) |
> (BY_AL7230_REG_LEN << 3) | IFREGCTL_REGW;
>
> - bResult &= IFRFbWriteEmbedded(priv, dwMax7230Pwr);
> + ret &= IFRFbWriteEmbedded(priv, dwMax7230Pwr);
> break;
>
> default:
> break;

You could remove this default case in another round of cleanups.

Thanks,

--
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/