linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <lrodriguez@atheros.com>
To: <linville@tuxdriver.com>
Cc: <linux-wireless@vger.kernel.org>, <ath9k-devel@lists.ath9k.org>,
	"Luis R. Rodriguez" <lrodriguez@atheros.com>
Subject: [PATCH 07/24] ath9k: call hw initializer directly
Date: Mon, 3 Aug 2009 12:24:39 -0700	[thread overview]
Message-ID: <1249327496-24629-8-git-send-email-lrodriguez@atheros.com> (raw)
In-Reply-To: <1249327496-24629-1-git-send-email-lrodriguez@atheros.com>

ath9k_hw_attach() was going first through some device id verifier,
and then calling some other helper which was doing the real hardware
initialization. Lets just do the devid checks within the real worker
by calling a helper ath9k_hw_devid_supported().

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath/ath9k/hw.c |   48 +++++++++++++++++++----------------
 1 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index ff2875b..d8ae289 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -608,12 +608,35 @@ static int ath9k_hw_post_attach(struct ath_hw *ah)
 	return 0;
 }
 
-static int ath9k_hw_do_attach(struct ath_hw *ah,
-			      struct ath_softc *sc)
+static bool ath9k_hw_devid_supported(u16 devid)
+{
+	switch (devid) {
+	case AR5416_DEVID_PCI:
+	case AR5416_DEVID_PCIE:
+	case AR5416_AR9100_DEVID:
+	case AR9160_DEVID_PCI:
+	case AR9280_DEVID_PCI:
+	case AR9280_DEVID_PCIE:
+	case AR9285_DEVID_PCIE:
+	case AR5416_DEVID_AR9287_PCI:
+	case AR5416_DEVID_AR9287_PCIE:
+		return true;
+	default:
+		break;
+	}
+	return false;
+}
+
+int ath9k_hw_attach(struct ath_hw *ah, struct ath_softc *sc)
 {
 	int r;
 	u32 i, j;
 
+	if (!ath9k_hw_devid_supported(ah->hw_version.devid)) {
+		r = -EOPNOTSUPP;
+		goto bad;
+	}
+
 	ath9k_hw_newstate(ah);
 	ath9k_hw_set_defaults(ah);
 
@@ -1183,25 +1206,6 @@ void ath9k_hw_detach(struct ath_hw *ah)
 	kfree(ah);
 }
 
-int ath9k_hw_attach(struct ath_hw *ah, struct ath_softc *sc)
-{
-	switch (ah->hw_version.devid) {
-	case AR5416_DEVID_PCI:
-	case AR5416_DEVID_PCIE:
-	case AR5416_AR9100_DEVID:
-	case AR9160_DEVID_PCI:
-	case AR9280_DEVID_PCI:
-	case AR9280_DEVID_PCIE:
-	case AR9285_DEVID_PCIE:
-	case AR5416_DEVID_AR9287_PCI:
-	case AR5416_DEVID_AR9287_PCIE:
-		return ath9k_hw_do_attach(ah, sc);
-	default:
-		break;
-	}
-	return -EOPNOTSUPP;
-}
-
 /*******/
 /* INI */
 /*******/
@@ -2898,7 +2902,7 @@ void ath9k_hw_configpcipowersave(struct ath_hw *ah, int restore)
 		/*
 		 * AR9280 2.0 or later chips use SerDes values from the
 		 * initvals.h initialized depending on chipset during
-		 * ath9k_hw_do_attach()
+		 * ath9k_hw_attach()
 		 */
 		for (i = 0; i < ah->iniPcieSerdes.ia_rows; i++) {
 			REG_WRITE(ah, INI_RA(&ah->iniPcieSerdes, i, 0),
-- 
1.6.3.3


  parent reply	other threads:[~2009-08-03 19:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 01/24] ath9k: remove usage of AR_SREV_*() wrapper to detect supported hw Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 02/24] ath9k: use a switch for revising supported hw mac revisions Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 03/24] ath9k: propagate hw initialization errors Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 04/24] ath9k: move memory allocation of ath_hw to ath_init() Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 05/24] ath9k: move devid cache setting " Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 06/24] ath9k: move cache setting of softc ah prior to attach Luis R. Rodriguez
2009-08-03 19:24 ` Luis R. Rodriguez [this message]
2009-08-03 19:24 ` [PATCH 09/24] ath9k: move hw macrevision checker to helper Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 10/24] ath9k: rename ath9k_hw_newstate() to ath9k_hw_init_defaults() Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 11/24] ath9k: rename ath9k_hw_set_defaults() to ath9k_hw_init_config() Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 12/24] ath9k: remove debug message for no memoery on ath_init() Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 13/24] ath9k: break up hw initialization into a few more helpers Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 14/24] ath9k: describe hw initialization better Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 15/24] ath9k: distinguish between device initialization and ath_softc init Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 16/24] ath9k: remove !NULL check before kfree() Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 17/24] ath9k: use helper macro to kfree and nullify on ath9k_hw_rfdetach() Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 18/24] ath9k: rename ath9k_hw_rfdetach() to ath9k_hw_rf_free() Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 19/24] ath9k: rename ath9k_hw_ani_detach() to ath9k_hw_ani_disable() Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 20/24] ath9k: set ah to null after freeing Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 21/24] ath9k: set sc->sc_ah to NULL after freeing it Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 22/24] ath9k: call ath9k_hw_detach() once upon hw init failure Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 23/24] ath9k: remove dangling error check on keycache reset on hw init Luis R. Rodriguez
2009-08-03 19:24 ` [PATCH 24/24] ath9k: remove spurious check for channel on keycache reset Luis R. Rodriguez

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=1249327496-24629-8-git-send-email-lrodriguez@atheros.com \
    --to=lrodriguez@atheros.com \
    --cc=ath9k-devel@lists.ath9k.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /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).