Skip to content

Commit

Permalink
Staging: r8187se: Remove two private variables that have a fixed value
Browse files Browse the repository at this point in the history
For the RTL8187SE, the variable priv->rf_chip is always RF_ZEBRA4
and priv->RegThreeWireMode is always HW_THREE_WIRE_SI. Remove these
2 variables.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Larry Finger authored and Greg Kroah-Hartman committed Mar 4, 2010
1 parent b1b7621 commit 8daba6b
Show file tree
Hide file tree
Showing 5 changed files with 191 additions and 568 deletions.
4 changes: 0 additions & 4 deletions drivers/staging/rtl8187se/r8180.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ typedef struct r8180_priv
short diversity;
u8 cs_treshold;
short rcr_csense;
short rf_chip;
u32 key0[4];
short (*rf_set_sens)(struct net_device *dev,short sens);
void (*rf_set_chan)(struct net_device *dev,short ch);
Expand Down Expand Up @@ -479,9 +478,6 @@ typedef struct r8180_priv
u8 retry_rts;
u16 rts;

//add for RF power on power off by lizhaoming 080512
u8 RegThreeWireMode; // See "Three wire mode" defined above, 2006.05.31, by rcnjko.

//by amy for led
LED_STRATEGY_8185 LedStrategy;
//by amy for led
Expand Down
90 changes: 0 additions & 90 deletions drivers/staging/rtl8187se/r8180_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,11 +663,8 @@ unsigned char STRENGTH_MAP[] = {

void rtl8180_RSSI_calc(struct net_device *dev, u8 *rssi, u8 *qual)
{
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
u32 temp;
u32 temp2;
u32 temp3;
u32 lsb;
u32 q;
u32 orig_qual;
u8 _rssi;
Expand All @@ -689,88 +686,6 @@ void rtl8180_RSSI_calc(struct net_device *dev, u8 *rssi, u8 *qual)
*qual = temp;
temp2 = *rssi;

switch(priv->rf_chip){
case RFCHIPID_RFMD:
lsb = temp2 & 1;
temp2 &= 0x7e;
if ( !lsb || !(temp2 <= 0x3c) ) {
temp2 = 0x64;
} else {
temp2 = 100 * temp2 / 0x3c;
}
*rssi = temp2 & 0xff;
_rssi = temp2 & 0xff;
break;
case RFCHIPID_INTERSIL:
lsb = temp2;
temp2 &= 0xfffffffe;
temp2 *= 251;
temp3 = temp2;
temp2 <<= 6;
temp3 += temp2;
temp3 <<= 1;
temp2 = 0x4950df;
temp2 -= temp3;
lsb &= 1;
if ( temp2 <= 0x3e0000 ) {
if ( temp2 < 0xffef0000 )
temp2 = 0xffef0000;
} else {
temp2 = 0x3e0000;
}
if ( !lsb ) {
temp2 -= 0xf0000;
} else {
temp2 += 0xf0000;
}

temp3 = 0x4d0000;
temp3 -= temp2;
temp3 *= 100;
temp3 = temp3 / 0x6d;
temp3 >>= 0x10;
_rssi = temp3 & 0xff;
*rssi = temp3 & 0xff;
break;
case RFCHIPID_GCT:
lsb = temp2 & 1;
temp2 &= 0x7e;
if ( ! lsb || !(temp2 <= 0x3c) ){
temp2 = 0x64;
} else {
temp2 = (100 * temp2) / 0x3c;
}
*rssi = temp2 & 0xff;
_rssi = temp2 & 0xff;
break;
case RFCHIPID_PHILIPS:
if( orig_qual <= 0x4e ){
_rssi = STRENGTH_MAP[orig_qual];
*rssi = _rssi;
} else {
orig_qual -= 0x80;
if ( !orig_qual ){
_rssi = 1;
*rssi = 1;
} else {
_rssi = 0x32;
*rssi = 0x32;
}
}
break;
case RFCHIPID_MAXIM:
lsb = temp2 & 1;
temp2 &= 0x7e;
temp2 >>= 1;
temp2 += 0x42;
if( lsb != 0 ){
temp2 += 0xa;
}
*rssi = temp2 & 0xff;
_rssi = temp2 & 0xff;
break;
}

if ( _rssi < 0x64 ){
if ( _rssi == 0 ) {
*rssi = 1;
Expand Down Expand Up @@ -2707,8 +2622,6 @@ short rtl8180_init(struct net_device *dev)
priv->txbeaconcount = 2;
priv->rx_skb_complete = 1;

priv->RegThreeWireMode = HW_THREE_WIRE_SI;

priv->RFChangeInProgress = false;
priv->SetRFPowerStateInProgress = false;
priv->RFProgType = 0;
Expand Down Expand Up @@ -2999,9 +2912,6 @@ short rtl8180_init(struct net_device *dev)
priv->cs_treshold = (eeprom_val & 0xff00) >> 8;

eeprom_93cx6_read(&eeprom, RFCHIPID, &eeprom_val);
priv->rf_chip = 0xff & eeprom_val;

priv->rf_chip = RF_ZEBRA4;
priv->rf_sleep = rtl8225z4_rf_sleep;
priv->rf_wakeup = rtl8225z4_rf_wakeup;
DMESGW("**PLEASE** REPORT SUCCESSFUL/UNSUCCESSFUL TO Realtek!");
Expand Down
67 changes: 15 additions & 52 deletions drivers/staging/rtl8187se/r8180_dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,30 +282,13 @@ DIG_Zebra(
// Dispatch DIG implementation according to RF.
//
void
DynamicInitGain(
struct net_device *dev
)
DynamicInitGain(struct net_device *dev)
{
struct r8180_priv *priv = ieee80211_priv(dev);

switch(priv->rf_chip)
{
case RF_ZEBRA2: // [AnnieWorkaround] For Zebra2, 2005-08-01.
case RF_ZEBRA4:
DIG_Zebra( dev );
break;

default:
printk("DynamicInitGain(): unknown RFChipID(%d) !!!\n", priv->rf_chip);
break;
}
DIG_Zebra(dev);
}

void rtl8180_hw_dig_wq (struct work_struct *work)
{
// struct r8180_priv *priv = container_of(work, struct r8180_priv, watch_dog_wq);
// struct ieee80211_device * ieee = (struct ieee80211_device*)
// container_of(work, struct ieee80211_device, watch_dog_wq);
struct delayed_work *dwork = to_delayed_work(work);
struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,hw_dig_wq);
struct net_device *dev = ieee->dev;
Expand Down Expand Up @@ -1310,44 +1293,24 @@ SetAntenna8185(
switch(u1bAntennaIndex)
{
case 0:
switch(priv->rf_chip)
{
case RF_ZEBRA2:
case RF_ZEBRA4:
// Mac register, main antenna
write_nic_byte(dev, ANTSEL, 0x03);
//base band
write_phy_cck(dev,0x11, 0x9b); // Config CCK RX antenna.
write_phy_ofdm(dev, 0x0d, 0x5c); // Config OFDM RX antenna.


bAntennaSwitched = true;
break;
/* Mac register, main antenna */
write_nic_byte(dev, ANTSEL, 0x03);
/* base band */
write_phy_cck(dev, 0x11, 0x9b); /* Config CCK RX antenna. */
write_phy_ofdm(dev, 0x0d, 0x5c); /* Config OFDM RX antenna. */

default:
printk("SetAntenna8185: unknown RFChipID(%d)\n", priv->rf_chip);
break;
}
bAntennaSwitched = true;
break;

case 1:
switch(priv->rf_chip)
{
case RF_ZEBRA2:
case RF_ZEBRA4:
// Mac register, aux antenna
write_nic_byte(dev, ANTSEL, 0x00);
//base band
write_phy_cck(dev, 0x11, 0xbb); // Config CCK RX antenna.
write_phy_ofdm(dev, 0x0d, 0x54); // Config OFDM RX antenna.

bAntennaSwitched = true;
break;
/* Mac register, aux antenna */
write_nic_byte(dev, ANTSEL, 0x00);
/* base band */
write_phy_cck(dev, 0x11, 0xbb); /* Config CCK RX antenna. */
write_phy_ofdm(dev, 0x0d, 0x54); /* Config OFDM RX antenna. */

bAntennaSwitched = true;

default:
printk("SetAntenna8185: unknown RFChipID(%d)\n", priv->rf_chip);
break;
}
break;

default:
Expand Down
Loading

0 comments on commit 8daba6b

Please sign in to comment.