linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/24] ath9k: hw initiazliation cleanup
@ 2009-08-03 19:24 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
                   ` (22 more replies)
  0 siblings, 23 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

This series consists of a few hardware initialization cleanups
and small fixups. This goal was to make hardware initialization
easier to read but also make it easier to add support for new
hardware. The small fixups just came along the way.

Luis R. Rodriguez (24):
  ath9k: remove usage of AR_SREV_*() wrapper to detect supported hw
  ath9k: use a switch for revising supported hw mac revisions
  ath9k: propagate hw initialization errors
  ath9k: move memory allocation of ath_hw to ath_init()
  ath9k: move devid cache setting to ath_init()
  ath9k: move cache setting of softc ah prior to attach
  ath9k: call hw initializer directly
  ath9k: pass only one argument to hw attach
  ath9k: move hw macrevision checker to helper
  ath9k: rename ath9k_hw_newstate() to ath9k_hw_init_defaults()
  ath9k: rename  ath9k_hw_set_defaults() to ath9k_hw_init_config()
  ath9k: remove debug message for no memoery on ath_init()
  ath9k: break up hw initialization into a few more helpers
  ath9k: describe hw initialization better
  ath9k: distinguish between device initialization and ath_softc init
  ath9k: remove !NULL check before kfree()
  ath9k: use helper macro to kfree and nullify on ath9k_hw_rfdetach()
  ath9k: rename ath9k_hw_rfdetach() to ath9k_hw_rf_free()
  ath9k: rename ath9k_hw_ani_detach() to ath9k_hw_ani_disable()
  ath9k: set ah to null after freeing
  ath9k: set sc->sc_ah to NULL after freeing it
  ath9k: call ath9k_hw_detach() once upon hw init failure
  ath9k: remove dangling error check on keycache reset on hw init
  ath9k: remove spurious check for channel on keycache reset

 drivers/net/wireless/ath/ath9k/ahb.c    |    2 +-
 drivers/net/wireless/ath/ath9k/ani.c    |    6 +-
 drivers/net/wireless/ath/ath9k/ani.h    |    4 +-
 drivers/net/wireless/ath/ath9k/ath9k.h  |    2 +-
 drivers/net/wireless/ath/ath9k/eeprom.c |    2 +-
 drivers/net/wireless/ath/ath9k/eeprom.h |    2 +-
 drivers/net/wireless/ath/ath9k/hw.c     |  259 +++++++++++++++----------------
 drivers/net/wireless/ath/ath9k/hw.h     |    6 +-
 drivers/net/wireless/ath/ath9k/main.c   |   59 +++++---
 drivers/net/wireless/ath/ath9k/pci.c    |    2 +-
 drivers/net/wireless/ath/ath9k/phy.c    |   53 ++-----
 11 files changed, 195 insertions(+), 202 deletions(-)


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 01/24] ath9k: remove usage of AR_SREV_*() wrapper to detect supported hw
  2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
@ 2009-08-03 19:24 ` Luis R. Rodriguez
  2009-08-03 19:24 ` [PATCH 02/24] ath9k: use a switch for revising supported hw mac revisions Luis R. Rodriguez
                   ` (21 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

We will clean this up next to just use a switch.

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

diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 7a0a6ae..e0bc4c5 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -665,8 +665,10 @@ static struct ath_hw *ath9k_hw_do_attach(u16 devid, struct ath_softc *sc,
 	if ((ah->hw_version.macVersion != AR_SREV_VERSION_5416_PCI) &&
 	    (ah->hw_version.macVersion != AR_SREV_VERSION_5416_PCIE) &&
 	    (ah->hw_version.macVersion != AR_SREV_VERSION_9160) &&
-	    (!AR_SREV_9100(ah)) && (!AR_SREV_9280(ah)) &&
-	    (!AR_SREV_9285(ah)) && (!AR_SREV_9287(ah))) {
+	    (ah->hw_version.macVersion != AR_SREV_VERSION_9100) &&
+	    (ah->hw_version.macVersion != AR_SREV_VERSION_9280) &&
+	    (ah->hw_version.macVersion != AR_SREV_VERSION_9285) &&
+	    (ah->hw_version.macVersion != AR_SREV_VERSION_9287)) {
 		DPRINTF(sc, ATH_DBG_FATAL,
 			"Mac Chip Rev 0x%02x.%x is not supported by "
 			"this driver\n", ah->hw_version.macVersion,
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 02/24] ath9k: use a switch for revising supported hw mac revisions
  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 ` Luis R. Rodriguez
  2009-08-03 19:24 ` [PATCH 03/24] ath9k: propagate hw initialization errors Luis R. Rodriguez
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

This makes adding new hw revisions a one line change here.

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

diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index e0bc4c5..8228f41 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -662,13 +662,16 @@ static struct ath_hw *ath9k_hw_do_attach(u16 devid, struct ath_softc *sc,
 	DPRINTF(sc, ATH_DBG_RESET, "serialize_regmode is %d\n",
 		ah->config.serialize_regmode);
 
-	if ((ah->hw_version.macVersion != AR_SREV_VERSION_5416_PCI) &&
-	    (ah->hw_version.macVersion != AR_SREV_VERSION_5416_PCIE) &&
-	    (ah->hw_version.macVersion != AR_SREV_VERSION_9160) &&
-	    (ah->hw_version.macVersion != AR_SREV_VERSION_9100) &&
-	    (ah->hw_version.macVersion != AR_SREV_VERSION_9280) &&
-	    (ah->hw_version.macVersion != AR_SREV_VERSION_9285) &&
-	    (ah->hw_version.macVersion != AR_SREV_VERSION_9287)) {
+	switch (ah->hw_version.macVersion) {
+	case AR_SREV_VERSION_5416_PCI:
+	case AR_SREV_VERSION_5416_PCIE:
+	case AR_SREV_VERSION_9160:
+	case AR_SREV_VERSION_9100:
+	case AR_SREV_VERSION_9280:
+	case AR_SREV_VERSION_9285:
+	case AR_SREV_VERSION_9287:
+		break;
+	default:
 		DPRINTF(sc, ATH_DBG_FATAL,
 			"Mac Chip Rev 0x%02x.%x is not supported by "
 			"this driver\n", ah->hw_version.macVersion,
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 03/24] ath9k: propagate hw initialization errors
  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 ` Luis R. Rodriguez
  2009-08-03 19:24 ` [PATCH 04/24] ath9k: move memory allocation of ath_hw to ath_init() Luis R. Rodriguez
                   ` (19 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

We were never propagating hw initialization errors, lets
do that now and also use -EOPNOTSUPP when device revision is
not supported yet.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath/ath9k/hw.c   |    2 +-
 drivers/net/wireless/ath/ath9k/main.c |    7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 8228f41..2e09204 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1223,7 +1223,7 @@ struct ath_hw *ath9k_hw_attach(u16 devid, struct ath_softc *sc, int *error)
 		ah = ath9k_hw_do_attach(devid, sc, error);
 		break;
 	default:
-		*error = -ENXIO;
+		*error = -EOPNOTSUPP;
 		break;
 	}
 
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 292ac2b..ada5fef 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1295,7 +1295,6 @@ static int ath9k_reg_notifier(struct wiphy *wiphy,
 static int ath_init(u16 devid, struct ath_softc *sc)
 {
 	struct ath_hw *ah = NULL;
-	int status;
 	int error = 0, i;
 	int csz = 0;
 
@@ -1323,11 +1322,11 @@ static int ath_init(u16 devid, struct ath_softc *sc)
 	/* XXX assert csz is non-zero */
 	sc->cachelsz = csz << 2;	/* convert to bytes */
 
-	ah = ath9k_hw_attach(devid, sc, &status);
+	ah = ath9k_hw_attach(devid, sc, &error);
 	if (ah == NULL) {
 		DPRINTF(sc, ATH_DBG_FATAL,
-			"Unable to attach hardware; HAL status %d\n", status);
-		error = -ENXIO;
+			"Unable to attach hardware; "
+			"initialization status: %d\n", error);
 		goto bad;
 	}
 	sc->sc_ah = ah;
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 04/24] ath9k: move memory allocation of ath_hw to ath_init()
  2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
                   ` (2 preceding siblings ...)
  2009-08-03 19:24 ` [PATCH 03/24] ath9k: propagate hw initialization errors Luis R. Rodriguez
@ 2009-08-03 19:24 ` Luis R. Rodriguez
  2009-08-03 19:24 ` [PATCH 05/24] ath9k: move devid cache setting " Luis R. Rodriguez
                   ` (18 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

This lets us simplify attach code and arguments passed.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath/ath9k/hw.c   |   65 ++++++++++-----------------------
 drivers/net/wireless/ath/ath9k/hw.h   |    2 +-
 drivers/net/wireless/ath/ath9k/main.c |   35 ++++++++++++------
 3 files changed, 44 insertions(+), 58 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 2e09204..fcefea8 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -437,20 +437,9 @@ static void ath9k_hw_set_defaults(struct ath_hw *ah)
 		ah->config.serialize_regmode = SER_REG_MODE_AUTO;
 }
 
-static struct ath_hw *ath9k_hw_newstate(u16 devid, struct ath_softc *sc,
-					int *status)
+static void ath9k_hw_newstate(u16 devid,
+			      struct ath_hw *ah)
 {
-	struct ath_hw *ah;
-
-	ah = kzalloc(sizeof(struct ath_hw), GFP_KERNEL);
-	if (ah == NULL) {
-		DPRINTF(sc, ATH_DBG_FATAL,
-			"Cannot allocate memory for state block\n");
-		*status = -ENOMEM;
-		return NULL;
-	}
-
-	ah->ah_sc = sc;
 	ah->hw_version.magic = AR5416_MAGIC;
 	ah->regulatory.country_code = CTRY_DEFAULT;
 	ah->hw_version.devid = devid;
@@ -479,8 +468,6 @@ static struct ath_hw *ath9k_hw_newstate(u16 devid, struct ath_softc *sc,
 	ah->gbeacon_rate = 0;
 
 	ah->power_mode = ATH9K_PM_UNDEFINED;
-
-	return ah;
 }
 
 static int ath9k_hw_rfattach(struct ath_hw *ah)
@@ -623,28 +610,25 @@ static int ath9k_hw_post_attach(struct ath_hw *ah)
 	return 0;
 }
 
-static struct ath_hw *ath9k_hw_do_attach(u16 devid, struct ath_softc *sc,
-					 int *status)
+static int ath9k_hw_do_attach(struct ath_hw *ah,
+			      u16 devid,
+			      struct ath_softc *sc)
 {
-	struct ath_hw *ah;
-	int ecode;
+	int r;
 	u32 i, j;
 
-	ah = ath9k_hw_newstate(devid, sc, status);
-	if (ah == NULL)
-		return NULL;
-
+	ath9k_hw_newstate(devid, ah);
 	ath9k_hw_set_defaults(ah);
 
 	if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) {
 		DPRINTF(sc, ATH_DBG_FATAL, "Couldn't reset chip\n");
-		ecode = -EIO;
+		r = -EIO;
 		goto bad;
 	}
 
 	if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) {
 		DPRINTF(sc, ATH_DBG_FATAL, "Couldn't wakeup chip\n");
-		ecode = -EIO;
+		r = -EIO;
 		goto bad;
 	}
 
@@ -676,7 +660,7 @@ static struct ath_hw *ath9k_hw_do_attach(u16 devid, struct ath_softc *sc,
 			"Mac Chip Rev 0x%02x.%x is not supported by "
 			"this driver\n", ah->hw_version.macVersion,
 			ah->hw_version.macRev);
-		ecode = -EOPNOTSUPP;
+		r = -EOPNOTSUPP;
 		goto bad;
 	}
 
@@ -878,8 +862,8 @@ static struct ath_hw *ath9k_hw_do_attach(u16 devid, struct ath_softc *sc,
 	else
 		ath9k_hw_disablepcie(ah);
 
-	ecode = ath9k_hw_post_attach(ah);
-	if (ecode != 0)
+	r = ath9k_hw_post_attach(ah);
+	if (r)
 		goto bad;
 
 	if (AR_SREV_9287_11(ah))
@@ -939,8 +923,8 @@ static struct ath_hw *ath9k_hw_do_attach(u16 devid, struct ath_softc *sc,
 		}
 	}
 
-	ecode = ath9k_hw_init_macaddr(ah);
-	if (ecode != 0) {
+	r = ath9k_hw_init_macaddr(ah);
+	if (r) {
 		DPRINTF(sc, ATH_DBG_FATAL,
 			"Failed to initialize MAC address\n");
 		goto bad;
@@ -953,14 +937,10 @@ static struct ath_hw *ath9k_hw_do_attach(u16 devid, struct ath_softc *sc,
 
 	ath9k_init_nfcal_hist_buffer(ah);
 
-	return ah;
+	return 0;
 bad:
-	if (ah)
-		ath9k_hw_detach(ah);
-	if (status)
-		*status = ecode;
-
-	return NULL;
+	ath9k_hw_detach(ah);
+	return r;
 }
 
 static void ath9k_hw_init_bb(struct ath_hw *ah,
@@ -1206,10 +1186,8 @@ void ath9k_hw_detach(struct ath_hw *ah)
 	kfree(ah);
 }
 
-struct ath_hw *ath9k_hw_attach(u16 devid, struct ath_softc *sc, int *error)
+int ath9k_hw_attach(struct ath_hw *ah, u16 devid, struct ath_softc *sc)
 {
-	struct ath_hw *ah = NULL;
-
 	switch (devid) {
 	case AR5416_DEVID_PCI:
 	case AR5416_DEVID_PCIE:
@@ -1220,14 +1198,11 @@ struct ath_hw *ath9k_hw_attach(u16 devid, struct ath_softc *sc, int *error)
 	case AR9285_DEVID_PCIE:
 	case AR5416_DEVID_AR9287_PCI:
 	case AR5416_DEVID_AR9287_PCIE:
-		ah = ath9k_hw_do_attach(devid, sc, error);
-		break;
+		return ath9k_hw_do_attach(ah, devid, sc);
 	default:
-		*error = -EOPNOTSUPP;
 		break;
 	}
-
-	return ah;
+	return -EOPNOTSUPP;
 }
 
 /*******/
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 93a8930..4a0d5f2 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -544,7 +544,7 @@ struct ath_hw {
 /* Attach, Detach, Reset */
 const char *ath9k_hw_probe(u16 vendorid, u16 devid);
 void ath9k_hw_detach(struct ath_hw *ah);
-struct ath_hw *ath9k_hw_attach(u16 devid, struct ath_softc *sc, int *error);
+int ath9k_hw_attach(struct ath_hw *ah, u16 devid, struct ath_softc *sc);
 void ath9k_hw_rfdetach(struct ath_hw *ah);
 int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
 		   bool bChannelChange);
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index ada5fef..c2b9974 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1295,7 +1295,7 @@ static int ath9k_reg_notifier(struct wiphy *wiphy,
 static int ath_init(u16 devid, struct ath_softc *sc)
 {
 	struct ath_hw *ah = NULL;
-	int error = 0, i;
+	int r = 0, i;
 	int csz = 0;
 
 	/* XXX: hardware will not be ready until ath_open() being called */
@@ -1322,11 +1322,21 @@ static int ath_init(u16 devid, struct ath_softc *sc)
 	/* XXX assert csz is non-zero */
 	sc->cachelsz = csz << 2;	/* convert to bytes */
 
-	ah = ath9k_hw_attach(devid, sc, &error);
-	if (ah == NULL) {
+	ah = kzalloc(sizeof(struct ath_hw), GFP_KERNEL);
+	if (!ah) {
+		DPRINTF(sc, ATH_DBG_FATAL,
+			"Cannot allocate memory for state block\n");
+		r = -ENOMEM;
+		goto bad_no_ah;
+	}
+
+	ah->ah_sc = sc;
+
+	r = ath9k_hw_attach(ah, devid, sc);
+	if (r) {
 		DPRINTF(sc, ATH_DBG_FATAL,
 			"Unable to attach hardware; "
-			"initialization status: %d\n", error);
+			"initialization status: %d\n", r);
 		goto bad;
 	}
 	sc->sc_ah = ah;
@@ -1347,7 +1357,7 @@ static int ath_init(u16 devid, struct ath_softc *sc)
 	for (i = 0; i < sc->keymax; i++)
 		ath9k_hw_keyreset(ah, (u16) i);
 
-	if (error)
+	if (r)
 		goto bad;
 
 	/* default to MONITOR mode */
@@ -1369,14 +1379,14 @@ static int ath_init(u16 devid, struct ath_softc *sc)
 	if (sc->beacon.beaconq == -1) {
 		DPRINTF(sc, ATH_DBG_FATAL,
 			"Unable to setup a beacon xmit queue\n");
-		error = -EIO;
+		r = -EIO;
 		goto bad2;
 	}
 	sc->beacon.cabq = ath_txq_setup(sc, ATH9K_TX_QUEUE_CAB, 0);
 	if (sc->beacon.cabq == NULL) {
 		DPRINTF(sc, ATH_DBG_FATAL,
 			"Unable to setup CAB xmit queue\n");
-		error = -EIO;
+		r = -EIO;
 		goto bad2;
 	}
 
@@ -1391,26 +1401,26 @@ static int ath_init(u16 devid, struct ath_softc *sc)
 	if (!ath_tx_setup(sc, ATH9K_WME_AC_BK)) {
 		DPRINTF(sc, ATH_DBG_FATAL,
 			"Unable to setup xmit queue for BK traffic\n");
-		error = -EIO;
+		r = -EIO;
 		goto bad2;
 	}
 
 	if (!ath_tx_setup(sc, ATH9K_WME_AC_BE)) {
 		DPRINTF(sc, ATH_DBG_FATAL,
 			"Unable to setup xmit queue for BE traffic\n");
-		error = -EIO;
+		r = -EIO;
 		goto bad2;
 	}
 	if (!ath_tx_setup(sc, ATH9K_WME_AC_VI)) {
 		DPRINTF(sc, ATH_DBG_FATAL,
 			"Unable to setup xmit queue for VI traffic\n");
-		error = -EIO;
+		r = -EIO;
 		goto bad2;
 	}
 	if (!ath_tx_setup(sc, ATH9K_WME_AC_VO)) {
 		DPRINTF(sc, ATH_DBG_FATAL,
 			"Unable to setup xmit queue for VO traffic\n");
-		error = -EIO;
+		r = -EIO;
 		goto bad2;
 	}
 
@@ -1506,9 +1516,10 @@ bad2:
 bad:
 	if (ah)
 		ath9k_hw_detach(ah);
+bad_no_ah:
 	ath9k_exit_debug(sc);
 
-	return error;
+	return r;
 }
 
 void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 05/24] ath9k: move devid cache setting to ath_init()
  2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
                   ` (3 preceding siblings ...)
  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 ` Luis R. Rodriguez
  2009-08-03 19:24 ` [PATCH 06/24] ath9k: move cache setting of softc ah prior to attach Luis R. Rodriguez
                   ` (17 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

This lets us trim one argument off of hw initializer routines.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath/ath9k/hw.c   |   15 ++++++---------
 drivers/net/wireless/ath/ath9k/hw.h   |    2 +-
 drivers/net/wireless/ath/ath9k/main.c |    3 ++-
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index fcefea8..ff2875b 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -437,16 +437,14 @@ static void ath9k_hw_set_defaults(struct ath_hw *ah)
 		ah->config.serialize_regmode = SER_REG_MODE_AUTO;
 }
 
-static void ath9k_hw_newstate(u16 devid,
-			      struct ath_hw *ah)
+static void ath9k_hw_newstate(struct ath_hw *ah)
 {
 	ah->hw_version.magic = AR5416_MAGIC;
 	ah->regulatory.country_code = CTRY_DEFAULT;
-	ah->hw_version.devid = devid;
 	ah->hw_version.subvendorid = 0;
 
 	ah->ah_flags = 0;
-	if ((devid == AR5416_AR9100_DEVID))
+	if (ah->hw_version.devid == AR5416_AR9100_DEVID)
 		ah->hw_version.macVersion = AR_SREV_VERSION_9100;
 	if (!AR_SREV_9100(ah))
 		ah->ah_flags = AH_USE_EEPROM;
@@ -611,13 +609,12 @@ static int ath9k_hw_post_attach(struct ath_hw *ah)
 }
 
 static int ath9k_hw_do_attach(struct ath_hw *ah,
-			      u16 devid,
 			      struct ath_softc *sc)
 {
 	int r;
 	u32 i, j;
 
-	ath9k_hw_newstate(devid, ah);
+	ath9k_hw_newstate(ah);
 	ath9k_hw_set_defaults(ah);
 
 	if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) {
@@ -1186,9 +1183,9 @@ void ath9k_hw_detach(struct ath_hw *ah)
 	kfree(ah);
 }
 
-int ath9k_hw_attach(struct ath_hw *ah, u16 devid, struct ath_softc *sc)
+int ath9k_hw_attach(struct ath_hw *ah, struct ath_softc *sc)
 {
-	switch (devid) {
+	switch (ah->hw_version.devid) {
 	case AR5416_DEVID_PCI:
 	case AR5416_DEVID_PCIE:
 	case AR5416_AR9100_DEVID:
@@ -1198,7 +1195,7 @@ int ath9k_hw_attach(struct ath_hw *ah, u16 devid, struct ath_softc *sc)
 	case AR9285_DEVID_PCIE:
 	case AR5416_DEVID_AR9287_PCI:
 	case AR5416_DEVID_AR9287_PCIE:
-		return ath9k_hw_do_attach(ah, devid, sc);
+		return ath9k_hw_do_attach(ah, sc);
 	default:
 		break;
 	}
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 4a0d5f2..c769dd6 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -544,7 +544,7 @@ struct ath_hw {
 /* Attach, Detach, Reset */
 const char *ath9k_hw_probe(u16 vendorid, u16 devid);
 void ath9k_hw_detach(struct ath_hw *ah);
-int ath9k_hw_attach(struct ath_hw *ah, u16 devid, struct ath_softc *sc);
+int ath9k_hw_attach(struct ath_hw *ah, struct ath_softc *sc);
 void ath9k_hw_rfdetach(struct ath_hw *ah);
 int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
 		   bool bChannelChange);
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index c2b9974..fa2c230 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1331,8 +1331,9 @@ static int ath_init(u16 devid, struct ath_softc *sc)
 	}
 
 	ah->ah_sc = sc;
+	ah->hw_version.devid = devid;
 
-	r = ath9k_hw_attach(ah, devid, sc);
+	r = ath9k_hw_attach(ah, sc);
 	if (r) {
 		DPRINTF(sc, ATH_DBG_FATAL,
 			"Unable to attach hardware; "
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 06/24] ath9k: move cache setting of softc ah prior to attach
  2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
                   ` (4 preceding siblings ...)
  2009-08-03 19:24 ` [PATCH 05/24] ath9k: move devid cache setting " Luis R. Rodriguez
@ 2009-08-03 19:24 ` Luis R. Rodriguez
  2009-08-03 19:24 ` [PATCH 07/24] ath9k: call hw initializer directly Luis R. Rodriguez
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

We do this in case attach and friends try to get back to
ah from the softc somehow.

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

diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index fa2c230..605d328 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1332,6 +1332,7 @@ static int ath_init(u16 devid, struct ath_softc *sc)
 
 	ah->ah_sc = sc;
 	ah->hw_version.devid = devid;
+	sc->sc_ah = ah;
 
 	r = ath9k_hw_attach(ah, sc);
 	if (r) {
@@ -1340,7 +1341,6 @@ static int ath_init(u16 devid, struct ath_softc *sc)
 			"initialization status: %d\n", r);
 		goto bad;
 	}
-	sc->sc_ah = ah;
 
 	/* Get the hardware key cache size. */
 	sc->keymax = ah->caps.keycache_size;
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 07/24] ath9k: call hw initializer directly
  2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
                   ` (5 preceding siblings ...)
  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
  2009-08-03 19:24 ` [PATCH 09/24] ath9k: move hw macrevision checker to helper Luis R. Rodriguez
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

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


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 09/24] ath9k: move hw macrevision checker to helper
  2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
                   ` (6 preceding siblings ...)
  2009-08-03 19:24 ` [PATCH 07/24] ath9k: call hw initializer directly Luis R. Rodriguez
@ 2009-08-03 19:24 ` Luis R. Rodriguez
  2009-08-03 19:24 ` [PATCH 10/24] ath9k: rename ath9k_hw_newstate() to ath9k_hw_init_defaults() Luis R. Rodriguez
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

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

diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 301ef04..4f3d7bf 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -627,6 +627,23 @@ static bool ath9k_hw_devid_supported(u16 devid)
 	return false;
 }
 
+static bool ath9k_hw_macversion_supported(u32 macversion)
+{
+	switch (macversion) {
+	case AR_SREV_VERSION_5416_PCI:
+	case AR_SREV_VERSION_5416_PCIE:
+	case AR_SREV_VERSION_9160:
+	case AR_SREV_VERSION_9100:
+	case AR_SREV_VERSION_9280:
+	case AR_SREV_VERSION_9285:
+	case AR_SREV_VERSION_9287:
+		return true;
+	default:
+		break;
+	}
+	return false;
+}
+
 int ath9k_hw_attach(struct ath_hw *ah)
 {
 	int r;
@@ -666,16 +683,7 @@ int ath9k_hw_attach(struct ath_hw *ah)
 	DPRINTF(ah->ah_sc, ATH_DBG_RESET, "serialize_regmode is %d\n",
 		ah->config.serialize_regmode);
 
-	switch (ah->hw_version.macVersion) {
-	case AR_SREV_VERSION_5416_PCI:
-	case AR_SREV_VERSION_5416_PCIE:
-	case AR_SREV_VERSION_9160:
-	case AR_SREV_VERSION_9100:
-	case AR_SREV_VERSION_9280:
-	case AR_SREV_VERSION_9285:
-	case AR_SREV_VERSION_9287:
-		break;
-	default:
+	if (!ath9k_hw_macversion_supported(ah->hw_version.macVersion)) {
 		DPRINTF(ah->ah_sc, ATH_DBG_FATAL,
 			"Mac Chip Rev 0x%02x.%x is not supported by "
 			"this driver\n", ah->hw_version.macVersion,
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 10/24] ath9k: rename ath9k_hw_newstate() to ath9k_hw_init_defaults()
  2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
                   ` (7 preceding siblings ...)
  2009-08-03 19:24 ` [PATCH 09/24] ath9k: move hw macrevision checker to helper Luis R. Rodriguez
@ 2009-08-03 19:24 ` 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
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

This reflects better what we are actually doing there.

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

diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 4f3d7bf..6aee570 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -437,7 +437,7 @@ static void ath9k_hw_set_defaults(struct ath_hw *ah)
 		ah->config.serialize_regmode = SER_REG_MODE_AUTO;
 }
 
-static void ath9k_hw_newstate(struct ath_hw *ah)
+static void ath9k_hw_init_defaults(struct ath_hw *ah)
 {
 	ah->hw_version.magic = AR5416_MAGIC;
 	ah->regulatory.country_code = CTRY_DEFAULT;
@@ -654,7 +654,7 @@ int ath9k_hw_attach(struct ath_hw *ah)
 		goto bad;
 	}
 
-	ath9k_hw_newstate(ah);
+	ath9k_hw_init_defaults(ah);
 	ath9k_hw_set_defaults(ah);
 
 	if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) {
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 11/24] ath9k: rename  ath9k_hw_set_defaults() to ath9k_hw_init_config()
  2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
                   ` (8 preceding siblings ...)
  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 ` Luis R. Rodriguez
  2009-08-03 19:24 ` [PATCH 12/24] ath9k: remove debug message for no memoery on ath_init() Luis R. Rodriguez
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

This reflects better what we are actually doing there.

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

diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 6aee570..31ec83d 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -388,7 +388,7 @@ static const char *ath9k_hw_devname(u16 devid)
 	return NULL;
 }
 
-static void ath9k_hw_set_defaults(struct ath_hw *ah)
+static void ath9k_hw_init_config(struct ath_hw *ah)
 {
 	int i;
 
@@ -655,7 +655,7 @@ int ath9k_hw_attach(struct ath_hw *ah)
 	}
 
 	ath9k_hw_init_defaults(ah);
-	ath9k_hw_set_defaults(ah);
+	ath9k_hw_init_config(ah);
 
 	if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) {
 		DPRINTF(ah->ah_sc, ATH_DBG_FATAL, "Couldn't reset chip\n");
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 12/24] ath9k: remove debug message for no memoery on ath_init()
  2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
                   ` (9 preceding siblings ...)
  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 ` Luis R. Rodriguez
  2009-08-03 19:24 ` [PATCH 13/24] ath9k: break up hw initialization into a few more helpers Luis R. Rodriguez
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

We're now propagating the -ENOMEM error so there is no need to
keep a debug message there now.

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

diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 6242950..230dedb 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1324,8 +1324,6 @@ static int ath_init(u16 devid, struct ath_softc *sc)
 
 	ah = kzalloc(sizeof(struct ath_hw), GFP_KERNEL);
 	if (!ah) {
-		DPRINTF(sc, ATH_DBG_FATAL,
-			"Cannot allocate memory for state block\n");
 		r = -ENOMEM;
 		goto bad_no_ah;
 	}
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 13/24] ath9k: break up hw initialization into a few more helpers
  2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
                   ` (10 preceding siblings ...)
  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 ` Luis R. Rodriguez
  2009-08-03 19:24 ` [PATCH 14/24] ath9k: describe hw initialization better Luis R. Rodriguez
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

This makes reading the hardware initialization process
easier to understand. The new helpers added are:

ath9k_hw_init_cal_settings()
ath9k_hw_init_mode_regs()
ath9k_hw_init_mode_gain_regs()
ath9k_hw_init_11a_eeprom_fix()

This patch has no functional changes.

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

diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 31ec83d..f280eef 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -644,61 +644,8 @@ static bool ath9k_hw_macversion_supported(u32 macversion)
 	return false;
 }
 
-int ath9k_hw_attach(struct ath_hw *ah)
+static void ath9k_hw_init_cal_settings(struct ath_hw *ah)
 {
-	int r;
-	u32 i, j;
-
-	if (!ath9k_hw_devid_supported(ah->hw_version.devid)) {
-		r = -EOPNOTSUPP;
-		goto bad;
-	}
-
-	ath9k_hw_init_defaults(ah);
-	ath9k_hw_init_config(ah);
-
-	if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) {
-		DPRINTF(ah->ah_sc, ATH_DBG_FATAL, "Couldn't reset chip\n");
-		r = -EIO;
-		goto bad;
-	}
-
-	if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) {
-		DPRINTF(ah->ah_sc, ATH_DBG_FATAL, "Couldn't wakeup chip\n");
-		r = -EIO;
-		goto bad;
-	}
-
-	if (ah->config.serialize_regmode == SER_REG_MODE_AUTO) {
-		if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI ||
-		    (AR_SREV_9280(ah) && !ah->is_pciexpress)) {
-			ah->config.serialize_regmode =
-				SER_REG_MODE_ON;
-		} else {
-			ah->config.serialize_regmode =
-				SER_REG_MODE_OFF;
-		}
-	}
-
-	DPRINTF(ah->ah_sc, ATH_DBG_RESET, "serialize_regmode is %d\n",
-		ah->config.serialize_regmode);
-
-	if (!ath9k_hw_macversion_supported(ah->hw_version.macVersion)) {
-		DPRINTF(ah->ah_sc, ATH_DBG_FATAL,
-			"Mac Chip Rev 0x%02x.%x is not supported by "
-			"this driver\n", ah->hw_version.macVersion,
-			ah->hw_version.macRev);
-		r = -EOPNOTSUPP;
-		goto bad;
-	}
-
-	if (AR_SREV_9100(ah)) {
-		ah->iq_caldata.calData = &iq_cal_multi_sample;
-		ah->supp_cals = IQ_MISMATCH_CAL;
-		ah->is_pciexpress = false;
-	}
-	ah->hw_version.phyRev = REG_READ(ah, AR_PHY_CHIP_ID);
-
 	if (AR_SREV_9160_10_OR_LATER(ah)) {
 		if (AR_SREV_9280_10_OR_LATER(ah)) {
 			ah->iq_caldata.calData = &iq_cal_single_sample;
@@ -719,10 +666,10 @@ int ath9k_hw_attach(struct ath_hw *ah)
 		}
 		ah->supp_cals = ADC_GAIN_CAL | ADC_DC_CAL | IQ_MISMATCH_CAL;
 	}
+}
 
-	ah->ani_function = ATH9K_ANI_ALL;
-	if (AR_SREV_9280_10_OR_LATER(ah))
-		ah->ani_function &= ~ATH9K_ANI_NOISE_IMMUNITY_LEVEL;
+static void ath9k_hw_init_mode_regs(struct ath_hw *ah)
+{
 	if (AR_SREV_9287_11_OR_LATER(ah)) {
 		INIT_INI_ARRAY(&ah->iniModes, ar9287Modes_9287_1_1,
 				ARRAY_SIZE(ar9287Modes_9287_1_1), 6);
@@ -884,16 +831,10 @@ int ath9k_hw_attach(struct ath_hw *ah)
 		INIT_INI_ARRAY(&ah->iniAddac, ar5416Addac,
 			       ARRAY_SIZE(ar5416Addac), 2);
 	}
+}
 
-	if (ah->is_pciexpress)
-		ath9k_hw_configpcipowersave(ah, 0);
-	else
-		ath9k_hw_disablepcie(ah);
-
-	r = ath9k_hw_post_attach(ah);
-	if (r)
-		goto bad;
-
+static void ath9k_hw_init_mode_gain_regs(struct ath_hw *ah)
+{
 	if (AR_SREV_9287_11(ah))
 		INIT_INI_ARRAY(&ah->iniModesRxGain,
 		ar9287Modes_rx_gain_9287_1_1,
@@ -930,8 +871,11 @@ int ath9k_hw_attach(struct ath_hw *ah)
 		}
 
 	}
+}
 
-	ath9k_hw_fill_cap_info(ah);
+static void ath9k_hw_init_11a_eeprom_fix(struct ath_hw *ah)
+{
+	u32 i, j;
 
 	if ((ah->hw_version.devid == AR9280_DEVID_PCI) &&
 	    test_bit(ATH9K_MODE_11A, ah->caps.wireless_modes)) {
@@ -950,6 +894,82 @@ int ath9k_hw_attach(struct ath_hw *ah)
 			}
 		}
 	}
+}
+
+int ath9k_hw_attach(struct ath_hw *ah)
+{
+	int r;
+
+	if (!ath9k_hw_devid_supported(ah->hw_version.devid)) {
+		r = -EOPNOTSUPP;
+		goto bad;
+	}
+
+	ath9k_hw_init_defaults(ah);
+	ath9k_hw_init_config(ah);
+
+	if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) {
+		DPRINTF(ah->ah_sc, ATH_DBG_FATAL, "Couldn't reset chip\n");
+		r = -EIO;
+		goto bad;
+	}
+
+	if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) {
+		DPRINTF(ah->ah_sc, ATH_DBG_FATAL, "Couldn't wakeup chip\n");
+		r = -EIO;
+		goto bad;
+	}
+
+	if (ah->config.serialize_regmode == SER_REG_MODE_AUTO) {
+		if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI ||
+		    (AR_SREV_9280(ah) && !ah->is_pciexpress)) {
+			ah->config.serialize_regmode =
+				SER_REG_MODE_ON;
+		} else {
+			ah->config.serialize_regmode =
+				SER_REG_MODE_OFF;
+		}
+	}
+
+	DPRINTF(ah->ah_sc, ATH_DBG_RESET, "serialize_regmode is %d\n",
+		ah->config.serialize_regmode);
+
+	if (!ath9k_hw_macversion_supported(ah->hw_version.macVersion)) {
+		DPRINTF(ah->ah_sc, ATH_DBG_FATAL,
+			"Mac Chip Rev 0x%02x.%x is not supported by "
+			"this driver\n", ah->hw_version.macVersion,
+			ah->hw_version.macRev);
+		r = -EOPNOTSUPP;
+		goto bad;
+	}
+
+	if (AR_SREV_9100(ah)) {
+		ah->iq_caldata.calData = &iq_cal_multi_sample;
+		ah->supp_cals = IQ_MISMATCH_CAL;
+		ah->is_pciexpress = false;
+	}
+	ah->hw_version.phyRev = REG_READ(ah, AR_PHY_CHIP_ID);
+
+	ath9k_hw_init_cal_settings(ah);
+
+	ah->ani_function = ATH9K_ANI_ALL;
+	if (AR_SREV_9280_10_OR_LATER(ah))
+		ah->ani_function &= ~ATH9K_ANI_NOISE_IMMUNITY_LEVEL;
+
+	ath9k_hw_init_mode_regs(ah);
+
+	if (ah->is_pciexpress)
+		ath9k_hw_configpcipowersave(ah, 0);
+	else
+		ath9k_hw_disablepcie(ah);
+
+	r = ath9k_hw_post_attach(ah);
+	if (r)
+		goto bad;
+
+	ath9k_hw_init_mode_gain_regs(ah);
+	ath9k_hw_fill_cap_info(ah);
+	ath9k_hw_init_11a_eeprom_fix(ah);
 
 	r = ath9k_hw_init_macaddr(ah);
 	if (r) {
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 14/24] ath9k: describe hw initialization better
  2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
                   ` (11 preceding siblings ...)
  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 ` Luis R. Rodriguez
  2009-08-03 19:24 ` [PATCH 15/24] ath9k: distinguish between device initialization and ath_softc init Luis R. Rodriguez
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

During initialization ath9k tends to use "attach" to when we
initialize hardware due to the fact we used to attach a "HAL".
The notion of a HAL is long gone, so lets just be clear on what
we are doing.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath/ath9k/ani.c    |    2 +-
 drivers/net/wireless/ath/ath9k/ani.h    |    2 +-
 drivers/net/wireless/ath/ath9k/eeprom.c |    2 +-
 drivers/net/wireless/ath/ath9k/eeprom.h |    2 +-
 drivers/net/wireless/ath/ath9k/hw.c     |   12 ++++++------
 drivers/net/wireless/ath/ath9k/hw.h     |    4 ++--
 drivers/net/wireless/ath/ath9k/main.c   |    4 ++--
 7 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c
index aad259b..a613cf4 100644
--- a/drivers/net/wireless/ath/ath9k/ani.c
+++ b/drivers/net/wireless/ath/ath9k/ani.c
@@ -777,7 +777,7 @@ void ath9k_hw_ani_setup(struct ath_hw *ah)
 	}
 }
 
-void ath9k_hw_ani_attach(struct ath_hw *ah)
+void ath9k_hw_ani_init(struct ath_hw *ah)
 {
 	int i;
 
diff --git a/drivers/net/wireless/ath/ath9k/ani.h b/drivers/net/wireless/ath/ath9k/ani.h
index 08b4e7e..803669f 100644
--- a/drivers/net/wireless/ath/ath9k/ani.h
+++ b/drivers/net/wireless/ath/ath9k/ani.h
@@ -132,7 +132,7 @@ u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hw *ah, u32 *rxc_pcnt,
 void ath9k_hw_procmibevent(struct ath_hw *ah,
 			   const struct ath9k_node_stats *stats);
 void ath9k_hw_ani_setup(struct ath_hw *ah);
-void ath9k_hw_ani_attach(struct ath_hw *ah);
+void ath9k_hw_ani_init(struct ath_hw *ah);
 void ath9k_hw_ani_detach(struct ath_hw *ah);
 
 #endif /* ANI_H */
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c
index 6fb1a80..e8ccec0 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
@@ -3978,7 +3978,7 @@ static struct eeprom_ops eep_AR9287_ops = {
 };
 
 
-int ath9k_hw_eeprom_attach(struct ath_hw *ah)
+int ath9k_hw_eeprom_init(struct ath_hw *ah)
 {
 	int status;
 	if (AR_SREV_9287(ah)) {
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless/ath/ath9k/eeprom.h
index 7ddd016..335098d 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.h
+++ b/drivers/net/wireless/ath/ath9k/eeprom.h
@@ -665,6 +665,6 @@ struct eeprom_ops {
 	(((_txchainmask >> 2) & 1) +                            \
 	 ((_txchainmask >> 1) & 1) + (_txchainmask & 1))
 
-int ath9k_hw_eeprom_attach(struct ath_hw *ah);
+int ath9k_hw_eeprom_init(struct ath_hw *ah);
 
 #endif /* EEPROM_H */
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index f280eef..65d2e7d 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -578,7 +578,7 @@ static void ath9k_hw_init_txgain_ini(struct ath_hw *ah)
 	}
 }
 
-static int ath9k_hw_post_attach(struct ath_hw *ah)
+static int ath9k_hw_post_init(struct ath_hw *ah)
 {
 	int ecode;
 
@@ -589,7 +589,7 @@ static int ath9k_hw_post_attach(struct ath_hw *ah)
 	if (ecode != 0)
 		return ecode;
 
-	ecode = ath9k_hw_eeprom_attach(ah);
+	ecode = ath9k_hw_eeprom_init(ah);
 	if (ecode != 0)
 		return ecode;
 
@@ -602,7 +602,7 @@ static int ath9k_hw_post_attach(struct ath_hw *ah)
 
 	if (!AR_SREV_9100(ah)) {
 		ath9k_hw_ani_setup(ah);
-		ath9k_hw_ani_attach(ah);
+		ath9k_hw_ani_init(ah);
 	}
 
 	return 0;
@@ -896,7 +896,7 @@ static void ath9k_hw_init_11a_eeprom_fix(struct ath_hw *ah)
 	}
 }
 
-int ath9k_hw_attach(struct ath_hw *ah)
+int ath9k_hw_init(struct ath_hw *ah)
 {
 	int r;
 
@@ -963,7 +963,7 @@ int ath9k_hw_attach(struct ath_hw *ah)
 	else
 		ath9k_hw_disablepcie(ah);
 
-	r = ath9k_hw_post_attach(ah);
+	r = ath9k_hw_post_init(ah);
 	if (r)
 		goto bad;
 
@@ -2930,7 +2930,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_attach()
+		 * ath9k_hw_init()
 		 */
 		for (i = 0; i < ah->iniPcieSerdes.ia_rows; i++) {
 			REG_WRITE(ah, INI_RA(&ah->iniPcieSerdes, i, 0),
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 35cf9f8..4c78e8c 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -541,10 +541,10 @@ struct ath_hw {
 	struct ar5416IniArray iniModesTxGain;
 };
 
-/* Attach, Detach, Reset */
+/* Initialization, Detach, Reset */
 const char *ath9k_hw_probe(u16 vendorid, u16 devid);
 void ath9k_hw_detach(struct ath_hw *ah);
-int ath9k_hw_attach(struct ath_hw *ah);
+int ath9k_hw_init(struct ath_hw *ah);
 void ath9k_hw_rfdetach(struct ath_hw *ah);
 int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
 		   bool bChannelChange);
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 230dedb..751d803 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1332,10 +1332,10 @@ static int ath_init(u16 devid, struct ath_softc *sc)
 	ah->hw_version.devid = devid;
 	sc->sc_ah = ah;
 
-	r = ath9k_hw_attach(ah);
+	r = ath9k_hw_init(ah);
 	if (r) {
 		DPRINTF(sc, ATH_DBG_FATAL,
-			"Unable to attach hardware; "
+			"Unable to initialize hardware; "
 			"initialization status: %d\n", r);
 		goto bad;
 	}
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 15/24] ath9k: distinguish between device initialization and ath_softc init
  2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
                   ` (12 preceding siblings ...)
  2009-08-03 19:24 ` [PATCH 14/24] ath9k: describe hw initialization better Luis R. Rodriguez
@ 2009-08-03 19:24 ` Luis R. Rodriguez
  2009-08-03 19:24 ` [PATCH 16/24] ath9k: remove !NULL check before kfree() Luis R. Rodriguez
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

We re-label the device driver initialization routines from the
ath_softc, the "Software Carrier" fillers. This should make it
clearer what each of these do.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath/ath9k/ahb.c   |    2 +-
 drivers/net/wireless/ath/ath9k/ath9k.h |    2 +-
 drivers/net/wireless/ath/ath9k/main.c  |   13 ++++++++++---
 drivers/net/wireless/ath/ath9k/pci.c   |    2 +-
 4 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ahb.c b/drivers/net/wireless/ath/ath9k/ahb.c
index 0e65c51..5618fc2 100644
--- a/drivers/net/wireless/ath/ath9k/ahb.c
+++ b/drivers/net/wireless/ath/ath9k/ahb.c
@@ -119,7 +119,7 @@ static int ath_ahb_probe(struct platform_device *pdev)
 	sc->bus_ops = &ath_ahb_bus_ops;
 	sc->irq = irq;
 
-	ret = ath_attach(AR5416_AR9100_DEVID, sc);
+	ret = ath_init_device(AR5416_AR9100_DEVID, sc);
 	if (ret != 0) {
 		dev_err(&pdev->dev, "failed to attach device, err=%d\n", ret);
 		ret = -ENODEV;
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index bda0f30..7a5a157 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -642,7 +642,7 @@ extern struct ieee80211_ops ath9k_ops;
 
 irqreturn_t ath_isr(int irq, void *dev);
 void ath_cleanup(struct ath_softc *sc);
-int ath_attach(u16 devid, struct ath_softc *sc);
+int ath_init_device(u16 devid, struct ath_softc *sc);
 void ath_detach(struct ath_softc *sc);
 const char *ath_mac_bb_name(u32 mac_bb_version);
 const char *ath_rf_name(u16 rf_version);
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 751d803..91bffc9 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1292,7 +1292,13 @@ static int ath9k_reg_notifier(struct wiphy *wiphy,
 	return ath_reg_notifier_apply(wiphy, request, reg);
 }
 
-static int ath_init(u16 devid, struct ath_softc *sc)
+/*
+ * Initialize and fill ath_softc, ath_sofct is the
+ * "Software Carrier" struct. Historically it has existed
+ * to allow the separation between hardware specific
+ * variables (now in ath_hw) and driver specific variables.
+ */
+static int ath_init_softc(u16 devid, struct ath_softc *sc)
 {
 	struct ath_hw *ah = NULL;
 	int r = 0, i;
@@ -1558,7 +1564,8 @@ void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
 			&sc->sbands[IEEE80211_BAND_5GHZ];
 }
 
-int ath_attach(u16 devid, struct ath_softc *sc)
+/* Device driver core initialization */
+int ath_init_device(u16 devid, struct ath_softc *sc)
 {
 	struct ieee80211_hw *hw = sc->hw;
 	int error = 0, i;
@@ -1566,7 +1573,7 @@ int ath_attach(u16 devid, struct ath_softc *sc)
 
 	DPRINTF(sc, ATH_DBG_CONFIG, "Attach ATH hw\n");
 
-	error = ath_init(devid, sc);
+	error = ath_init_softc(devid, sc);
 	if (error != 0)
 		return error;
 
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index cd4841b..3546504 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -178,7 +178,7 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	sc->mem = mem;
 	sc->bus_ops = &ath_pci_bus_ops;
 
-	if (ath_attach(id->device, sc) != 0) {
+	if (ath_init_device(id->device, sc) != 0) {
 		ret = -ENODEV;
 		goto bad3;
 	}
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 16/24] ath9k: remove !NULL check before kfree()
  2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
                   ` (13 preceding siblings ...)
  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 ` 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
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

kfree(NULL) works so remove all those branches which check
for it before kfree()'ing on ath9k_hw_rfdetach().

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

diff --git a/drivers/net/wireless/ath/ath9k/phy.c b/drivers/net/wireless/ath/ath9k/phy.c
index aaa9415..06fd057 100644
--- a/drivers/net/wireless/ath/ath9k/phy.c
+++ b/drivers/net/wireless/ath/ath9k/phy.c
@@ -266,42 +266,32 @@ ath9k_hw_set_rf_regs(struct ath_hw *ah, struct ath9k_channel *chan,
 void
 ath9k_hw_rfdetach(struct ath_hw *ah)
 {
-	if (ah->analogBank0Data != NULL) {
-		kfree(ah->analogBank0Data);
-		ah->analogBank0Data = NULL;
-	}
-	if (ah->analogBank1Data != NULL) {
-		kfree(ah->analogBank1Data);
-		ah->analogBank1Data = NULL;
-	}
-	if (ah->analogBank2Data != NULL) {
-		kfree(ah->analogBank2Data);
-		ah->analogBank2Data = NULL;
-	}
-	if (ah->analogBank3Data != NULL) {
-		kfree(ah->analogBank3Data);
-		ah->analogBank3Data = NULL;
-	}
-	if (ah->analogBank6Data != NULL) {
-		kfree(ah->analogBank6Data);
-		ah->analogBank6Data = NULL;
-	}
-	if (ah->analogBank6TPCData != NULL) {
-		kfree(ah->analogBank6TPCData);
-		ah->analogBank6TPCData = NULL;
-	}
-	if (ah->analogBank7Data != NULL) {
-		kfree(ah->analogBank7Data);
-		ah->analogBank7Data = NULL;
-	}
-	if (ah->addac5416_21 != NULL) {
-		kfree(ah->addac5416_21);
-		ah->addac5416_21 = NULL;
-	}
-	if (ah->bank6Temp != NULL) {
-		kfree(ah->bank6Temp);
-		ah->bank6Temp = NULL;
-	}
+	kfree(ah->analogBank0Data);
+	ah->analogBank0Data = NULL;
+
+	kfree(ah->analogBank1Data);
+	ah->analogBank1Data = NULL;
+
+	kfree(ah->analogBank2Data);
+	ah->analogBank2Data = NULL;
+
+	kfree(ah->analogBank3Data);
+	ah->analogBank3Data = NULL;
+
+	kfree(ah->analogBank6Data);
+	ah->analogBank6Data = NULL;
+
+	kfree(ah->analogBank6TPCData);
+	ah->analogBank6TPCData = NULL;
+
+	kfree(ah->analogBank7Data);
+	ah->analogBank7Data = NULL;
+
+	kfree(ah->addac5416_21);
+	ah->addac5416_21 = NULL;
+
+	kfree(ah->bank6Temp);
+	ah->bank6Temp = NULL;
 }
 
 bool ath9k_hw_init_rf(struct ath_hw *ah, int *status)
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 17/24] ath9k: use helper macro to kfree and nullify on ath9k_hw_rfdetach()
  2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
                   ` (14 preceding siblings ...)
  2009-08-03 19:24 ` [PATCH 16/24] ath9k: remove !NULL check before kfree() Luis R. Rodriguez
@ 2009-08-03 19:24 ` Luis R. Rodriguez
  2009-08-03 19:24 ` [PATCH 18/24] ath9k: rename ath9k_hw_rfdetach() to ath9k_hw_rf_free() Luis R. Rodriguez
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

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

diff --git a/drivers/net/wireless/ath/ath9k/phy.c b/drivers/net/wireless/ath/ath9k/phy.c
index 06fd057..98b1b56 100644
--- a/drivers/net/wireless/ath/ath9k/phy.c
+++ b/drivers/net/wireless/ath/ath9k/phy.c
@@ -266,32 +266,21 @@ ath9k_hw_set_rf_regs(struct ath_hw *ah, struct ath9k_channel *chan,
 void
 ath9k_hw_rfdetach(struct ath_hw *ah)
 {
-	kfree(ah->analogBank0Data);
-	ah->analogBank0Data = NULL;
-
-	kfree(ah->analogBank1Data);
-	ah->analogBank1Data = NULL;
-
-	kfree(ah->analogBank2Data);
-	ah->analogBank2Data = NULL;
-
-	kfree(ah->analogBank3Data);
-	ah->analogBank3Data = NULL;
-
-	kfree(ah->analogBank6Data);
-	ah->analogBank6Data = NULL;
-
-	kfree(ah->analogBank6TPCData);
-	ah->analogBank6TPCData = NULL;
-
-	kfree(ah->analogBank7Data);
-	ah->analogBank7Data = NULL;
-
-	kfree(ah->addac5416_21);
-	ah->addac5416_21 = NULL;
-
-	kfree(ah->bank6Temp);
-	ah->bank6Temp = NULL;
+#define ATH_FREE_BANK(bank) do { \
+		kfree(bank); \
+		bank = NULL; \
+	} while (0);
+
+	ATH_FREE_BANK(ah->analogBank0Data);
+	ATH_FREE_BANK(ah->analogBank1Data);
+	ATH_FREE_BANK(ah->analogBank2Data);
+	ATH_FREE_BANK(ah->analogBank3Data);
+	ATH_FREE_BANK(ah->analogBank6Data);
+	ATH_FREE_BANK(ah->analogBank6TPCData);
+	ATH_FREE_BANK(ah->analogBank7Data);
+	ATH_FREE_BANK(ah->addac5416_21);
+	ATH_FREE_BANK(ah->bank6Temp);
+#undef ATH_FREE_BANK
 }
 
 bool ath9k_hw_init_rf(struct ath_hw *ah, int *status)
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 18/24] ath9k: rename ath9k_hw_rfdetach() to ath9k_hw_rf_free()
  2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
                   ` (15 preceding siblings ...)
  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 ` 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
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

This makes it clear what this does.

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

diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 65d2e7d..73dee19 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1229,7 +1229,7 @@ void ath9k_hw_detach(struct ath_hw *ah)
 	if (!AR_SREV_9100(ah))
 		ath9k_hw_ani_detach(ah);
 
-	ath9k_hw_rfdetach(ah);
+	ath9k_hw_rf_free(ah);
 	ath9k_hw_setpower(ah, ATH9K_PM_FULL_SLEEP);
 	kfree(ah);
 }
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 4c78e8c..4e717cc 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -545,7 +545,7 @@ struct ath_hw {
 const char *ath9k_hw_probe(u16 vendorid, u16 devid);
 void ath9k_hw_detach(struct ath_hw *ah);
 int ath9k_hw_init(struct ath_hw *ah);
-void ath9k_hw_rfdetach(struct ath_hw *ah);
+void ath9k_hw_rf_free(struct ath_hw *ah);
 int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
 		   bool bChannelChange);
 void ath9k_hw_fill_cap_info(struct ath_hw *ah);
diff --git a/drivers/net/wireless/ath/ath9k/phy.c b/drivers/net/wireless/ath/ath9k/phy.c
index 98b1b56..59bb3ce 100644
--- a/drivers/net/wireless/ath/ath9k/phy.c
+++ b/drivers/net/wireless/ath/ath9k/phy.c
@@ -264,7 +264,7 @@ ath9k_hw_set_rf_regs(struct ath_hw *ah, struct ath9k_channel *chan,
 }
 
 void
-ath9k_hw_rfdetach(struct ath_hw *ah)
+ath9k_hw_rf_free(struct ath_hw *ah)
 {
 #define ATH_FREE_BANK(bank) do { \
 		kfree(bank); \
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 19/24] ath9k: rename ath9k_hw_ani_detach() to ath9k_hw_ani_disable()
  2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
                   ` (16 preceding siblings ...)
  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 ` Luis R. Rodriguez
  2009-08-03 19:24 ` [PATCH 20/24] ath9k: set ah to null after freeing Luis R. Rodriguez
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath/ath9k/ani.c |    4 ++--
 drivers/net/wireless/ath/ath9k/ani.h |    2 +-
 drivers/net/wireless/ath/ath9k/hw.c  |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c
index a613cf4..b709312 100644
--- a/drivers/net/wireless/ath/ath9k/ani.c
+++ b/drivers/net/wireless/ath/ath9k/ani.c
@@ -822,9 +822,9 @@ void ath9k_hw_ani_init(struct ath_hw *ah)
 		ah->proc_phyerr |= HAL_PROCESS_ANI;
 }
 
-void ath9k_hw_ani_detach(struct ath_hw *ah)
+void ath9k_hw_ani_disable(struct ath_hw *ah)
 {
-	DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Detach ANI\n");
+	DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Disabling ANI\n");
 
 	if (ah->has_hw_phycounters) {
 		ath9k_hw_disable_mib_counters(ah);
diff --git a/drivers/net/wireless/ath/ath9k/ani.h b/drivers/net/wireless/ath/ath9k/ani.h
index 803669f..a36b7bb 100644
--- a/drivers/net/wireless/ath/ath9k/ani.h
+++ b/drivers/net/wireless/ath/ath9k/ani.h
@@ -133,6 +133,6 @@ void ath9k_hw_procmibevent(struct ath_hw *ah,
 			   const struct ath9k_node_stats *stats);
 void ath9k_hw_ani_setup(struct ath_hw *ah);
 void ath9k_hw_ani_init(struct ath_hw *ah);
-void ath9k_hw_ani_detach(struct ath_hw *ah);
+void ath9k_hw_ani_disable(struct ath_hw *ah);
 
 #endif /* ANI_H */
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 73dee19..6641fbe 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1227,7 +1227,7 @@ const char *ath9k_hw_probe(u16 vendorid, u16 devid)
 void ath9k_hw_detach(struct ath_hw *ah)
 {
 	if (!AR_SREV_9100(ah))
-		ath9k_hw_ani_detach(ah);
+		ath9k_hw_ani_disable(ah);
 
 	ath9k_hw_rf_free(ah);
 	ath9k_hw_setpower(ah, ATH9K_PM_FULL_SLEEP);
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 20/24] ath9k: set ah to null after freeing
  2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
                   ` (17 preceding siblings ...)
  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 ` Luis R. Rodriguez
  2009-08-03 19:24 ` [PATCH 21/24] ath9k: set sc->sc_ah to NULL after freeing it Luis R. Rodriguez
                   ` (3 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

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

diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 6641fbe..633fe8b 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1232,6 +1232,7 @@ void ath9k_hw_detach(struct ath_hw *ah)
 	ath9k_hw_rf_free(ah);
 	ath9k_hw_setpower(ah, ATH9K_PM_FULL_SLEEP);
 	kfree(ah);
+	ah = NULL;
 }
 
 /*******/
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 21/24] ath9k: set sc->sc_ah to NULL after freeing it
  2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
                   ` (18 preceding siblings ...)
  2009-08-03 19:24 ` [PATCH 20/24] ath9k: set ah to null after freeing Luis R. Rodriguez
@ 2009-08-03 19:24 ` Luis R. Rodriguez
  2009-08-03 19:24 ` [PATCH 22/24] ath9k: call ath9k_hw_detach() once upon hw init failure Luis R. Rodriguez
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

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

diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 91bffc9..d3d2cb6 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1278,6 +1278,7 @@ void ath_detach(struct ath_softc *sc)
 			ath_tx_cleanupq(sc, &sc->tx.txq[i]);
 
 	ath9k_hw_detach(sc->sc_ah);
+	sc->sc_ah = NULL;
 	ath9k_exit_debug(sc);
 }
 
@@ -1521,6 +1522,7 @@ bad2:
 bad:
 	if (ah)
 		ath9k_hw_detach(ah);
+	sc->sc_ah = NULL;
 bad_no_ah:
 	ath9k_exit_debug(sc);
 
@@ -1631,6 +1633,7 @@ error_attach:
 			ath_tx_cleanupq(sc, &sc->tx.txq[i]);
 
 	ath9k_hw_detach(sc->sc_ah);
+	sc->sc_ah = NULL;
 	ath9k_exit_debug(sc);
 
 	return error;
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 22/24] ath9k: call ath9k_hw_detach() once upon hw init failure
  2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
                   ` (19 preceding siblings ...)
  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 ` 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
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

If hw initialization fails (ath9k_hw_init()) on ath_init_softc()
we bail out and call ath9k_hw_detach(). The call ath9k_hw_detach()
is conditional though as ath9k_hw_init() could itself have called
ath9k_hw_detach(). Just describing this is itself a brain twister.
Avoid this nonsense by removing ath9k_hw_detach() from ath9k_hw_init().

Upon hw initialization failure we expect the callers to take care of
the cleanup.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath/ath9k/hw.c   |   24 ++++++++----------------
 drivers/net/wireless/ath/ath9k/main.c |    3 +--
 2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 633fe8b..0871529 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -898,26 +898,22 @@ static void ath9k_hw_init_11a_eeprom_fix(struct ath_hw *ah)
 
 int ath9k_hw_init(struct ath_hw *ah)
 {
-	int r;
+	int r = 0;
 
-	if (!ath9k_hw_devid_supported(ah->hw_version.devid)) {
-		r = -EOPNOTSUPP;
-		goto bad;
-	}
+	if (!ath9k_hw_devid_supported(ah->hw_version.devid))
+		return -EOPNOTSUPP;
 
 	ath9k_hw_init_defaults(ah);
 	ath9k_hw_init_config(ah);
 
 	if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) {
 		DPRINTF(ah->ah_sc, ATH_DBG_FATAL, "Couldn't reset chip\n");
-		r = -EIO;
-		goto bad;
+		return -EIO;
 	}
 
 	if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) {
 		DPRINTF(ah->ah_sc, ATH_DBG_FATAL, "Couldn't wakeup chip\n");
-		r = -EIO;
-		goto bad;
+		return -EIO;
 	}
 
 	if (ah->config.serialize_regmode == SER_REG_MODE_AUTO) {
@@ -939,8 +935,7 @@ int ath9k_hw_init(struct ath_hw *ah)
 			"Mac Chip Rev 0x%02x.%x is not supported by "
 			"this driver\n", ah->hw_version.macVersion,
 			ah->hw_version.macRev);
-		r = -EOPNOTSUPP;
-		goto bad;
+		return -EOPNOTSUPP;
 	}
 
 	if (AR_SREV_9100(ah)) {
@@ -965,7 +960,7 @@ int ath9k_hw_init(struct ath_hw *ah)
 
 	r = ath9k_hw_post_init(ah);
 	if (r)
-		goto bad;
+		return r;
 
 	ath9k_hw_init_mode_gain_regs(ah);
 	ath9k_hw_fill_cap_info(ah);
@@ -975,7 +970,7 @@ int ath9k_hw_init(struct ath_hw *ah)
 	if (r) {
 		DPRINTF(ah->ah_sc, ATH_DBG_FATAL,
 			"Failed to initialize MAC address\n");
-		goto bad;
+		return r;
 	}
 
 	if (AR_SREV_9285(ah))
@@ -986,9 +981,6 @@ int ath9k_hw_init(struct ath_hw *ah)
 	ath9k_init_nfcal_hist_buffer(ah);
 
 	return 0;
-bad:
-	ath9k_hw_detach(ah);
-	return r;
 }
 
 static void ath9k_hw_init_bb(struct ath_hw *ah,
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index d3d2cb6..a5475b7 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1520,8 +1520,7 @@ bad2:
 		if (ATH_TXQ_SETUP(sc, i))
 			ath_tx_cleanupq(sc, &sc->tx.txq[i]);
 bad:
-	if (ah)
-		ath9k_hw_detach(ah);
+	ath9k_hw_detach(ah);
 	sc->sc_ah = NULL;
 bad_no_ah:
 	ath9k_exit_debug(sc);
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 23/24] ath9k: remove dangling error check on keycache reset on hw init
  2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
                   ` (20 preceding siblings ...)
  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 ` Luis R. Rodriguez
  2009-08-03 19:24 ` [PATCH 24/24] ath9k: remove spurious check for channel on keycache reset Luis R. Rodriguez
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

The keycache reset will not fail as right above we ensure
to set the sc->keymax to be <= ah->caps.keycache_size. Just remove
this dangling check.

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

diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index a5475b7..7f412dd 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1363,9 +1363,6 @@ static int ath_init_softc(u16 devid, struct ath_softc *sc)
 	for (i = 0; i < sc->keymax; i++)
 		ath9k_hw_keyreset(ah, (u16) i);
 
-	if (r)
-		goto bad;
-
 	/* default to MONITOR mode */
 	sc->sc_ah->opmode = NL80211_IFTYPE_MONITOR;
 
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 24/24] ath9k: remove spurious check for channel on keycache reset
  2009-08-03 19:24 [PATCH 00/24] ath9k: hw initiazliation cleanup Luis R. Rodriguez
                   ` (21 preceding siblings ...)
  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 ` Luis R. Rodriguez
  22 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:24 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

ath9k_hw_keyreset() has a spurious check for ah->curchan..
remove it.

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

diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 0871529..0d60b35 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2496,9 +2496,6 @@ bool ath9k_hw_keyreset(struct ath_hw *ah, u16 entry)
 
 	}
 
-	if (ah->curchan == NULL)
-		return true;
-
 	return true;
 }
 
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 10/24] ath9k: rename ath9k_hw_newstate() to ath9k_hw_init_defaults()
@ 2009-08-03 19:48 Luis R. Rodriguez
  0 siblings, 0 replies; 25+ messages in thread
From: Luis R. Rodriguez @ 2009-08-03 19:48 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

This reflects better what we are actually doing there.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---

Resend try #2

 drivers/net/wireless/ath/ath9k/hw.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 4f3d7bf..6aee570 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -437,7 +437,7 @@ static void ath9k_hw_set_defaults(struct ath_hw *ah)
 		ah->config.serialize_regmode = SER_REG_MODE_AUTO;
 }
 
-static void ath9k_hw_newstate(struct ath_hw *ah)
+static void ath9k_hw_init_defaults(struct ath_hw *ah)
 {
 	ah->hw_version.magic = AR5416_MAGIC;
 	ah->regulatory.country_code = CTRY_DEFAULT;
@@ -654,7 +654,7 @@ int ath9k_hw_attach(struct ath_hw *ah)
 		goto bad;
 	}
 
-	ath9k_hw_newstate(ah);
+	ath9k_hw_init_defaults(ah);
 	ath9k_hw_set_defaults(ah);
 
 	if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) {
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2009-08-03 19:48 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 07/24] ath9k: call hw initializer directly Luis R. Rodriguez
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
2009-08-03 19:48 [PATCH 10/24] ath9k: rename ath9k_hw_newstate() to ath9k_hw_init_defaults() Luis R. Rodriguez

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).