]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
rt2800: prepare for rt2800*_probe_hw_mode() unification
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sun, 8 Nov 2009 13:39:25 +0000 (14:39 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 11 Nov 2009 22:09:14 +0000 (17:09 -0500)
Enclose interface specific code in rt2800[pci,usb]_probe_hw_mode()
with rt2x00_intf_is_[pci,usb]() checks.

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

index f9ab3726d7f84a08f83b44d5959ffb59e395a5b7..c60779069508f76c9b4b9cbd17d1fff400b09e84 100644 (file)
@@ -1189,6 +1189,7 @@ static const struct rf_channel rf_vals[] = {
 
 static int rt2800pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 {
+       struct rt2x00_chip *chip = &rt2x00dev->chip;
        struct hw_mode_spec *spec = &rt2x00dev->spec;
        struct channel_info *info;
        char *tx_power1;
@@ -1204,7 +1205,9 @@ static int rt2800pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
            IEEE80211_HW_SIGNAL_DBM |
            IEEE80211_HW_SUPPORTS_PS |
            IEEE80211_HW_PS_NULLFUNC_STACK;
-       rt2x00dev->hw->extra_tx_headroom = TXWI_DESC_SIZE;
+
+       if (rt2x00_intf_is_pci(rt2x00dev))
+               rt2x00dev->hw->extra_tx_headroom = TXWI_DESC_SIZE;
 
        SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
        SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
@@ -1219,17 +1222,18 @@ static int rt2800pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
        spec->supported_bands = SUPPORT_BAND_2GHZ;
        spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
 
-       if (rt2x00_rf(&rt2x00dev->chip, RF2820) ||
-           rt2x00_rf(&rt2x00dev->chip, RF2720) ||
-           rt2x00_rf(&rt2x00dev->chip, RF3020) ||
-           rt2x00_rf(&rt2x00dev->chip, RF3021) ||
-           rt2x00_rf(&rt2x00dev->chip, RF3022) ||
-           rt2x00_rf(&rt2x00dev->chip, RF2020) ||
-           rt2x00_rf(&rt2x00dev->chip, RF3052)) {
+       if (rt2x00_rf(chip, RF2820) ||
+           rt2x00_rf(chip, RF2720) ||
+           (rt2x00_intf_is_pci(rt2x00dev) &&
+            (rt2x00_rf(chip, RF3020) ||
+             rt2x00_rf(chip, RF3021) ||
+             rt2x00_rf(chip, RF3022) ||
+             rt2x00_rf(chip, RF2020) ||
+             rt2x00_rf(chip, RF3052)))) {
                spec->num_channels = 14;
                spec->channels = rf_vals;
-       } else if (rt2x00_rf(&rt2x00dev->chip, RF2850) ||
-                  rt2x00_rf(&rt2x00dev->chip, RF2750)) {
+       } else if (rt2x00_rf(chip, RF2850) ||
+                  rt2x00_rf(chip, RF2750)) {
                spec->supported_bands |= SUPPORT_BAND_5GHZ;
                spec->num_channels = ARRAY_SIZE(rf_vals);
                spec->channels = rf_vals;
index 36acb384f3287a3b05889f068d1683dd0e778e7b..e86858a0e196722058a0091f9c1c471fa490457c 100644 (file)
@@ -770,6 +770,7 @@ static const struct rf_channel rf_vals_3070[] = {
 
 static int rt2800usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 {
+       struct rt2x00_chip *chip = &rt2x00dev->chip;
        struct hw_mode_spec *spec = &rt2x00dev->spec;
        struct channel_info *info;
        char *tx_power1;
@@ -785,7 +786,10 @@ static int rt2800usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
            IEEE80211_HW_SIGNAL_DBM |
            IEEE80211_HW_SUPPORTS_PS |
            IEEE80211_HW_PS_NULLFUNC_STACK;
-       rt2x00dev->hw->extra_tx_headroom = TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
+
+       if (rt2x00_intf_is_usb(rt2x00dev))
+               rt2x00dev->hw->extra_tx_headroom =
+                       TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
 
        SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
        SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
@@ -800,17 +804,18 @@ static int rt2800usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
        spec->supported_bands = SUPPORT_BAND_2GHZ;
        spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
 
-       if (rt2x00_rf(&rt2x00dev->chip, RF2820) ||
-           rt2x00_rf(&rt2x00dev->chip, RF2720)) {
+       if (rt2x00_rf(chip, RF2820) ||
+           rt2x00_rf(chip, RF2720)) {
                spec->num_channels = 14;
                spec->channels = rf_vals;
-       } else if (rt2x00_rf(&rt2x00dev->chip, RF2850) ||
-                  rt2x00_rf(&rt2x00dev->chip, RF2750)) {
+       } else if (rt2x00_rf(chip, RF2850) ||
+                  rt2x00_rf(chip, RF2750)) {
                spec->supported_bands |= SUPPORT_BAND_5GHZ;
                spec->num_channels = ARRAY_SIZE(rf_vals);
                spec->channels = rf_vals;
-       } else if (rt2x00_rf(&rt2x00dev->chip, RF3020) ||
-                  rt2x00_rf(&rt2x00dev->chip, RF2020)) {
+       } else if (rt2x00_intf_is_usb(rt2x00dev) &&
+                   (rt2x00_rf(chip, RF3020) ||
+                    rt2x00_rf(chip, RF2020))) {
                spec->num_channels = ARRAY_SIZE(rf_vals_3070);
                spec->channels = rf_vals_3070;
        }