rt2x00: Split rt2x00dev->flags
Ivo van Doorn [Mon, 18 Apr 2011 13:27:06 +0000 (15:27 +0200)]
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>

19 files changed:
drivers/net/wireless/rt2x00/rt2400pci.c
drivers/net/wireless/rt2x00/rt2500pci.c
drivers/net/wireless/rt2x00/rt2500usb.c
drivers/net/wireless/rt2x00/rt2800lib.c
drivers/net/wireless/rt2x00/rt2800pci.c
drivers/net/wireless/rt2x00/rt2800usb.c
drivers/net/wireless/rt2x00/rt2x00.h
drivers/net/wireless/rt2x00/rt2x00config.c
drivers/net/wireless/rt2x00/rt2x00crypto.c
drivers/net/wireless/rt2x00/rt2x00debug.c
drivers/net/wireless/rt2x00/rt2x00dev.c
drivers/net/wireless/rt2x00/rt2x00firmware.c
drivers/net/wireless/rt2x00/rt2x00lib.h
drivers/net/wireless/rt2x00/rt2x00link.c
drivers/net/wireless/rt2x00/rt2x00mac.c
drivers/net/wireless/rt2x00/rt2x00queue.c
drivers/net/wireless/rt2x00/rt2x00usb.c
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c

index 137a24e..5d1654a 100644 (file)
@@ -1536,13 +1536,13 @@ static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
         * Detect if this device has an hardware controlled radio.
         */
        if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
-               __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags);
 
        /*
         * Check if the BBP tuning should be enabled.
         */
        if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RX_AGCVGC_TUNING))
-               __set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags);
 
        return 0;
 }
@@ -1640,9 +1640,9 @@ static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev)
        /*
         * This device requires the atim queue and DMA-mapped skbs.
         */
-       __set_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags);
-       __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags);
-       __set_bit(DRIVER_REQUIRE_SW_SEQNO, &rt2x00dev->flags);
+       __set_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags);
+       __set_bit(REQUIRE_DMA, &rt2x00dev->cap_flags);
+       __set_bit(REQUIRE_SW_SEQNO, &rt2x00dev->cap_flags);
 
        /*
         * Set the rssi offset.
index 198fc0a..3da954e 100644 (file)
@@ -1687,14 +1687,14 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
         * Detect if this device has an hardware controlled radio.
         */
        if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
-               __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags);
 
        /*
         * Check if the BBP tuning should be enabled.
         */
        rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom);
        if (!rt2x00_get_field16(eeprom, EEPROM_NIC_DYN_BBP_TUNE))
-               __set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags);
 
        /*
         * Read the RSSI <-> dBm offset information.
@@ -1958,9 +1958,9 @@ static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev)
        /*
         * This device requires the atim queue and DMA-mapped skbs.
         */
-       __set_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags);
-       __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags);
-       __set_bit(DRIVER_REQUIRE_SW_SEQNO, &rt2x00dev->flags);
+       __set_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags);
+       __set_bit(REQUIRE_DMA, &rt2x00dev->cap_flags);
+       __set_bit(REQUIRE_SW_SEQNO, &rt2x00dev->cap_flags);
 
        /*
         * Set the rssi offset.
index eac7881..dbbd8bc 100644 (file)
@@ -1519,7 +1519,7 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
         * Detect if this device has an hardware controlled radio.
         */
        if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
-               __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags);
 
        /*
         * Read the RSSI <-> dBm offset information.
@@ -1790,13 +1790,13 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)
        /*
         * This device requires the atim queue
         */
-       __set_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags);
-       __set_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags);
+       __set_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags);
+       __set_bit(REQUIRE_BEACON_GUARD, &rt2x00dev->cap_flags);
        if (!modparam_nohwcrypt) {
-               __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags);
-               __set_bit(DRIVER_REQUIRE_COPY_IV, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags);
+               __set_bit(REQUIRE_COPY_IV, &rt2x00dev->cap_flags);
        }
-       __set_bit(DRIVER_REQUIRE_SW_SEQNO, &rt2x00dev->flags);
+       __set_bit(REQUIRE_SW_SEQNO, &rt2x00dev->cap_flags);
 
        /*
         * Set the rssi offset.
index 13ccc1b..c6f5584 100644 (file)
@@ -1763,8 +1763,8 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
 
        if (rf->channel <= 14) {
                if (!rt2x00_rt(rt2x00dev, RT5390)) {
-                       if (test_bit(CONFIG_EXTERNAL_LNA_BG,
-                                    &rt2x00dev->flags)) {
+                       if (test_bit(CAPABILITY_EXTERNAL_LNA_BG,
+                                    &rt2x00dev->cap_flags)) {
                                rt2800_bbp_write(rt2x00dev, 82, 0x62);
                                rt2800_bbp_write(rt2x00dev, 75, 0x46);
                        } else {
@@ -1775,7 +1775,7 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
        } else {
                rt2800_bbp_write(rt2x00dev, 82, 0xf2);
 
-               if (test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags))
+               if (test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags))
                        rt2800_bbp_write(rt2x00dev, 75, 0x46);
                else
                        rt2800_bbp_write(rt2x00dev, 75, 0x50);
@@ -2008,7 +2008,7 @@ static u8 rt2800_compensate_txpower(struct rt2x00_dev *rt2x00dev, int is_rate_b,
        if (!((band == IEEE80211_BAND_5GHZ) && is_rate_b))
                return txpower;
 
-       if (test_bit(CONFIG_SUPPORT_POWER_LIMIT, &rt2x00dev->flags)) {
+       if (test_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags)) {
                /*
                 * Check if eirp txpower exceed txpower_limit.
                 * We use OFDM 6M as criterion and its eirp txpower
@@ -3309,8 +3309,8 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
                    rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) ||
                    rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) ||
                    rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) {
-                       if (!test_bit(CONFIG_EXTERNAL_LNA_BG,
-                                     &rt2x00dev->flags))
+                       if (!test_bit(CAPABILITY_EXTERNAL_LNA_BG,
+                                     &rt2x00dev->cap_flags))
                                rt2x00_set_field8(&rfcsr, RFCSR17_R, 1);
                }
                rt2x00_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG, &eeprom);
@@ -3733,15 +3733,15 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
        rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
 
        if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_LNA_5G))
-               __set_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags);
        if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_LNA_2G))
-               __set_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags);
 
        /*
         * Detect if this device has an hardware controlled radio.
         */
        if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_HW_RADIO))
-               __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags);
 
        /*
         * Store led settings, for correct led behaviour.
@@ -3761,7 +3761,7 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
 
        if (rt2x00_get_field16(eeprom, EEPROM_EIRP_MAX_TX_POWER_2GHZ) <
                                        EIRP_MAX_TX_POWER_LIMIT)
-               __set_bit(CONFIG_SUPPORT_POWER_LIMIT, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags);
 
        return 0;
 }
index adc3534..4241f19 100644 (file)
@@ -966,28 +966,28 @@ static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev)
         * This device has multiple filters for control frames
         * and has a separate filter for PS Poll frames.
         */
-       __set_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags);
-       __set_bit(DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL, &rt2x00dev->flags);
+       __set_bit(CAPABILITY_CONTROL_FILTERS, &rt2x00dev->cap_flags);
+       __set_bit(CAPABILITY_CONTROL_FILTER_PSPOLL, &rt2x00dev->cap_flags);
 
        /*
         * This device has a pre tbtt interrupt and thus fetches
         * a new beacon directly prior to transmission.
         */
-       __set_bit(DRIVER_SUPPORT_PRE_TBTT_INTERRUPT, &rt2x00dev->flags);
+       __set_bit(CAPABILITY_PRE_TBTT_INTERRUPT, &rt2x00dev->cap_flags);
 
        /*
         * This device requires firmware.
         */
        if (!rt2x00_is_soc(rt2x00dev))
-               __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
-       __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags);
-       __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags);
-       __set_bit(DRIVER_REQUIRE_TXSTATUS_FIFO, &rt2x00dev->flags);
-       __set_bit(DRIVER_REQUIRE_TASKLET_CONTEXT, &rt2x00dev->flags);
+               __set_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags);
+       __set_bit(REQUIRE_DMA, &rt2x00dev->cap_flags);
+       __set_bit(REQUIRE_L2PAD, &rt2x00dev->cap_flags);
+       __set_bit(REQUIRE_TXSTATUS_FIFO, &rt2x00dev->cap_flags);
+       __set_bit(REQUIRE_TASKLET_CONTEXT, &rt2x00dev->cap_flags);
        if (!modparam_nohwcrypt)
-               __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags);
-       __set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags);
-       __set_bit(DRIVER_REQUIRE_HT_TX_DESC, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags);
+       __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags);
+       __set_bit(REQUIRE_HT_TX_DESC, &rt2x00dev->cap_flags);
 
        /*
         * Set the rssi offset.
index d2f5c87..f3ce5e8 100644 (file)
@@ -553,18 +553,18 @@ static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)
         * This device has multiple filters for control frames
         * and has a separate filter for PS Poll frames.
         */
-       __set_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags);
-       __set_bit(DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL, &rt2x00dev->flags);
+       __set_bit(CAPABILITY_CONTROL_FILTERS, &rt2x00dev->cap_flags);
+       __set_bit(CAPABILITY_CONTROL_FILTER_PSPOLL, &rt2x00dev->cap_flags);
 
        /*
         * This device requires firmware.
         */
-       __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
-       __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags);
+       __set_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags);
+       __set_bit(REQUIRE_L2PAD, &rt2x00dev->cap_flags);
        if (!modparam_nohwcrypt)
-               __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags);
-       __set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags);
-       __set_bit(DRIVER_REQUIRE_HT_TX_DESC, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags);
+       __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags);
+       __set_bit(REQUIRE_HT_TX_DESC, &rt2x00dev->cap_flags);
 
        /*
         * Set the rssi offset.
index dd0f66a..79c385a 100644 (file)
@@ -643,11 +643,11 @@ struct rt2x00_ops {
 };
 
 /*
- * rt2x00 device flags
+ * rt2x00 state flags
  */
-enum rt2x00_flags {
+enum rt2x00_state_flags {
        /*
-        * Device state flags
+        * Device flags
         */
        DEVICE_STATE_PRESENT,
        DEVICE_STATE_REGISTERED_HW,
@@ -657,42 +657,47 @@ enum rt2x00_flags {
        DEVICE_STATE_SCANNING,
 
        /*
-        * Driver requirements
-        */
-       DRIVER_REQUIRE_FIRMWARE,
-       DRIVER_REQUIRE_BEACON_GUARD,
-       DRIVER_REQUIRE_ATIM_QUEUE,
-       DRIVER_REQUIRE_DMA,
-       DRIVER_REQUIRE_COPY_IV,
-       DRIVER_REQUIRE_L2PAD,
-       DRIVER_REQUIRE_TXSTATUS_FIFO,
-       DRIVER_REQUIRE_TASKLET_CONTEXT,
-       DRIVER_REQUIRE_SW_SEQNO,
-       DRIVER_REQUIRE_HT_TX_DESC,
-
-       /*
-        * Driver features
-        */
-       CONFIG_SUPPORT_HW_BUTTON,
-       CONFIG_SUPPORT_HW_CRYPTO,
-       CONFIG_SUPPORT_POWER_LIMIT,
-       DRIVER_SUPPORT_CONTROL_FILTERS,
-       DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL,
-       DRIVER_SUPPORT_PRE_TBTT_INTERRUPT,
-       DRIVER_SUPPORT_LINK_TUNING,
-
-       /*
         * Driver configuration
         */
-       CONFIG_FRAME_TYPE,
-       CONFIG_RF_SEQUENCE,
-       CONFIG_EXTERNAL_LNA_A,
-       CONFIG_EXTERNAL_LNA_BG,
-       CONFIG_DOUBLE_ANTENNA,
        CONFIG_CHANNEL_HT40,
 };
 
 /*
+ * rt2x00 capability flags
+ */
+enum rt2x00_capability_flags {
+       /*
+        * Requirements
+        */
+       REQUIRE_FIRMWARE,
+       REQUIRE_BEACON_GUARD,
+       REQUIRE_ATIM_QUEUE,
+       REQUIRE_DMA,
+       REQUIRE_COPY_IV,
+       REQUIRE_L2PAD,
+       REQUIRE_TXSTATUS_FIFO,
+       REQUIRE_TASKLET_CONTEXT,
+       REQUIRE_SW_SEQNO,
+       REQUIRE_HT_TX_DESC,
+
+       /*
+        * Capabilities
+        */
+       CAPABILITY_HW_BUTTON,
+       CAPABILITY_HW_CRYPTO,
+       CAPABILITY_POWER_LIMIT,
+       CAPABILITY_CONTROL_FILTERS,
+       CAPABILITY_CONTROL_FILTER_PSPOLL,
+       CAPABILITY_PRE_TBTT_INTERRUPT,
+       CAPABILITY_LINK_TUNING,
+       CAPABILITY_FRAME_TYPE,
+       CAPABILITY_RF_SEQUENCE,
+       CAPABILITY_EXTERNAL_LNA_A,
+       CAPABILITY_EXTERNAL_LNA_BG,
+       CAPABILITY_DOUBLE_ANTENNA,
+};
+
+/*
  * rt2x00 device structure.
  */
 struct rt2x00_dev {
@@ -738,13 +743,20 @@ struct rt2x00_dev {
 #endif /* CONFIG_RT2X00_LIB_LEDS */
 
        /*
-        * Device flags.
-        * In these flags the current status and some
-        * of the device capabilities are stored.
+        * Device state flags.
+        * In these flags the current status is stored.
+        * Access to these flags should occur atomically.
         */
        unsigned long flags;
 
        /*
+        * Device capabiltiy flags.
+        * In these flags the device/driver capabilities are stored.
+        * Access to these flags should occur non-atomically.
+        */
+       unsigned long cap_flags;
+
+       /*
         * Device information, Bus IRQ and name (PCI, SoC)
         */
        int irq;
index e7f67d5..e225a66 100644 (file)
@@ -176,10 +176,10 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
 
        if (ieee80211_flags & IEEE80211_CONF_CHANGE_CHANNEL) {
                if (conf_is_ht40(conf)) {
-                       __set_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags);
+                       set_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags);
                        hw_value = rt2x00ht_center_channel(rt2x00dev, conf);
                } else {
-                       __clear_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags);
+                       clear_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags);
                        hw_value = conf->channel->hw_value;
                }
 
index 5e9074b..e1e0c51 100644 (file)
@@ -52,7 +52,7 @@ void rt2x00crypto_create_tx_descriptor(struct queue_entry *entry,
        struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
        struct ieee80211_key_conf *hw_key = tx_info->control.hw_key;
 
-       if (!test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags) || !hw_key)
+       if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags) || !hw_key)
                return;
 
        __set_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags);
@@ -80,7 +80,7 @@ unsigned int rt2x00crypto_tx_overhead(struct rt2x00_dev *rt2x00dev,
        struct ieee80211_key_conf *key = tx_info->control.hw_key;
        unsigned int overhead = 0;
 
-       if (!test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags) || !key)
+       if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags) || !key)
                return overhead;
 
        /*
index 66166ef..78787fc 100644 (file)
@@ -63,7 +63,8 @@ struct rt2x00debug_intf {
         * - driver folder
         *   - driver file
         *   - chipset file
-        *   - device flags file
+        *   - device state flags file
+        *   - device capability flags file
         *   - register folder
         *     - csr offset/value files
         *     - eeprom offset/value files
@@ -78,6 +79,7 @@ struct rt2x00debug_intf {
        struct dentry *driver_entry;
        struct dentry *chipset_entry;
        struct dentry *dev_flags;
+       struct dentry *cap_flags;
        struct dentry *register_folder;
        struct dentry *csr_off_entry;
        struct dentry *csr_val_entry;
@@ -553,6 +555,35 @@ static const struct file_operations rt2x00debug_fop_dev_flags = {
        .llseek         = default_llseek,
 };
 
+static ssize_t rt2x00debug_read_cap_flags(struct file *file,
+                                         char __user *buf,
+                                         size_t length,
+                                         loff_t *offset)
+{
+       struct rt2x00debug_intf *intf = file->private_data;
+       char line[16];
+       size_t size;
+
+       if (*offset)
+               return 0;
+
+       size = sprintf(line, "0x%.8x\n", (unsigned int)intf->rt2x00dev->cap_flags);
+
+       if (copy_to_user(buf, line, size))
+               return -EFAULT;
+
+       *offset += size;
+       return size;
+}
+
+static const struct file_operations rt2x00debug_fop_cap_flags = {
+       .owner          = THIS_MODULE,
+       .read           = rt2x00debug_read_cap_flags,
+       .open           = rt2x00debug_file_open,
+       .release        = rt2x00debug_file_release,
+       .llseek         = default_llseek,
+};
+
 static struct dentry *rt2x00debug_create_file_driver(const char *name,
                                                     struct rt2x00debug_intf
                                                     *intf,
@@ -652,6 +683,12 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
        if (IS_ERR(intf->dev_flags) || !intf->dev_flags)
                goto exit;
 
+       intf->cap_flags = debugfs_create_file("cap_flags", S_IRUSR,
+                                             intf->driver_folder, intf,
+                                             &rt2x00debug_fop_cap_flags);
+       if (IS_ERR(intf->cap_flags) || !intf->cap_flags)
+               goto exit;
+
        intf->register_folder =
            debugfs_create_dir("register", intf->driver_folder);
        if (IS_ERR(intf->register_folder) || !intf->register_folder)
@@ -705,7 +742,7 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
                                intf, &rt2x00debug_fop_queue_stats);
 
 #ifdef CONFIG_RT2X00_LIB_CRYPTO
-       if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags))
+       if (test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags))
                intf->crypto_stats_entry =
                    debugfs_create_file("crypto", S_IRUGO, intf->queue_folder,
                                        intf, &rt2x00debug_fop_crypto_stats);
@@ -743,6 +780,7 @@ void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev)
        debugfs_remove(intf->csr_off_entry);
        debugfs_remove(intf->register_folder);
        debugfs_remove(intf->dev_flags);
+       debugfs_remove(intf->cap_flags);
        debugfs_remove(intf->chipset_entry);
        debugfs_remove(intf->driver_entry);
        debugfs_remove(intf->driver_folder);
index 9bffe84..af25b01 100644 (file)
@@ -200,7 +200,7 @@ void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev)
         * here as they will fetch the next beacon directly prior to
         * transmission.
         */
-       if (test_bit(DRIVER_SUPPORT_PRE_TBTT_INTERRUPT, &rt2x00dev->flags))
+       if (test_bit(CAPABILITY_PRE_TBTT_INTERRUPT, &rt2x00dev->cap_flags))
                return;
 
        /* fetch next beacon */
@@ -271,7 +271,7 @@ void rt2x00lib_txdone(struct queue_entry *entry,
        /*
         * Remove L2 padding which was added during
         */
-       if (test_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags))
+       if (test_bit(REQUIRE_L2PAD, &rt2x00dev->cap_flags))
                rt2x00queue_remove_l2pad(entry->skb, header_length);
 
        /*
@@ -280,7 +280,7 @@ void rt2x00lib_txdone(struct queue_entry *entry,
         * mac80211 will expect the same data to be present it the
         * frame as it was passed to us.
         */
-       if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags))
+       if (test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags))
                rt2x00crypto_tx_insert_iv(entry->skb, header_length);
 
        /*
@@ -377,7 +377,7 @@ void rt2x00lib_txdone(struct queue_entry *entry,
         * send the status report back.
         */
        if (!(skbdesc_flags & SKBDESC_NOT_MAC80211)) {
-               if (test_bit(DRIVER_REQUIRE_TASKLET_CONTEXT, &rt2x00dev->flags))
+               if (test_bit(REQUIRE_TASKLET_CONTEXT, &rt2x00dev->cap_flags))
                        ieee80211_tx_status(rt2x00dev->hw, entry->skb);
                else
                        ieee80211_tx_status_ni(rt2x00dev->hw, entry->skb);
@@ -806,15 +806,15 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev)
        /*
         * Take TX headroom required for alignment into account.
         */
-       if (test_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags))
+       if (test_bit(REQUIRE_L2PAD, &rt2x00dev->cap_flags))
                rt2x00dev->hw->extra_tx_headroom += RT2X00_L2PAD_SIZE;
-       else if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags))
+       else if (test_bit(REQUIRE_DMA, &rt2x00dev->cap_flags))
                rt2x00dev->hw->extra_tx_headroom += RT2X00_ALIGN_SIZE;
 
        /*
         * Allocate tx status FIFO for driver use.
         */
-       if (test_bit(DRIVER_REQUIRE_TXSTATUS_FIFO, &rt2x00dev->flags)) {
+       if (test_bit(REQUIRE_TXSTATUS_FIFO, &rt2x00dev->cap_flags)) {
                /*
                 * Allocate the txstatus fifo. In the worst case the tx
                 * status fifo has to hold the tx status of all entries
index be0ff78..f316aad 100644 (file)
@@ -99,7 +99,7 @@ int rt2x00lib_load_firmware(struct rt2x00_dev *rt2x00dev)
 {
        int retval;
 
-       if (!test_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags))
+       if (!test_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags))
                return 0;
 
        if (!rt2x00dev->fw) {
index 88f2f92..bbee2cd 100644 (file)
@@ -416,13 +416,13 @@ static inline u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,
  */
 static inline void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev)
 {
-       if (test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags))
+       if (test_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags))
                wiphy_rfkill_start_polling(rt2x00dev->hw->wiphy);
 }
 
 static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev)
 {
-       if (test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags))
+       if (test_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags))
                wiphy_rfkill_stop_polling(rt2x00dev->hw->wiphy);
 }
 
index 128b361..ba0bb76 100644 (file)
@@ -383,7 +383,7 @@ static void rt2x00link_tuner(struct work_struct *work)
         * do not support link tuning at all, while other devices can disable
         * the feature from the EEPROM.
         */
-       if (test_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags))
+       if (test_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags))
                rt2x00dev->ops->lib->link_tuner(rt2x00dev, qual, link->count);
 
        /*
index 4a1c41b..4770156 100644 (file)
@@ -119,7 +119,7 @@ void rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
         * Use the ATIM queue if appropriate and present.
         */
        if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM &&
-           test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags))
+           test_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags))
                qid = QID_ATIM;
 
        queue = rt2x00queue_get_tx_queue(rt2x00dev, qid);
@@ -411,11 +411,11 @@ void rt2x00mac_configure_filter(struct ieee80211_hw *hw,
         * of different types, but has no a separate filter for PS Poll frames,
         * FIF_CONTROL flag implies FIF_PSPOLL.
         */
-       if (!test_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags)) {
+       if (!test_bit(CAPABILITY_CONTROL_FILTERS, &rt2x00dev->cap_flags)) {
                if (*total_flags & FIF_CONTROL || *total_flags & FIF_PSPOLL)
                        *total_flags |= FIF_CONTROL | FIF_PSPOLL;
        }
-       if (!test_bit(DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL, &rt2x00dev->flags)) {
+       if (!test_bit(CAPABILITY_CONTROL_FILTER_PSPOLL, &rt2x00dev->cap_flags)) {
                if (*total_flags & FIF_CONTROL)
                        *total_flags |= FIF_PSPOLL;
        }
@@ -496,7 +496,7 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 
        if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
                return 0;
-       else if (!test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags))
+       else if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags))
                return -EOPNOTSUPP;
        else if (key->keylen > 32)
                return -ENOSPC;
@@ -562,7 +562,7 @@ EXPORT_SYMBOL_GPL(rt2x00mac_set_key);
 void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw)
 {
        struct rt2x00_dev *rt2x00dev = hw->priv;
-       __set_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags);
+       set_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags);
        rt2x00link_stop_tuner(rt2x00dev);
 }
 EXPORT_SYMBOL_GPL(rt2x00mac_sw_scan_start);
@@ -570,7 +570,7 @@ EXPORT_SYMBOL_GPL(rt2x00mac_sw_scan_start);
 void rt2x00mac_sw_scan_complete(struct ieee80211_hw *hw)
 {
        struct rt2x00_dev *rt2x00dev = hw->priv;
-       __clear_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags);
+       clear_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags);
        rt2x00link_start_tuner(rt2x00dev);
 }
 EXPORT_SYMBOL_GPL(rt2x00mac_sw_scan_complete);
index 9fc4a1e..d03eef2 100644 (file)
@@ -60,7 +60,7 @@ struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry)
         * at least 8 bytes bytes available in headroom for IV/EIV
         * and 8 bytes for ICV data as tailroon.
         */
-       if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) {
+       if (test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags)) {
                head_size += 8;
                tail_size += 8;
        }
@@ -86,7 +86,7 @@ struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry)
        memset(skbdesc, 0, sizeof(*skbdesc));
        skbdesc->entry = entry;
 
-       if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags)) {
+       if (test_bit(REQUIRE_DMA, &rt2x00dev->cap_flags)) {
                skbdesc->skb_dma = dma_map_single(rt2x00dev->dev,
                                                  skb->data,
                                                  skb->len,
@@ -213,7 +213,7 @@ static void rt2x00queue_create_tx_descriptor_seq(struct queue_entry *entry,
 
        __set_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags);
 
-       if (!test_bit(DRIVER_REQUIRE_SW_SEQNO, &entry->queue->rt2x00dev->flags))
+       if (!test_bit(REQUIRE_SW_SEQNO, &entry->queue->rt2x00dev->cap_flags))
                return;
 
        /*
@@ -396,7 +396,7 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
        rt2x00crypto_create_tx_descriptor(entry, txdesc);
        rt2x00queue_create_tx_descriptor_seq(entry, txdesc);
 
-       if (test_bit(DRIVER_REQUIRE_HT_TX_DESC, &rt2x00dev->flags))
+       if (test_bit(REQUIRE_HT_TX_DESC, &rt2x00dev->cap_flags))
                rt2x00ht_create_tx_descriptor(entry, txdesc, hwrate);
        else
                rt2x00queue_create_tx_descriptor_plcp(entry, txdesc, hwrate);
@@ -436,7 +436,7 @@ static int rt2x00queue_write_tx_data(struct queue_entry *entry,
        /*
         * Map the skb to DMA.
         */
-       if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags))
+       if (test_bit(REQUIRE_DMA, &rt2x00dev->cap_flags))
                rt2x00queue_map_txskb(entry);
 
        return 0;
@@ -529,7 +529,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
         */
        if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc.flags) &&
            !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc.flags)) {
-               if (test_bit(DRIVER_REQUIRE_COPY_IV, &queue->rt2x00dev->flags))
+               if (test_bit(REQUIRE_COPY_IV, &queue->rt2x00dev->cap_flags))
                        rt2x00crypto_tx_copy_iv(skb, &txdesc);
                else
                        rt2x00crypto_tx_remove_iv(skb, &txdesc);
@@ -543,9 +543,9 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
         * PCI and USB devices, while header alignment only is valid
         * for PCI devices.
         */
-       if (test_bit(DRIVER_REQUIRE_L2PAD, &queue->rt2x00dev->flags))
+       if (test_bit(REQUIRE_L2PAD, &queue->rt2x00dev->cap_flags))
                rt2x00queue_insert_l2pad(entry->skb, txdesc.header_length);
-       else if (test_bit(DRIVER_REQUIRE_DMA, &queue->rt2x00dev->flags))
+       else if (test_bit(REQUIRE_DMA, &queue->rt2x00dev->cap_flags))
                rt2x00queue_align_frame(entry->skb);
 
        /*
@@ -1069,7 +1069,7 @@ int rt2x00queue_initialize(struct rt2x00_dev *rt2x00dev)
        if (status)
                goto exit;
 
-       if (test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags)) {
+       if (test_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags)) {
                status = rt2x00queue_alloc_entries(rt2x00dev->atim,
                                                   rt2x00dev->ops->atim);
                if (status)
@@ -1121,7 +1121,7 @@ int rt2x00queue_allocate(struct rt2x00_dev *rt2x00dev)
        struct data_queue *queue;
        enum data_queue_qid qid;
        unsigned int req_atim =
-           !!test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags);
+           !!test_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags);
 
        /*
         * We need the following queues:
index fbe735f..94047e9 100644 (file)
@@ -387,7 +387,7 @@ static void rt2x00usb_flush_entry(struct queue_entry *entry)
         * Kill guardian urb (if required by driver).
         */
        if ((entry->queue->qid == QID_BEACON) &&
-           (test_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags)))
+           (test_bit(REQUIRE_BEACON_GUARD, &rt2x00dev->cap_flags)))
                usb_kill_urb(bcn_priv->guardian_urb);
 }
 
@@ -583,7 +583,7 @@ static int rt2x00usb_alloc_entries(struct data_queue *queue)
         * then we are done.
         */
        if (queue->qid != QID_BEACON ||
-           !test_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags))
+           !test_bit(REQUIRE_BEACON_GUARD, &rt2x00dev->cap_flags))
                return 0;
 
        for (i = 0; i < queue->limit; i++) {
@@ -618,7 +618,7 @@ static void rt2x00usb_free_entries(struct data_queue *queue)
         * then we are done.
         */
        if (queue->qid != QID_BEACON ||
-           !test_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags))
+           !test_bit(REQUIRE_BEACON_GUARD, &rt2x00dev->cap_flags))
                return;
 
        for (i = 0; i < queue->limit; i++) {
index 8ee1514..c16c150 100644 (file)
@@ -683,7 +683,7 @@ static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev,
 
        rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, rt2x00_rf(rt2x00dev, RF2529));
        rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END,
-                         !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags));
+                         !test_bit(CAPABILITY_FRAME_TYPE, &rt2x00dev->cap_flags));
 
        /*
         * Configure the RX antenna.
@@ -811,10 +811,10 @@ static void rt61pci_config_ant(struct rt2x00_dev *rt2x00dev,
 
        if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
                sel = antenna_sel_a;
-               lna = test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags);
+               lna = test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags);
        } else {
                sel = antenna_sel_bg;
-               lna = test_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags);
+               lna = test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags);
        }
 
        for (i = 0; i < ARRAY_SIZE(antenna_sel_a); i++)
@@ -834,7 +834,7 @@ static void rt61pci_config_ant(struct rt2x00_dev *rt2x00dev,
        else if (rt2x00_rf(rt2x00dev, RF2527))
                rt61pci_config_antenna_2x(rt2x00dev, ant);
        else if (rt2x00_rf(rt2x00dev, RF2529)) {
-               if (test_bit(CONFIG_DOUBLE_ANTENNA, &rt2x00dev->flags))
+               if (test_bit(CAPABILITY_DOUBLE_ANTENNA, &rt2x00dev->cap_flags))
                        rt61pci_config_antenna_2x(rt2x00dev, ant);
                else
                        rt61pci_config_antenna_2529(rt2x00dev, ant);
@@ -848,13 +848,13 @@ static void rt61pci_config_lna_gain(struct rt2x00_dev *rt2x00dev,
        short lna_gain = 0;
 
        if (libconf->conf->channel->band == IEEE80211_BAND_2GHZ) {
-               if (test_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags))
+               if (test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags))
                        lna_gain += 14;
 
                rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_OFFSET_BG, &eeprom);
                lna_gain -= rt2x00_get_field16(eeprom, EEPROM_RSSI_OFFSET_BG_1);
        } else {
-               if (test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags))
+               if (test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags))
                        lna_gain += 14;
 
                rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_OFFSET_A, &eeprom);
@@ -1050,14 +1050,14 @@ static void rt61pci_link_tuner(struct rt2x00_dev *rt2x00dev,
        if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
                low_bound = 0x28;
                up_bound = 0x48;
-               if (test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags)) {
+               if (test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags)) {
                        low_bound += 0x10;
                        up_bound += 0x10;
                }
        } else {
                low_bound = 0x20;
                up_bound = 0x40;
-               if (test_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags)) {
+               if (test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags)) {
                        low_bound += 0x10;
                        up_bound += 0x10;
                }
@@ -2537,7 +2537,7 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
         * Determine number of antennas.
         */
        if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_NUM) == 2)
-               __set_bit(CONFIG_DOUBLE_ANTENNA, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_DOUBLE_ANTENNA, &rt2x00dev->cap_flags);
 
        /*
         * Identify default antenna configuration.
@@ -2551,20 +2551,20 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
         * Read the Frame type.
         */
        if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_FRAME_TYPE))
-               __set_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_FRAME_TYPE, &rt2x00dev->cap_flags);
 
        /*
         * Detect if this device has a hardware controlled radio.
         */
        if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
-               __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags);
 
        /*
         * Read frequency offset and RF programming sequence.
         */
        rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom);
        if (rt2x00_get_field16(eeprom, EEPROM_FREQ_SEQ))
-               __set_bit(CONFIG_RF_SEQUENCE, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_RF_SEQUENCE, &rt2x00dev->cap_flags);
 
        rt2x00dev->freq_offset = rt2x00_get_field16(eeprom, EEPROM_FREQ_OFFSET);
 
@@ -2574,9 +2574,9 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
        rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom);
 
        if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_A))
-               __set_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags);
        if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_BG))
-               __set_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags);
 
        /*
         * When working with a RF2529 chip without double antenna,
@@ -2584,7 +2584,7 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
         * eeprom word.
         */
        if (rt2x00_rf(rt2x00dev, RF2529) &&
-           !test_bit(CONFIG_DOUBLE_ANTENNA, &rt2x00dev->flags)) {
+           !test_bit(CAPABILITY_DOUBLE_ANTENNA, &rt2x00dev->cap_flags)) {
                rt2x00dev->default_ant.rx =
                    ANTENNA_A + rt2x00_get_field16(eeprom, EEPROM_NIC_RX_FIXED);
                rt2x00dev->default_ant.tx =
@@ -2799,7 +2799,7 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
        spec->supported_bands = SUPPORT_BAND_2GHZ;
        spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
 
-       if (!test_bit(CONFIG_RF_SEQUENCE, &rt2x00dev->flags)) {
+       if (!test_bit(CAPABILITY_RF_SEQUENCE, &rt2x00dev->cap_flags)) {
                spec->num_channels = 14;
                spec->channels = rf_vals_noseq;
        } else {
@@ -2869,16 +2869,16 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev)
         * This device has multiple filters for control frames,
         * but has no a separate filter for PS Poll frames.
         */
-       __set_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags);
+       __set_bit(CAPABILITY_CONTROL_FILTERS, &rt2x00dev->cap_flags);
 
        /*
         * This device requires firmware and DMA mapped skbs.
         */
-       __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
-       __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags);
+       __set_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags);
+       __set_bit(REQUIRE_DMA, &rt2x00dev->cap_flags);
        if (!modparam_nohwcrypt)
-               __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags);
-       __set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags);
+       __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags);
 
        /*
         * Set the rssi offset.
index 6593059..cdb026d 100644 (file)
@@ -595,7 +595,7 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
        switch (ant->rx) {
        case ANTENNA_HW_DIVERSITY:
                rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 2);
-               temp = !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags)
+               temp = !test_bit(CAPABILITY_FRAME_TYPE, &rt2x00dev->cap_flags)
                       && (rt2x00dev->curr_band != IEEE80211_BAND_5GHZ);
                rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, temp);
                break;
@@ -636,7 +636,7 @@ static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev,
 
        rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 0);
        rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END,
-                         !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags));
+                         !test_bit(CAPABILITY_FRAME_TYPE, &rt2x00dev->cap_flags));
 
        /*
         * Configure the RX antenna.
@@ -709,10 +709,10 @@ static void rt73usb_config_ant(struct rt2x00_dev *rt2x00dev,
 
        if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
                sel = antenna_sel_a;
-               lna = test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags);
+               lna = test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags);
        } else {
                sel = antenna_sel_bg;
-               lna = test_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags);
+               lna = test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags);
        }
 
        for (i = 0; i < ARRAY_SIZE(antenna_sel_a); i++)
@@ -740,7 +740,7 @@ static void rt73usb_config_lna_gain(struct rt2x00_dev *rt2x00dev,
        short lna_gain = 0;
 
        if (libconf->conf->channel->band == IEEE80211_BAND_2GHZ) {
-               if (test_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags))
+               if (test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags))
                        lna_gain += 14;
 
                rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_OFFSET_BG, &eeprom);
@@ -930,7 +930,7 @@ static void rt73usb_link_tuner(struct rt2x00_dev *rt2x00dev,
                low_bound = 0x28;
                up_bound = 0x48;
 
-               if (test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags)) {
+               if (test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags)) {
                        low_bound += 0x10;
                        up_bound += 0x10;
                }
@@ -946,7 +946,7 @@ static void rt73usb_link_tuner(struct rt2x00_dev *rt2x00dev,
                        up_bound = 0x1c;
                }
 
-               if (test_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags)) {
+               if (test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags)) {
                        low_bound += 0x14;
                        up_bound += 0x10;
                }
@@ -1661,7 +1661,7 @@ static int rt73usb_agc_to_rssi(struct rt2x00_dev *rt2x00dev, int rxd_w1)
        }
 
        if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
-               if (test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags)) {
+               if (test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags)) {
                        if (lna == 3 || lna == 2)
                                offset += 10;
                } else {
@@ -1899,13 +1899,13 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
         * Read the Frame type.
         */
        if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_FRAME_TYPE))
-               __set_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_FRAME_TYPE, &rt2x00dev->cap_flags);
 
        /*
         * Detect if this device has an hardware controlled radio.
         */
        if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
-               __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags);
 
        /*
         * Read frequency offset.
@@ -1919,8 +1919,8 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
        rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom);
 
        if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA)) {
-               __set_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags);
-               __set_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags);
+               __set_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags);
        }
 
        /*
@@ -2200,15 +2200,15 @@ static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev)
         * This device has multiple filters for control frames,
         * but has no a separate filter for PS Poll frames.
         */
-       __set_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags);
+       __set_bit(CAPABILITY_CONTROL_FILTERS, &rt2x00dev->cap_flags);
 
        /*
         * This device requires firmware.
         */
-       __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
+       __set_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags);
        if (!modparam_nohwcrypt)
-               __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags);
-       __set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags);
+               __set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags);
+       __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags);
 
        /*
         * Set the rssi offset.