linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: Gertjan van Wingerde <gwingerde@gmail.com>,
	Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
	Ivo van Doorn <ivdoorn@gmail.com>
Subject: [PATCH 5/9] rt2800: prepare for rt2800*_probe_hw_mode() unification
Date: Sun, 08 Nov 2009 14:39:25 +0100	[thread overview]
Message-ID: <20091108133925.23584.37879.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20091108133854.23584.86842.sendpatchset@localhost.localdomain>

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] rt2800: prepare for rt2800*_probe_hw_mode() unification

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>
---
 drivers/net/wireless/rt2x00/rt2800pci.c |   24 ++++++++++++++----------
 drivers/net/wireless/rt2x00/rt2800usb.c |   19 ++++++++++++-------
 2 files changed, 26 insertions(+), 17 deletions(-)

Index: b/drivers/net/wireless/rt2x00/rt2800pci.c
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -1175,6 +1175,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;
@@ -1190,7 +1191,9 @@ static int rt2800pci_probe_hw_mode(struc
 	    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,
@@ -1205,17 +1208,18 @@ static int rt2800pci_probe_hw_mode(struc
 	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: b/drivers/net/wireless/rt2x00/rt2800usb.c
===================================================================
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -770,6 +770,7 @@ static const struct rf_channel rf_vals_3
 
 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(struc
 	    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(struc
 	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;
 	}

  parent reply	other threads:[~2009-11-08 13:39 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-08 13:38 [PATCH 1/9] rt2800: prepare for unification of EEPROM support code Bartlomiej Zolnierkiewicz
2009-11-08 13:39 ` [PATCH 2/9] rt2800: unify " Bartlomiej Zolnierkiewicz
2009-11-08 13:51   ` Ivo van Doorn
2009-11-08 14:19   ` Gertjan van Wingerde
2009-11-08 13:39 ` [PATCH 3/9] rt2800pci: add missing RF values to rf_vals table Bartlomiej Zolnierkiewicz
2009-11-08 13:51   ` Ivo van Doorn
2009-11-08 14:20   ` Gertjan van Wingerde
2009-11-08 13:39 ` [PATCH 4/9] rt2800usb: reorganize code in rt2800usb_probe_hw_mode() Bartlomiej Zolnierkiewicz
2009-11-08 13:52   ` Ivo van Doorn
2009-11-08 14:20   ` Gertjan van Wingerde
2009-11-08 13:39 ` Bartlomiej Zolnierkiewicz [this message]
2009-11-08 13:53   ` [PATCH 5/9] rt2800: prepare for rt2800*_probe_hw_mode() unification Ivo van Doorn
2009-11-08 14:35   ` Gertjan van Wingerde
2009-11-08 17:48     ` Bartlomiej Zolnierkiewicz
2009-11-08 19:09       ` Gertjan van Wingerde
2009-11-08 13:39 ` [PATCH 6/9] rt2800: unify rt2800*_probe_hw_mode() Bartlomiej Zolnierkiewicz
2009-11-08 13:53   ` Ivo van Doorn
2009-11-08 14:36   ` Gertjan van Wingerde
2009-11-08 13:39 ` [PATCH 7/9] rt2800usb: fix RX descriptor naming Bartlomiej Zolnierkiewicz
2009-11-08 13:54   ` Ivo van Doorn
2009-11-08 14:37   ` Gertjan van Wingerde
2009-11-08 13:39 ` [PATCH 8/9] rt2800: add eFuse EEPROM support code to rt2800lib Bartlomiej Zolnierkiewicz
2009-11-08 13:55   ` Ivo van Doorn
2009-11-08 17:34     ` Bartlomiej Zolnierkiewicz
2009-11-08 18:08       ` Ivo van Doorn
2009-11-08 18:13         ` Bartlomiej Zolnierkiewicz
2009-11-08 18:27           ` Ivo van Doorn
2009-11-08 18:32             ` Bartlomiej Zolnierkiewicz
2009-11-08 18:40               ` Ivo van Doorn
2009-11-08 18:47                 ` Bartlomiej Zolnierkiewicz
2009-11-08 19:14                   ` Kalle Valo
2009-11-08 19:21                   ` Bartlomiej Zolnierkiewicz
2009-11-08 19:35                     ` Ivo van Doorn
2009-11-08 19:38                       ` Bartlomiej Zolnierkiewicz
2009-11-08 19:25                   ` Ivo van Doorn
2009-11-08 19:34                     ` Bartlomiej Zolnierkiewicz
2009-11-08 14:38   ` Gertjan van Wingerde
2009-11-08 13:39 ` [PATCH 9/9] rt2800usb: add eFuse EEPROM support Bartlomiej Zolnierkiewicz
2009-11-08 13:56   ` Ivo van Doorn
2009-11-08 14:41   ` Gertjan van Wingerde
2009-11-08 13:50 ` [PATCH 1/9] rt2800: prepare for unification of EEPROM support code Ivo van Doorn
2009-11-08 14:16 ` Gertjan van Wingerde
2009-11-08 17:41   ` Bartlomiej Zolnierkiewicz
2009-11-08 19:07     ` Gertjan van Wingerde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091108133925.23584.37879.sendpatchset@localhost.localdomain \
    --to=bzolnier@gmail.com \
    --cc=gwingerde@gmail.com \
    --cc=ivdoorn@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).