aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2800lib.c
diff options
context:
space:
mode:
authorIvo van Doorn <IvDoorn@gmail.com>2011-04-18 09:27:06 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-04-19 15:39:11 -0400
commit7dab73b37f5e8885cb73efd25e73861f9b4f0246 (patch)
tree3c09412e1ec0b02eaf193879aed12db0f9874f7c /drivers/net/wireless/rt2x00/rt2800lib.c
parent62fe778412b36791b7897cfa139342906fbbf07b (diff)
rt2x00: Split rt2x00dev->flags
The number of flags defined for the rt2x00dev->flags field, has been growing over the years. Currently we are approaching the maximum number of bits which are available in the field. A secondary problem, is that one part of the field are initialized only during boot, because the driver requirements are initialized or device requirements are loaded from the EEPROM. In both cases, the flags are fixed and will not change during device operation. The other flags are the device state, and will change frequently. So far this resulted in the fact that for some flags, the atomic bit accessors are used, while for the others the non-atomic variants are used. By splitting the flags up into a "flags" and "cap_flags" we can put all flags which are fixed inside "cap_flags". This field can then be read non-atomically. In the "flags" field we keep the device state, which is going to be read atomically. This adds more room for more flags in the future, and sanitizes the field access methods. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Acked-by: Helmut Schaa <helmut.schaa@googlemail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2800lib.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 13ccc1bbeb4b..c6f5584128e9 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -1763,8 +1763,8 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
1763 1763
1764 if (rf->channel <= 14) { 1764 if (rf->channel <= 14) {
1765 if (!rt2x00_rt(rt2x00dev, RT5390)) { 1765 if (!rt2x00_rt(rt2x00dev, RT5390)) {
1766 if (test_bit(CONFIG_EXTERNAL_LNA_BG, 1766 if (test_bit(CAPABILITY_EXTERNAL_LNA_BG,
1767 &rt2x00dev->flags)) { 1767 &rt2x00dev->cap_flags)) {
1768 rt2800_bbp_write(rt2x00dev, 82, 0x62); 1768 rt2800_bbp_write(rt2x00dev, 82, 0x62);
1769 rt2800_bbp_write(rt2x00dev, 75, 0x46); 1769 rt2800_bbp_write(rt2x00dev, 75, 0x46);
1770 } else { 1770 } else {
@@ -1775,7 +1775,7 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
1775 } else { 1775 } else {
1776 rt2800_bbp_write(rt2x00dev, 82, 0xf2); 1776 rt2800_bbp_write(rt2x00dev, 82, 0xf2);
1777 1777
1778 if (test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags)) 1778 if (test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags))
1779 rt2800_bbp_write(rt2x00dev, 75, 0x46); 1779 rt2800_bbp_write(rt2x00dev, 75, 0x46);
1780 else 1780 else
1781 rt2800_bbp_write(rt2x00dev, 75, 0x50); 1781 rt2800_bbp_write(rt2x00dev, 75, 0x50);
@@ -2008,7 +2008,7 @@ static u8 rt2800_compensate_txpower(struct rt2x00_dev *rt2x00dev, int is_rate_b,
2008 if (!((band == IEEE80211_BAND_5GHZ) && is_rate_b)) 2008 if (!((band == IEEE80211_BAND_5GHZ) && is_rate_b))
2009 return txpower; 2009 return txpower;
2010 2010
2011 if (test_bit(CONFIG_SUPPORT_POWER_LIMIT, &rt2x00dev->flags)) { 2011 if (test_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags)) {
2012 /* 2012 /*
2013 * Check if eirp txpower exceed txpower_limit. 2013 * Check if eirp txpower exceed txpower_limit.
2014 * We use OFDM 6M as criterion and its eirp txpower 2014 * We use OFDM 6M as criterion and its eirp txpower
@@ -3309,8 +3309,8 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
3309 rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || 3309 rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) ||
3310 rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) || 3310 rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) ||
3311 rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) { 3311 rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) {
3312 if (!test_bit(CONFIG_EXTERNAL_LNA_BG, 3312 if (!test_bit(CAPABILITY_EXTERNAL_LNA_BG,
3313 &rt2x00dev->flags)) 3313 &rt2x00dev->cap_flags))
3314 rt2x00_set_field8(&rfcsr, RFCSR17_R, 1); 3314 rt2x00_set_field8(&rfcsr, RFCSR17_R, 1);
3315 } 3315 }
3316 rt2x00_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG, &eeprom); 3316 rt2x00_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG, &eeprom);
@@ -3733,15 +3733,15 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
3733 rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom); 3733 rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
3734 3734
3735 if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_LNA_5G)) 3735 if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_LNA_5G))
3736 __set_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags); 3736 __set_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags);
3737 if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_LNA_2G)) 3737 if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_LNA_2G))
3738 __set_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags); 3738 __set_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags);
3739 3739
3740 /* 3740 /*
3741 * Detect if this device has an hardware controlled radio. 3741 * Detect if this device has an hardware controlled radio.
3742 */ 3742 */
3743 if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_HW_RADIO)) 3743 if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_HW_RADIO))
3744 __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); 3744 __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags);
3745 3745
3746 /* 3746 /*
3747 * Store led settings, for correct led behaviour. 3747 * Store led settings, for correct led behaviour.
@@ -3761,7 +3761,7 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
3761 3761
3762 if (rt2x00_get_field16(eeprom, EEPROM_EIRP_MAX_TX_POWER_2GHZ) < 3762 if (rt2x00_get_field16(eeprom, EEPROM_EIRP_MAX_TX_POWER_2GHZ) <
3763 EIRP_MAX_TX_POWER_LIMIT) 3763 EIRP_MAX_TX_POWER_LIMIT)
3764 __set_bit(CONFIG_SUPPORT_POWER_LIMIT, &rt2x00dev->flags); 3764 __set_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags);
3765 3765
3766 return 0; 3766 return 0;
3767} 3767}