rt2x00: Let RF chipset decide the RF channel switch method to use in rt2800.
authorGertjan van Wingerde <gwingerde@gmail.com>
Sun, 11 Apr 2010 12:31:07 +0000 (14:31 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 12 Apr 2010 19:22:10 +0000 (15:22 -0400)
It seems that the distinction between RF channel switch method is solely based
on the RF chipset that is used.
Refactor the channel switch decision to just take the RF chipset into account,
thereby greatly simplifying the check.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2800lib.c

index ec3ec786f3501e4ad3e44f936de8d51aac89a1e4..6fdec1536db7787e070ce0256089a7fed118a5be 100644 (file)
@@ -717,10 +717,10 @@ static void rt2800_config_lna_gain(struct rt2x00_dev *rt2x00dev,
        rt2x00dev->lna_gain = lna_gain;
 }
 
-static void rt2800_config_channel_rt2x(struct rt2x00_dev *rt2x00dev,
-                                      struct ieee80211_conf *conf,
-                                      struct rf_channel *rf,
-                                      struct channel_info *info)
+static void rt2800_config_channel_rf2xxx(struct rt2x00_dev *rt2x00dev,
+                                        struct ieee80211_conf *conf,
+                                        struct rf_channel *rf,
+                                        struct channel_info *info)
 {
        rt2x00_set_field32(&rf->rf4, RF4_FREQ_OFFSET, rt2x00dev->freq_offset);
 
@@ -786,10 +786,10 @@ static void rt2800_config_channel_rt2x(struct rt2x00_dev *rt2x00dev,
        rt2800_rf_write(rt2x00dev, 4, rf->rf4);
 }
 
-static void rt2800_config_channel_rt3x(struct rt2x00_dev *rt2x00dev,
-                                      struct ieee80211_conf *conf,
-                                      struct rf_channel *rf,
-                                      struct channel_info *info)
+static void rt2800_config_channel_rf3xxx(struct rt2x00_dev *rt2x00dev,
+                                        struct ieee80211_conf *conf,
+                                        struct rf_channel *rf,
+                                        struct channel_info *info)
 {
        u8 rfcsr;
 
@@ -826,16 +826,13 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
        unsigned int tx_pin;
        u8 bbp;
 
-       if ((rt2x00_rt(rt2x00dev, RT3070) ||
-            rt2x00_rt(rt2x00dev, RT3090) ||
-            rt2x00_rt(rt2x00dev, RT2872)) &&
-           (rt2x00_rf(rt2x00dev, RF2020) ||
-            rt2x00_rf(rt2x00dev, RF3020) ||
-            rt2x00_rf(rt2x00dev, RF3021) ||
-            rt2x00_rf(rt2x00dev, RF3022)))
-               rt2800_config_channel_rt3x(rt2x00dev, conf, rf, info);
+       if (rt2x00_rf(rt2x00dev, RF2020) ||
+           rt2x00_rf(rt2x00dev, RF3020) ||
+           rt2x00_rf(rt2x00dev, RF3021) ||
+           rt2x00_rf(rt2x00dev, RF3022))
+               rt2800_config_channel_rf3xxx(rt2x00dev, conf, rf, info);
        else
-               rt2800_config_channel_rt2x(rt2x00dev, conf, rf, info);
+               rt2800_config_channel_rf2xxx(rt2x00dev, conf, rf, info);
 
        /*
         * Change BBP settings