Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] ath9k_hw: replace magic values in register writes with proper defines
From: Felix Fietkau @ 2011-01-21 17:46 UTC (permalink / raw)
  To: linux-wireless; +Cc: linville, lrodriguez

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
---
 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c |   24 ++++++++++++------------
 drivers/net/wireless/ath/ath9k/ar9003_phy.h    |    2 ++
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index 4819747..a256556 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -3959,19 +3959,19 @@ static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray)
 {
 #define POW_SM(_r, _s)     (((_r) & 0x3f) << (_s))
 	/* make sure forced gain is not set */
-	REG_WRITE(ah, 0xa458, 0);
+	REG_WRITE(ah, AR_PHY_TX_FORCED_GAIN, 0);
 
 	/* Write the OFDM power per rate set */
 
 	/* 6 (LSB), 9, 12, 18 (MSB) */
-	REG_WRITE(ah, 0xa3c0,
+	REG_WRITE(ah, AR_PHY_POWER_TX_RATE(0),
 		  POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 24) |
 		  POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 16) |
 		  POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 8) |
 		  POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 0));
 
 	/* 24 (LSB), 36, 48, 54 (MSB) */
-	REG_WRITE(ah, 0xa3c4,
+	REG_WRITE(ah, AR_PHY_POWER_TX_RATE(1),
 		  POW_SM(pPwrArray[ALL_TARGET_LEGACY_54], 24) |
 		  POW_SM(pPwrArray[ALL_TARGET_LEGACY_48], 16) |
 		  POW_SM(pPwrArray[ALL_TARGET_LEGACY_36], 8) |
@@ -3980,14 +3980,14 @@ static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray)
 	/* Write the CCK power per rate set */
 
 	/* 1L (LSB), reserved, 2L, 2S (MSB) */
-	REG_WRITE(ah, 0xa3c8,
+	REG_WRITE(ah, AR_PHY_POWER_TX_RATE(2),
 		  POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 24) |
 		  POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 16) |
 		  /* POW_SM(txPowerTimes2,  8) | this is reserved for AR9003 */
 		  POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 0));
 
 	/* 5.5L (LSB), 5.5S, 11L, 11S (MSB) */
-	REG_WRITE(ah, 0xa3cc,
+	REG_WRITE(ah, AR_PHY_POWER_TX_RATE(3),
 		  POW_SM(pPwrArray[ALL_TARGET_LEGACY_11S], 24) |
 		  POW_SM(pPwrArray[ALL_TARGET_LEGACY_11L], 16) |
 		  POW_SM(pPwrArray[ALL_TARGET_LEGACY_5S], 8) |
@@ -3997,7 +3997,7 @@ static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray)
 	/* Write the HT20 power per rate set */
 
 	/* 0/8/16 (LSB), 1-3/9-11/17-19, 4, 5 (MSB) */
-	REG_WRITE(ah, 0xa3d0,
+	REG_WRITE(ah, AR_PHY_POWER_TX_RATE(4),
 		  POW_SM(pPwrArray[ALL_TARGET_HT20_5], 24) |
 		  POW_SM(pPwrArray[ALL_TARGET_HT20_4], 16) |
 		  POW_SM(pPwrArray[ALL_TARGET_HT20_1_3_9_11_17_19], 8) |
@@ -4005,7 +4005,7 @@ static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray)
 	    );
 
 	/* 6 (LSB), 7, 12, 13 (MSB) */
-	REG_WRITE(ah, 0xa3d4,
+	REG_WRITE(ah, AR_PHY_POWER_TX_RATE(5),
 		  POW_SM(pPwrArray[ALL_TARGET_HT20_13], 24) |
 		  POW_SM(pPwrArray[ALL_TARGET_HT20_12], 16) |
 		  POW_SM(pPwrArray[ALL_TARGET_HT20_7], 8) |
@@ -4013,7 +4013,7 @@ static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray)
 	    );
 
 	/* 14 (LSB), 15, 20, 21 */
-	REG_WRITE(ah, 0xa3e4,
+	REG_WRITE(ah, AR_PHY_POWER_TX_RATE(9),
 		  POW_SM(pPwrArray[ALL_TARGET_HT20_21], 24) |
 		  POW_SM(pPwrArray[ALL_TARGET_HT20_20], 16) |
 		  POW_SM(pPwrArray[ALL_TARGET_HT20_15], 8) |
@@ -4023,7 +4023,7 @@ static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray)
 	/* Mixed HT20 and HT40 rates */
 
 	/* HT20 22 (LSB), HT20 23, HT40 22, HT40 23 (MSB) */
-	REG_WRITE(ah, 0xa3e8,
+	REG_WRITE(ah, AR_PHY_POWER_TX_RATE(10),
 		  POW_SM(pPwrArray[ALL_TARGET_HT40_23], 24) |
 		  POW_SM(pPwrArray[ALL_TARGET_HT40_22], 16) |
 		  POW_SM(pPwrArray[ALL_TARGET_HT20_23], 8) |
@@ -4035,7 +4035,7 @@ static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray)
 	 * correct PAR difference between HT40 and HT20/LEGACY
 	 * 0/8/16 (LSB), 1-3/9-11/17-19, 4, 5 (MSB)
 	 */
-	REG_WRITE(ah, 0xa3d8,
+	REG_WRITE(ah, AR_PHY_POWER_TX_RATE(6),
 		  POW_SM(pPwrArray[ALL_TARGET_HT40_5], 24) |
 		  POW_SM(pPwrArray[ALL_TARGET_HT40_4], 16) |
 		  POW_SM(pPwrArray[ALL_TARGET_HT40_1_3_9_11_17_19], 8) |
@@ -4043,7 +4043,7 @@ static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray)
 	    );
 
 	/* 6 (LSB), 7, 12, 13 (MSB) */
-	REG_WRITE(ah, 0xa3dc,
+	REG_WRITE(ah, AR_PHY_POWER_TX_RATE(7),
 		  POW_SM(pPwrArray[ALL_TARGET_HT40_13], 24) |
 		  POW_SM(pPwrArray[ALL_TARGET_HT40_12], 16) |
 		  POW_SM(pPwrArray[ALL_TARGET_HT40_7], 8) |
@@ -4051,7 +4051,7 @@ static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray)
 	    );
 
 	/* 14 (LSB), 15, 20, 21 */
-	REG_WRITE(ah, 0xa3ec,
+	REG_WRITE(ah, AR_PHY_POWER_TX_RATE(11),
 		  POW_SM(pPwrArray[ALL_TARGET_HT40_21], 24) |
 		  POW_SM(pPwrArray[ALL_TARGET_HT40_20], 16) |
 		  POW_SM(pPwrArray[ALL_TARGET_HT40_15], 8) |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.h b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
index 59bab6b..8bdda2c 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
@@ -486,6 +486,8 @@
 #define AR_PHY_HEAVYCLIP_40      (AR_SM_BASE + 0x1ac)
 #define AR_PHY_ILLEGAL_TXRATE    (AR_SM_BASE + 0x1b0)
 
+#define AR_PHY_POWER_TX_RATE(_d) (AR_SM_BASE + 0x1c0 + ((_d) << 2))
+
 #define AR_PHY_PWRTX_MAX         (AR_SM_BASE + 0x1f0)
 #define AR_PHY_POWER_TX_SUB      (AR_SM_BASE + 0x1f4)
 
-- 
1.7.3.2


^ permalink raw reply related

* [PATCH] ath9k: add missing ps wakeup/restore calls
From: Felix Fietkau @ 2011-01-21 17:52 UTC (permalink / raw)
  To: linux-wireless; +Cc: linville, lrodriguez

There are several places where ath_reset() was called without proper
calls to ath9k_ps_wakeup/ath9k_ps_restore. To fix this, add those calls
directly to ath_reset and drop them from callers where it makes sense.

Also add them to the config callback around ath_update_txpow to fix a
crash that happens when the tx power changed before any vif is brought up.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@kernel.org
---
 drivers/net/wireless/ath/ath9k/main.c |    8 +++++---
 drivers/net/wireless/ath/ath9k/xmit.c |    2 --
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 086043c..f21e956 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -596,14 +596,12 @@ void ath9k_tasklet(unsigned long data)
 	u32 status = sc->intrstatus;
 	u32 rxmask;
 
-	ath9k_ps_wakeup(sc);
-
 	if (status & ATH9K_INT_FATAL) {
 		ath_reset(sc, true);
-		ath9k_ps_restore(sc);
 		return;
 	}
 
+	ath9k_ps_wakeup(sc);
 	spin_lock(&sc->sc_pcu_lock);
 
 	/*
@@ -980,6 +978,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
 	/* Stop ANI */
 	del_timer_sync(&common->ani.timer);
 
+	ath9k_ps_wakeup(sc);
 	spin_lock_bh(&sc->sc_pcu_lock);
 
 	ieee80211_stop_queues(hw);
@@ -1026,6 +1025,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
 
 	/* Start ANI */
 	ath_start_ani(common);
+	ath9k_ps_restore(sc);
 
 	return r;
 }
@@ -1751,7 +1751,9 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
 
 	if (changed & IEEE80211_CONF_CHANGE_POWER) {
 		sc->config.txpowlimit = 2 * conf->power_level;
+		ath9k_ps_wakeup(sc);
 		ath_update_txpow(sc);
+		ath9k_ps_restore(sc);
 	}
 
 	if (disable_radio) {
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 0ddfdbc..412806b 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -2101,9 +2101,7 @@ static void ath_tx_complete_poll_work(struct work_struct *work)
 	if (needreset) {
 		ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_RESET,
 			"tx hung, resetting the chip\n");
-		ath9k_ps_wakeup(sc);
 		ath_reset(sc, true);
-		ath9k_ps_restore(sc);
 	}
 
 	ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work,
-- 
1.7.3.2


^ permalink raw reply related

* Re: [PATCH 1/3] nl80211: allow passing SSID in nl80211_set_bss
From: Arik Nemtsov @ 2011-01-21 18:01 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Luciano Coelho, John W. Linville
In-Reply-To: <1295556734.3693.53.camel@jlt3.sipsolutions.net>

On Thu, Jan 20, 2011 at 22:52, Johannes Berg <johannes@sipsolutions.net> wrote:
>
> As I also just commented on the corresponding hostapd patch, I'm not
> sure this is sufficient. If this is necessary for probe response
> offloading, I'm tempted to say that we should be honest about it and let
> userspace determine the entire probe response (which will contain the
> correct SSID) since it can be different from the beacon which presumably
> you're now using to generate probe responses.
>

Well the SSID is still needed in its pure form (i.e. not bundled up
inside some skb). The FW needs it in order to decide which probe
requests it will respond to in hidden-SSID mode.
You're talking about adding another set_probe_resp() callback from
hostapd. That makes sense. I'll look into it.

In the meanwhile are there any comments for this portion?

Regards,
Arik

^ permalink raw reply

* [PATCH v2] mac80211:  Optimize scans on current operating channel.
From: greearb @ 2011-01-21 18:05 UTC (permalink / raw)
  To: linux-wireless; +Cc: Ben Greear

From: Ben Greear <greearb@candelatech.com>

This should decrease un-necessary flushes, on/off channel work,
and channel changes in cases where the only scanned channel is
the current operating channel.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---

v2:  Check channels instead of flag when determining if we should
  do a channel change in scan_completed_finish.

:100644 100644 c47d7c0... 59fe5e7... M	net/mac80211/ieee80211_i.h
:100644 100644 1236710... e6de0e7... M	net/mac80211/rx.c
:100644 100644 3e660db... fa0aeb9... M	net/mac80211/scan.c
 net/mac80211/ieee80211_i.h |    5 +++++
 net/mac80211/rx.c          |   11 ++++++++---
 net/mac80211/scan.c        |   41 +++++++++++++++++++++++++----------------
 3 files changed, 38 insertions(+), 19 deletions(-)

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index c47d7c0..59fe5e7 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -660,6 +660,10 @@ struct tpt_led_trigger {
  *	that the scan completed.
  * @SCAN_ABORTED: Set for our scan work function when the driver reported
  *	a scan complete for an aborted scan.
+ * @SCAN_LEFT_OPER_CHANNEL:  Set this flag if the scan process leaves the
+ *      operating channel at any time.  If scanning ONLY the current operating
+ *      channel this flag should not be set, and this will allow fewer
+ *      offchannel changes.
  */
 enum {
 	SCAN_SW_SCANNING,
@@ -667,6 +671,7 @@ enum {
 	SCAN_OFF_CHANNEL,
 	SCAN_COMPLETED,
 	SCAN_ABORTED,
+	SCAN_LEFT_OPER_CHANNEL,
 };
 
 /**
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 1236710..e6de0e7 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -388,6 +388,7 @@ ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx)
 	struct ieee80211_local *local = rx->local;
 	struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb);
 	struct sk_buff *skb = rx->skb;
+	int ret;
 
 	if (likely(!(status->rx_flags & IEEE80211_RX_IN_SCAN)))
 		return RX_CONTINUE;
@@ -396,10 +397,14 @@ ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx)
 		return ieee80211_scan_rx(rx->sdata, skb);
 
 	if (test_bit(SCAN_SW_SCANNING, &local->scanning)) {
-		/* drop all the other packets during a software scan anyway */
-		if (ieee80211_scan_rx(rx->sdata, skb) != RX_QUEUED)
+		ret = ieee80211_scan_rx(rx->sdata, skb);
+		/* drop all the other packets while scanning off channel */
+		if (ret != RX_QUEUED &&
+		    test_bit(SCAN_OFF_CHANNEL, &local->scanning)) {
 			dev_kfree_skb(skb);
-		return RX_QUEUED;
+			return RX_QUEUED;
+		}
+		return ret;
 	}
 
 	/* scanning finished during invoking of handlers */
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 3e660db..fa0aeb9 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -293,11 +293,14 @@ static void __ieee80211_scan_completed_finish(struct ieee80211_hw *hw,
 {
 	struct ieee80211_local *local = hw_to_local(hw);
 
-	ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
+	if ((local->oper_channel != local->hw.conf.channel) || was_hw_scan)
+		ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
+
 	if (!was_hw_scan) {
 		ieee80211_configure_filter(local);
 		drv_sw_scan_complete(local);
-		ieee80211_offchannel_return(local, true);
+		if (test_bit(SCAN_LEFT_OPER_CHANNEL, &local->scanning))
+			ieee80211_offchannel_return(local, true);
 	}
 
 	mutex_lock(&local->mtx);
@@ -397,13 +400,10 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local)
 
 	drv_sw_scan_start(local);
 
-	ieee80211_offchannel_stop_beaconing(local);
-
 	local->leave_oper_channel_time = 0;
 	local->next_scan_state = SCAN_DECISION;
 	local->scan_channel_idx = 0;
-
-	drv_flush(local, false);
+	__clear_bit(SCAN_LEFT_OPER_CHANNEL, &local->scanning);
 
 	ieee80211_configure_filter(local);
 
@@ -543,7 +543,18 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local,
 	}
 	mutex_unlock(&local->iflist_mtx);
 
-	if (local->scan_channel) {
+	next_chan = local->scan_req->channels[local->scan_channel_idx];
+
+	if (local->oper_channel == local->hw.conf.channel) {
+		if (next_chan == local->oper_channel)
+			local->next_scan_state = SCAN_SET_CHANNEL;
+		else
+			/*
+			 * we're on the operating channel currently, let's
+			 * leave that channel now to scan another one
+			 */
+			local->next_scan_state = SCAN_LEAVE_OPER_CHANNEL;
+	} else {
 		/*
 		 * we're currently scanning a different channel, let's
 		 * see if we can scan another channel without interfering
@@ -559,7 +570,6 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local,
 		 *
 		 * Otherwise switch back to the operating channel.
 		 */
-		next_chan = local->scan_req->channels[local->scan_channel_idx];
 
 		bad_latency = time_after(jiffies +
 				ieee80211_scan_get_channel_time(next_chan),
@@ -577,12 +587,6 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local,
 			local->next_scan_state = SCAN_ENTER_OPER_CHANNEL;
 		else
 			local->next_scan_state = SCAN_SET_CHANNEL;
-	} else {
-		/*
-		 * we're on the operating channel currently, let's
-		 * leave that channel now to scan another one
-		 */
-		local->next_scan_state = SCAN_LEAVE_OPER_CHANNEL;
 	}
 
 	*next_delay = 0;
@@ -591,9 +595,12 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local,
 static void ieee80211_scan_state_leave_oper_channel(struct ieee80211_local *local,
 						    unsigned long *next_delay)
 {
+	ieee80211_offchannel_stop_beaconing(local);
+
 	ieee80211_offchannel_stop_station(local);
 
 	__set_bit(SCAN_OFF_CHANNEL, &local->scanning);
+	__set_bit(SCAN_LEFT_OPER_CHANNEL, &local->scanning);
 
 	/*
 	 * What if the nullfunc frames didn't arrive?
@@ -640,8 +647,10 @@ static void ieee80211_scan_state_set_channel(struct ieee80211_local *local,
 	chan = local->scan_req->channels[local->scan_channel_idx];
 
 	local->scan_channel = chan;
-	if (ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL))
-		skip = 1;
+
+	if (chan != local->hw.conf.channel)
+		if (ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL))
+			skip = 1;
 
 	/* advance state machine to next channel/band */
 	local->scan_channel_idx++;
-- 
1.7.2.3


^ permalink raw reply related

* [PATCH 00/83] staging: ath6kl: Style cleanup
From: Vipin Mehta @ 2011-01-21 19:23 UTC (permalink / raw)
  To: greg; +Cc: linux-wireless, vmehta, devel, joe

The following set of patches fixes the driver's coding style in 
accordance with the Linux kernel coding style. The patches ended 
being huge so putting them up on a shared location where they can 
be retrieved using wget.

http://userweb.kernel.org/~vmehta/ath6kl-cleanup.tar.bz2

Joe Perches (83):
  staging: ath6kl: Convert enum A_STATUS to int
  staging: ath6kl: Remove A_SUCCESS macro
  staging: ath6kl: Remove A_FAILED macro
  staging: ath6kl: wmi.h: Convert packed structures with A_BOOL to u32
  staging: ath6kl: Convert bypasswmi to bool
  staging: ath6kl: Remove A_BOOL and TRUE/FALSE
  staging: ath6kl: Convert A_CHAR to char
  staging: ath6kl: Convert A_UINT8 to u8
  staging: ath6kl: Convert A_UINT16 to u16
  staging: ath6kl: Convert A_UINT32 to u32
  staging: ath6kl: Convert A_UINT64 to u64
  staging: ath6kl: Convert A_INT8 to s8
  staging: ath6kl: Convert A_INT16 to s16
  staging: ath6kl: Convert A_INT32 to s32
  staging: ath6kl: Convert (status != A_OK) to (status)
  staging: ath6kl: Remove #define A_OK
  staging: ath6kl: Convert leading spaces to tab indentation
  staging: ath6kl: Remove direct comparisons to true/false
  staging: ath6kl: Cuddle while open braces
  staging: ath6kl: Use do {} while (0) around #defines
  staging: ath6kl: Remove most uses of braces around single statements
  staging: ath6kl: Remove braces around single statement if { foo }
    else uses
  staging: ath6kl: Remove blank lines
  staging: ath6kl: Hoist assigns from ifs
  staging: ath6kl: Cuddle open brace to if
  staging: ath6kl: Cuddle else open brace
  staging: ath6kl: Add space after commas
  staging: ath6kl: Remove spaces before quoted newlines
  staging: ath6kl: Convert A_UCHAR to u8
  staging: ath6kl: Convert A_MEMCPY to memcpy
  staging: ath6kl: Convert A_MEMCMP to memcmp
  staging: ath6kl: Convert A_MALLOC to kmalloc/kzalloc
  staging: ath6kl: Convert A_MALLOC_NOWAIT to
    kmalloc/kzalloc(,GFP_ATOMIC)
  staging: ath6kl: Convert A_FREE to kfree
  staging: ath6kl: Convert A_MEMZERO to memset
  staging: ath6kl: Remove trailing whitespace
  staging: ath6kl: Convert AR_DEBUG_PRINTF to ath6k_dbg
  staging: ath6kl: Convert "if (NULL == var)" tests to "if (!var)"
  staging: ath6kl: Convert "if (var == NULL)" tests to "if (!var)"
  staging: ath6kl: Convert "(var != NULL)" tests to "(var)"
  staging: ath6kl: Convert "(NULL != var)" tests to "(var)"
  staging: ath6kl: Remove "== true" tests
  staging: ath6kl: Convert var == false to !var
  staging: ath6kl: Convert "false == " to !
  staging: ath6kl: Remove "true == "
  staging: ath6kl: Fix miscellaneous whitespace issues
  staging: ath6kl: Cleanup for loops and other whitespace
  staging: ath6kl: More miscelleous whitespace fixing
  staging: ath6kl: osapi_linux: Use ##__VA_ARGS__
  staging: ath6kl: Fix case statements
  staging: ath6kl: ioctl: Use a common status function
  staging: ath6kl: Whitespace corrections around {}
  staging: ath6kl: Deparenthesize returns
  staging: ath6kl: osapi_linux: More whitespace cruft removal
  staging: ath6kl: Add space before pointer
  staging: ath6kl: Convert ath6k_dbg(ATH_DEBUG_ERR to ath6k_err(
  staging: ath6kl: Convert ath6k_dbg(ATH_DEBUG_INFO to ath6k_info(
  staging: ath6kl: Convert ath6k_dbg(ATH_DEBUG_WARN to ath6k_warn(
  staging: ath6kl: Remove KERN_ALERT from A_PRINTF uses
  staging: ath6kl: Remove space after case label in .h file
  staging: ath6kl: Convert INLINE to inline
  staging: ath6kl: Cuddle do and open brace
  staging: ath6kl: Remove space between function and open parenthesis
  staging: ath6kl: Properly indent a switch/case block
  staging: ath6kl: Use proper spacing after u8*
  staging: ath6kl: Use consistent spacing for void *
  staging: ath6kl: Use consistent spacing around == and !=
  staging: ath6kl: Convert ath6k_dbg(ATH_DEBUG_ERROR to ath6k_err(
  staging: ath6kl: Convert __FUNCTION__ to __func__
  staging: ath6kl: Convert _A_FUNCNAME_ to __func__
  staging: ath6kl: Use compare_ether_addr and is_broadcast_ether_addr
  staging: ath6kl: Use is_broadcast_ether_addr and is_zero_ether_addr
  staging: ath6kl: Remove AR6000_ETH_ADDR_LEN use ETH_ALEN
  staging: ath6kl: Convert IEEE80211_IS_MULTICAST to
    is_multicast_ether_addr
  staging: ath6kl: Convert ATH_MAC_LEN to ETH_ALEN, remove ATH_MAC_ALEN
  staging: ath6kl: Convert IEEE80211_ADDR_LEN to ETH_ALEN
  staging: ath6kl: Remove unused #define MAC_ADDR_LEN
  staging: ath6kl: Convert "if (foo) kfree(foo)" to kfree(foo)
  staging: ath6kl: Convert if (ptr) { kfree(ptr); ptr=NULL; }
  staging: ath6kl: Use vsprintf extension %pM for mac addresses
  staging: ath6kl: Remove IS_MAC_NULL
  staging: ath6kl: Flatten directory structure
  staging: ath6kl: Convert include style from <foo> to "foo"

 drivers/staging/ath6kl/Makefile                    |   68 +-
 drivers/staging/ath6kl/ar3kconfig.c                |  524 ++
 drivers/staging/ath6kl/ar3kpsconfig.c              |  532 ++
 drivers/staging/ath6kl/ar3kpsparser.c              |  860 +++
 drivers/staging/ath6kl/ar6000_android.c            |  414 ++
 drivers/staging/ath6kl/ar6000_drv.c                | 6165 +++++++++++++++++
 drivers/staging/ath6kl/ar6000_pm.c                 |  724 ++
 drivers/staging/ath6kl/ar6000_raw_if.c             |  446 ++
 drivers/staging/ath6kl/ar6k.c                      | 1464 ++++
 drivers/staging/ath6kl/ar6k_events.c               |  773 +++
 drivers/staging/ath6kl/ar6k_gmbox.c                |  735 ++
 drivers/staging/ath6kl/ar6k_gmbox_hciuart.c        | 1302 ++++
 drivers/staging/ath6kl/ar6k_pal.c                  |  465 ++
 drivers/staging/ath6kl/bmi.c                       |  999 +++
 drivers/staging/ath6kl/bmi/include/bmi_internal.h  |   55 -
 drivers/staging/ath6kl/bmi/src/bmi.c               | 1010 ---
 drivers/staging/ath6kl/cfg80211.c                  | 1419 ++++
 drivers/staging/ath6kl/common_drv.c                |  981 +++
 drivers/staging/ath6kl/credit_dist.c               |  413 ++
 drivers/staging/ath6kl/dbglog.h                    |  120 +
 drivers/staging/ath6kl/dbglog_id.h                 |  544 ++
 drivers/staging/ath6kl/eeprom.c                    |  559 ++
 drivers/staging/ath6kl/export_hci_transport.c      |  125 +
 drivers/staging/ath6kl/hci_bridge.c                | 1111 +++
 drivers/staging/ath6kl/hif.c                       | 1303 ++++
 .../staging/ath6kl/hif/common/hif_sdio_common.h    |   87 -
 .../hif/sdio/linux_sdio/include/hif_internal.h     |  134 -
 .../staging/ath6kl/hif/sdio/linux_sdio/src/hif.c   | 1298 ----
 .../ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c   |  393 --
 drivers/staging/ath6kl/hif_scatter.c               |  404 ++
 drivers/staging/ath6kl/htc.c                       |  563 ++
 drivers/staging/ath6kl/htc2/AR6000/ar6k.c          | 1471 ----
 drivers/staging/ath6kl/htc2/AR6000/ar6k.h          |  398 --
 drivers/staging/ath6kl/htc2/AR6000/ar6k_events.c   |  784 ---
 drivers/staging/ath6kl/htc2/AR6000/ar6k_gmbox.c    |  756 ---
 .../ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c        | 1280 ----
 drivers/staging/ath6kl/htc2/htc.c                  |  579 --
 drivers/staging/ath6kl/htc2/htc_debug.h            |   38 -
 drivers/staging/ath6kl/htc2/htc_internal.h         |  220 -
 drivers/staging/ath6kl/htc2/htc_recv.c             | 1578 -----
 drivers/staging/ath6kl/htc2/htc_send.c             | 1023 ---
 drivers/staging/ath6kl/htc2/htc_services.c         |  450 --
 drivers/staging/ath6kl/htc_recv.c                  | 1570 +++++
 drivers/staging/ath6kl/htc_send.c                  | 1052 +++
 drivers/staging/ath6kl/htc_services.c              |  440 ++
 drivers/staging/ath6kl/include/AR6002_regdump.h    |   60 +
 drivers/staging/ath6kl/include/AR6K_version.h      |   54 +
 drivers/staging/ath6kl/include/a_config.h          |   24 +-
 drivers/staging/ath6kl/include/a_debug.h           |   93 +-
 drivers/staging/ath6kl/include/a_drv.h             |   24 +-
 drivers/staging/ath6kl/include/a_drv_api.h         |  110 +-
 drivers/staging/ath6kl/include/a_hci.h             |  648 ++
 drivers/staging/ath6kl/include/a_osapi.h           |   31 +-
 drivers/staging/ath6kl/include/a_types.h           |   28 +-
 drivers/staging/ath6kl/include/addrs.h             |   86 +
 drivers/staging/ath6kl/include/aggr_recv_api.h     |   50 +-
 drivers/staging/ath6kl/include/aggr_rx_internal.h  |  114 +
 drivers/staging/ath6kl/include/ar3kconfig.h        |   35 +-
 drivers/staging/ath6kl/include/ar3kpsconfig.h      |   70 +
 drivers/staging/ath6kl/include/ar3kpsparser.h      |  113 +
 drivers/staging/ath6kl/include/ar6000_api.h        |   25 +-
 drivers/staging/ath6kl/include/ar6000_diag.h       |   29 +-
 drivers/staging/ath6kl/include/ar6000_drv.h        |  774 +++
 drivers/staging/ath6kl/include/ar6k.h              |  399 ++
 drivers/staging/ath6kl/include/ar6k_pal.h          |   36 +
 drivers/staging/ath6kl/include/ar6kap_common.h     |   14 +-
 drivers/staging/ath6kl/include/ar6xapi_linux.h     |  195 +
 drivers/staging/ath6kl/include/athbtfilter.h       |  145 +-
 drivers/staging/ath6kl/include/athdefs.h           |   75 +
 drivers/staging/ath6kl/include/athdrv_linux.h      | 1190 ++++
 drivers/staging/ath6kl/include/athendpack.h        |   27 +-
 drivers/staging/ath6kl/include/athstartpack.h      |   29 +-
 drivers/staging/ath6kl/include/athtypes_linux.h    |   51 +
 drivers/staging/ath6kl/include/bmi.h               |  108 +-
 drivers/staging/ath6kl/include/bmi_internal.h      |   54 +
 drivers/staging/ath6kl/include/bmi_msg.h           |  238 +
 drivers/staging/ath6kl/include/btcoexGpio.h        |   77 +
 drivers/staging/ath6kl/include/cfg80211.h          |   44 +
 drivers/staging/ath6kl/include/cnxmgmt.h           |   36 +
 .../ath6kl/include/common/AR6002/AR6002_regdump.h  |   60 -
 .../ath6kl/include/common/AR6002/AR6K_version.h    |   52 -
 .../staging/ath6kl/include/common/AR6002/addrs.h   |   90 -
 .../common/AR6002/hw2.0/hw/analog_intf_reg.h       |   64 -
 .../include/common/AR6002/hw2.0/hw/analog_reg.h    | 1932 ------
 .../include/common/AR6002/hw2.0/hw/apb_map.h       |   13 -
 .../include/common/AR6002/hw2.0/hw/gpio_reg.h      |  977 ---
 .../include/common/AR6002/hw2.0/hw/mbox_host_reg.h |  386 --
 .../include/common/AR6002/hw2.0/hw/mbox_reg.h      |  481 --
 .../include/common/AR6002/hw2.0/hw/rtc_reg.h       | 1163 ----
 .../ath6kl/include/common/AR6002/hw2.0/hw/si_reg.h |  186 -
 .../include/common/AR6002/hw2.0/hw/uart_reg.h      |  327 -
 .../include/common/AR6002/hw2.0/hw/vmc_reg.h       |   76 -
 .../common/AR6002/hw4.0/hw/analog_intf_ares_reg.h  | 3291 ---------
 .../AR6002/hw4.0/hw/analog_intf_athr_wlan_reg.h    | 3674 ----------
 .../common/AR6002/hw4.0/hw/analog_intf_reg.h       |   37 -
 .../common/AR6002/hw4.0/hw/apb_athr_wlan_map.h     |   40 -
 .../include/common/AR6002/hw4.0/hw/apb_map.h       |   48 -
 .../include/common/AR6002/hw4.0/hw/bb_lc_reg.h     | 7076 --------------------
 .../include/common/AR6002/hw4.0/hw/efuse_reg.h     |  108 -
 .../common/AR6002/hw4.0/hw/gpio_athr_wlan_reg.h    | 1253 ----
 .../include/common/AR6002/hw4.0/hw/gpio_reg.h      | 1094 ---
 .../include/common/AR6002/hw4.0/hw/mac_dma_reg.h   |  605 --
 .../include/common/AR6002/hw4.0/hw/mac_pcu_reg.h   | 3065 ---------
 .../include/common/AR6002/hw4.0/hw/mbox_host_reg.h |   37 -
 .../include/common/AR6002/hw4.0/hw/mbox_reg.h      |  560 --
 .../common/AR6002/hw4.0/hw/mbox_wlan_host_reg.h    |  522 --
 .../include/common/AR6002/hw4.0/hw/mbox_wlan_reg.h |  638 --
 .../include/common/AR6002/hw4.0/hw/rdma_reg.h      |  564 --
 .../include/common/AR6002/hw4.0/hw/rtc_reg.h       |  975 ---
 .../include/common/AR6002/hw4.0/hw/rtc_wlan_reg.h  | 2065 ------
 .../ath6kl/include/common/AR6002/hw4.0/hw/si_reg.h |  209 -
 .../include/common/AR6002/hw4.0/hw/uart_reg.h      |  260 -
 .../include/common/AR6002/hw4.0/hw/umbox_reg.h     |   37 -
 .../common/AR6002/hw4.0/hw/umbox_wlan_reg.h        |  322 -
 .../include/common/AR6002/hw4.0/hw/vmc_reg.h       |  167 -
 .../include/common/AR6002/hw4.0/hw/vmc_wlan_reg.h  |  195 -
 drivers/staging/ath6kl/include/common/a_hci.h      |  682 --
 drivers/staging/ath6kl/include/common/athdefs.h    |   84 -
 drivers/staging/ath6kl/include/common/bmi_msg.h    |  241 -
 drivers/staging/ath6kl/include/common/btcoexGpio.h |   86 -
 drivers/staging/ath6kl/include/common/cnxmgmt.h    |   36 -
 drivers/staging/ath6kl/include/common/dbglog.h     |  134 -
 drivers/staging/ath6kl/include/common/dbglog_id.h  |  558 --
 drivers/staging/ath6kl/include/common/discovery.h  |   75 -
 .../staging/ath6kl/include/common/dset_internal.h  |   63 -
 drivers/staging/ath6kl/include/common/dsetid.h     |  134 -
 .../staging/ath6kl/include/common/epping_test.h    |  120 -
 drivers/staging/ath6kl/include/common/gmboxif.h    |   78 -
 drivers/staging/ath6kl/include/common/gpio.h       |   45 -
 drivers/staging/ath6kl/include/common/htc.h        |  236 -
 .../staging/ath6kl/include/common/htc_services.h   |   52 -
 drivers/staging/ath6kl/include/common/ini_dset.h   |   82 -
 drivers/staging/ath6kl/include/common/pkt_log.h    |   45 -
 drivers/staging/ath6kl/include/common/regDb.h      |   29 -
 drivers/staging/ath6kl/include/common/regdump.h    |   59 -
 .../include/common/regulatory/reg_dbschema.h       |  237 -
 .../include/common/regulatory/reg_dbvalues.h       |  504 --
 drivers/staging/ath6kl/include/common/roaming.h    |   41 -
 drivers/staging/ath6kl/include/common/targaddrs.h  |  245 -
 drivers/staging/ath6kl/include/common/testcmd.h    |  185 -
 drivers/staging/ath6kl/include/common/tlpm.h       |   38 -
 drivers/staging/ath6kl/include/common/wlan_defs.h  |   79 -
 drivers/staging/ath6kl/include/common/wlan_dset.h  |   33 -
 drivers/staging/ath6kl/include/common/wmi.h        | 3119 ---------
 drivers/staging/ath6kl/include/common/wmi_thin.h   |  347 -
 drivers/staging/ath6kl/include/common/wmix.h       |  279 -
 drivers/staging/ath6kl/include/common_drv.h        |   58 +-
 drivers/staging/ath6kl/include/config_linux.h      |   60 +
 drivers/staging/ath6kl/include/dbglog.h            |  134 +
 drivers/staging/ath6kl/include/dbglog_api.h        |   10 +-
 drivers/staging/ath6kl/include/dbglog_id.h         |  557 ++
 drivers/staging/ath6kl/include/debug_linux.h       |   79 +
 drivers/staging/ath6kl/include/discovery.h         |   75 +
 drivers/staging/ath6kl/include/dl_list.h           |  162 +-
 drivers/staging/ath6kl/include/dset_api.h          |   33 +-
 drivers/staging/ath6kl/include/dset_internal.h     |   62 +
 drivers/staging/ath6kl/include/dsetid.h            |  133 +
 drivers/staging/ath6kl/include/epping_test.h       |  121 +
 .../staging/ath6kl/include/export_hci_transport.h  |   74 +
 drivers/staging/ath6kl/include/gmboxif.h           |   75 +
 drivers/staging/ath6kl/include/gpio.h              |   45 +
 drivers/staging/ath6kl/include/gpio_api.h          |   24 +-
 drivers/staging/ath6kl/include/hci_transport_api.h |  177 +-
 drivers/staging/ath6kl/include/hif.h               |  293 +-
 drivers/staging/ath6kl/include/hif_internal.h      |  133 +
 drivers/staging/ath6kl/include/hif_sdio_common.h   |   87 +
 drivers/staging/ath6kl/include/host_version.h      |    6 +-
 drivers/staging/ath6kl/include/htc.h               |  234 +
 drivers/staging/ath6kl/include/htc_api.h           |  453 +-
 drivers/staging/ath6kl/include/htc_debug.h         |   37 +
 drivers/staging/ath6kl/include/htc_internal.h      |  229 +
 drivers/staging/ath6kl/include/htc_packet.h        |  287 +-
 drivers/staging/ath6kl/include/htc_services.h      |   52 +
 .../staging/ath6kl/include/hw2.0/analog_intf_reg.h |   63 +
 drivers/staging/ath6kl/include/hw2.0/analog_reg.h  | 1931 ++++++
 drivers/staging/ath6kl/include/hw2.0/apb_map.h     |   13 +
 drivers/staging/ath6kl/include/hw2.0/gpio_reg.h    |  976 +++
 .../staging/ath6kl/include/hw2.0/mbox_host_reg.h   |  385 ++
 drivers/staging/ath6kl/include/hw2.0/mbox_reg.h    |  480 ++
 drivers/staging/ath6kl/include/hw2.0/rtc_reg.h     | 1162 ++++
 drivers/staging/ath6kl/include/hw2.0/si_reg.h      |  185 +
 drivers/staging/ath6kl/include/hw2.0/uart_reg.h    |  326 +
 drivers/staging/ath6kl/include/hw2.0/vmc_reg.h     |   75 +
 .../ath6kl/include/hw4.0/analog_intf_ares_reg.h    | 3288 +++++++++
 .../include/hw4.0/analog_intf_athr_wlan_reg.h      | 3671 ++++++++++
 .../staging/ath6kl/include/hw4.0/analog_intf_reg.h |   30 +
 .../ath6kl/include/hw4.0/apb_athr_wlan_map.h       |   39 +
 drivers/staging/ath6kl/include/hw4.0/apb_map.h     |   42 +
 drivers/staging/ath6kl/include/hw4.0/bb_lc_reg.h   | 7073 +++++++++++++++++++
 drivers/staging/ath6kl/include/hw4.0/efuse_reg.h   |  106 +
 .../ath6kl/include/hw4.0/gpio_athr_wlan_reg.h      | 1251 ++++
 drivers/staging/ath6kl/include/hw4.0/gpio_reg.h    | 1088 +++
 drivers/staging/ath6kl/include/hw4.0/mac_dma_reg.h |  599 ++
 drivers/staging/ath6kl/include/hw4.0/mac_pcu_reg.h | 3063 +++++++++
 .../staging/ath6kl/include/hw4.0/mbox_host_reg.h   |   30 +
 drivers/staging/ath6kl/include/hw4.0/mbox_reg.h    |  554 ++
 .../ath6kl/include/hw4.0/mbox_wlan_host_reg.h      |  520 ++
 .../staging/ath6kl/include/hw4.0/mbox_wlan_reg.h   |  636 ++
 drivers/staging/ath6kl/include/hw4.0/rdma_reg.h    |  562 ++
 drivers/staging/ath6kl/include/hw4.0/rtc_reg.h     |  969 +++
 .../staging/ath6kl/include/hw4.0/rtc_wlan_reg.h    | 2063 ++++++
 drivers/staging/ath6kl/include/hw4.0/si_reg.h      |  207 +
 drivers/staging/ath6kl/include/hw4.0/uart_reg.h    |  258 +
 drivers/staging/ath6kl/include/hw4.0/umbox_reg.h   |   30 +
 .../staging/ath6kl/include/hw4.0/umbox_wlan_reg.h  |  320 +
 drivers/staging/ath6kl/include/hw4.0/vmc_reg.h     |  161 +
 .../staging/ath6kl/include/hw4.0/vmc_wlan_reg.h    |  193 +
 drivers/staging/ath6kl/include/ieee80211.h         |  396 ++
 drivers/staging/ath6kl/include/ieee80211_ioctl.h   |  179 +
 drivers/staging/ath6kl/include/ieee80211_node.h    |   96 +
 drivers/staging/ath6kl/include/ini_dset.h          |   82 +
 drivers/staging/ath6kl/include/miscdrv.h           |   40 +
 drivers/staging/ath6kl/include/osapi_linux.h       |  421 ++
 drivers/staging/ath6kl/include/pkt_log.h           |   43 +
 drivers/staging/ath6kl/include/regDb.h             |   29 +
 drivers/staging/ath6kl/include/reg_dbschema.h      |  231 +
 drivers/staging/ath6kl/include/reg_dbvalues.h      |  495 ++
 drivers/staging/ath6kl/include/regdump.h           |   59 +
 drivers/staging/ath6kl/include/roaming.h           |   41 +
 drivers/staging/ath6kl/include/targaddrs.h         |  243 +
 drivers/staging/ath6kl/include/target_reg_table.h  |  256 +-
 drivers/staging/ath6kl/include/testcmd.h           |  185 +
 drivers/staging/ath6kl/include/tlpm.h              |   38 +
 drivers/staging/ath6kl/include/wlan_api.h          |  105 +-
 drivers/staging/ath6kl/include/wlan_config.h       |  111 +
 drivers/staging/ath6kl/include/wlan_defs.h         |   83 +
 drivers/staging/ath6kl/include/wlan_dset.h         |   33 +
 drivers/staging/ath6kl/include/wmi.h               | 3090 +++++++++
 drivers/staging/ath6kl/include/wmi_api.h           |  549 +-
 drivers/staging/ath6kl/include/wmi_filter_linux.h  |  289 +
 drivers/staging/ath6kl/include/wmi_host.h          |  102 +
 drivers/staging/ath6kl/include/wmi_thin.h          |  349 +
 drivers/staging/ath6kl/include/wmix.h              |  278 +
 drivers/staging/ath6kl/ioctl.c                     | 4123 ++++++++++++
 drivers/staging/ath6kl/miscdrv/ar3kconfig.c        |  566 --
 .../staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c   |  572 --
 .../staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.h   |   75 -
 .../staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c   |  969 ---
 .../staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.h   |  127 -
 drivers/staging/ath6kl/miscdrv/common_drv.c        | 1027 ---
 drivers/staging/ath6kl/miscdrv/credit_dist.c       |  418 --
 drivers/staging/ath6kl/miscdrv/miscdrv.h           |   42 -
 drivers/staging/ath6kl/netbuf.c                    |  230 +
 drivers/staging/ath6kl/os/linux/ar6000_android.c   |  413 --
 drivers/staging/ath6kl/os/linux/ar6000_drv.c       | 6444 ------------------
 drivers/staging/ath6kl/os/linux/ar6000_pm.c        |  731 --
 drivers/staging/ath6kl/os/linux/ar6000_raw_if.c    |  455 --
 drivers/staging/ath6kl/os/linux/ar6k_pal.c         |  481 --
 drivers/staging/ath6kl/os/linux/cfg80211.c         | 1471 ----
 drivers/staging/ath6kl/os/linux/eeprom.c           |  574 --
 .../staging/ath6kl/os/linux/export_hci_transport.c |  125 -
 drivers/staging/ath6kl/os/linux/hci_bridge.c       | 1144 ----
 .../staging/ath6kl/os/linux/include/ar6000_drv.h   |  762 ---
 drivers/staging/ath6kl/os/linux/include/ar6k_pal.h |   36 -
 .../ath6kl/os/linux/include/ar6xapi_linux.h        |  197 -
 .../staging/ath6kl/os/linux/include/athdrv_linux.h | 1219 ----
 .../ath6kl/os/linux/include/athtypes_linux.h       |   53 -
 drivers/staging/ath6kl/os/linux/include/cfg80211.h |   50 -
 .../staging/ath6kl/os/linux/include/config_linux.h |   60 -
 .../staging/ath6kl/os/linux/include/debug_linux.h  |   50 -
 .../ath6kl/os/linux/include/export_hci_transport.h |   76 -
 .../ath6kl/os/linux/include/ieee80211_ioctl.h      |  179 -
 .../staging/ath6kl/os/linux/include/osapi_linux.h  |  387 --
 .../staging/ath6kl/os/linux/include/wlan_config.h  |  111 -
 .../ath6kl/os/linux/include/wmi_filter_linux.h     |  293 -
 drivers/staging/ath6kl/os/linux/ioctl.c            | 4733 -------------
 drivers/staging/ath6kl/os/linux/netbuf.c           |  234 -
 drivers/staging/ath6kl/os/linux/wireless_ext.c     | 2725 --------
 drivers/staging/ath6kl/rcv_aggr.c                  |  636 ++
 drivers/staging/ath6kl/reorder/aggr_rx_internal.h  |  116 -
 drivers/staging/ath6kl/reorder/rcv_aggr.c          |  666 --
 drivers/staging/ath6kl/wireless_ext.c              | 2543 +++++++
 drivers/staging/ath6kl/wlan/include/ieee80211.h    |  401 --
 .../staging/ath6kl/wlan/include/ieee80211_node.h   |   93 -
 drivers/staging/ath6kl/wlan/src/wlan_node.c        |  636 --
 drivers/staging/ath6kl/wlan/src/wlan_recv_beacon.c |  200 -
 drivers/staging/ath6kl/wlan/src/wlan_utils.c       |   61 -
 drivers/staging/ath6kl/wlan_node.c                 |  561 ++
 drivers/staging/ath6kl/wlan_recv_beacon.c          |  198 +
 drivers/staging/ath6kl/wlan_utils.c                |   58 +
 drivers/staging/ath6kl/wmi.c                       | 6376 ++++++++++++++++++
 drivers/staging/ath6kl/wmi/wmi.c                   | 6670 ------------------
 drivers/staging/ath6kl/wmi/wmi_host.h              |  102 -
 283 files changed, 88023 insertions(+), 89618 deletions(-)
 create mode 100644 drivers/staging/ath6kl/ar3kconfig.c
 create mode 100644 drivers/staging/ath6kl/ar3kpsconfig.c
 create mode 100644 drivers/staging/ath6kl/ar3kpsparser.c
 create mode 100644 drivers/staging/ath6kl/ar6000_android.c
 create mode 100644 drivers/staging/ath6kl/ar6000_drv.c
 create mode 100644 drivers/staging/ath6kl/ar6000_pm.c
 create mode 100644 drivers/staging/ath6kl/ar6000_raw_if.c
 create mode 100644 drivers/staging/ath6kl/ar6k.c
 create mode 100644 drivers/staging/ath6kl/ar6k_events.c
 create mode 100644 drivers/staging/ath6kl/ar6k_gmbox.c
 create mode 100644 drivers/staging/ath6kl/ar6k_gmbox_hciuart.c
 create mode 100644 drivers/staging/ath6kl/ar6k_pal.c
 create mode 100644 drivers/staging/ath6kl/bmi.c
 delete mode 100644 drivers/staging/ath6kl/bmi/include/bmi_internal.h
 delete mode 100644 drivers/staging/ath6kl/bmi/src/bmi.c
 create mode 100644 drivers/staging/ath6kl/cfg80211.c
 create mode 100644 drivers/staging/ath6kl/common_drv.c
 create mode 100644 drivers/staging/ath6kl/credit_dist.c
 create mode 100644 drivers/staging/ath6kl/dbglog.h
 create mode 100644 drivers/staging/ath6kl/dbglog_id.h
 create mode 100644 drivers/staging/ath6kl/eeprom.c
 create mode 100644 drivers/staging/ath6kl/export_hci_transport.c
 create mode 100644 drivers/staging/ath6kl/hci_bridge.c
 create mode 100644 drivers/staging/ath6kl/hif.c
 delete mode 100644 drivers/staging/ath6kl/hif/common/hif_sdio_common.h
 delete mode 100644 drivers/staging/ath6kl/hif/sdio/linux_sdio/include/hif_internal.h
 delete mode 100644 drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
 delete mode 100644 drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c
 create mode 100644 drivers/staging/ath6kl/hif_scatter.c
 create mode 100644 drivers/staging/ath6kl/htc.c
 delete mode 100644 drivers/staging/ath6kl/htc2/AR6000/ar6k.c
 delete mode 100644 drivers/staging/ath6kl/htc2/AR6000/ar6k.h
 delete mode 100644 drivers/staging/ath6kl/htc2/AR6000/ar6k_events.c
 delete mode 100644 drivers/staging/ath6kl/htc2/AR6000/ar6k_gmbox.c
 delete mode 100644 drivers/staging/ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c
 delete mode 100644 drivers/staging/ath6kl/htc2/htc.c
 delete mode 100644 drivers/staging/ath6kl/htc2/htc_debug.h
 delete mode 100644 drivers/staging/ath6kl/htc2/htc_internal.h
 delete mode 100644 drivers/staging/ath6kl/htc2/htc_recv.c
 delete mode 100644 drivers/staging/ath6kl/htc2/htc_send.c
 delete mode 100644 drivers/staging/ath6kl/htc2/htc_services.c
 create mode 100644 drivers/staging/ath6kl/htc_recv.c
 create mode 100644 drivers/staging/ath6kl/htc_send.c
 create mode 100644 drivers/staging/ath6kl/htc_services.c
 create mode 100644 drivers/staging/ath6kl/include/AR6002_regdump.h
 create mode 100644 drivers/staging/ath6kl/include/AR6K_version.h
 create mode 100644 drivers/staging/ath6kl/include/a_hci.h
 create mode 100644 drivers/staging/ath6kl/include/addrs.h
 create mode 100644 drivers/staging/ath6kl/include/aggr_rx_internal.h
 create mode 100644 drivers/staging/ath6kl/include/ar3kpsconfig.h
 create mode 100644 drivers/staging/ath6kl/include/ar3kpsparser.h
 create mode 100644 drivers/staging/ath6kl/include/ar6000_drv.h
 create mode 100644 drivers/staging/ath6kl/include/ar6k.h
 create mode 100644 drivers/staging/ath6kl/include/ar6k_pal.h
 create mode 100644 drivers/staging/ath6kl/include/ar6xapi_linux.h
 create mode 100644 drivers/staging/ath6kl/include/athdefs.h
 create mode 100644 drivers/staging/ath6kl/include/athdrv_linux.h
 create mode 100644 drivers/staging/ath6kl/include/athtypes_linux.h
 create mode 100644 drivers/staging/ath6kl/include/bmi_internal.h
 create mode 100644 drivers/staging/ath6kl/include/bmi_msg.h
 create mode 100644 drivers/staging/ath6kl/include/btcoexGpio.h
 create mode 100644 drivers/staging/ath6kl/include/cfg80211.h
 create mode 100644 drivers/staging/ath6kl/include/cnxmgmt.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/AR6002_regdump.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/AR6K_version.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/addrs.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw2.0/hw/analog_intf_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw2.0/hw/analog_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw2.0/hw/apb_map.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw2.0/hw/gpio_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw2.0/hw/mbox_host_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw2.0/hw/mbox_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw2.0/hw/rtc_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw2.0/hw/si_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw2.0/hw/uart_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw2.0/hw/vmc_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/analog_intf_ares_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/analog_intf_athr_wlan_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/analog_intf_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/apb_athr_wlan_map.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/apb_map.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/bb_lc_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/efuse_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/gpio_athr_wlan_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/gpio_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/mac_dma_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/mac_pcu_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/mbox_host_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/mbox_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/mbox_wlan_host_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/mbox_wlan_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/rdma_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/rtc_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/rtc_wlan_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/si_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/uart_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/umbox_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/umbox_wlan_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/vmc_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/AR6002/hw4.0/hw/vmc_wlan_reg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/a_hci.h
 delete mode 100644 drivers/staging/ath6kl/include/common/athdefs.h
 delete mode 100644 drivers/staging/ath6kl/include/common/bmi_msg.h
 delete mode 100644 drivers/staging/ath6kl/include/common/btcoexGpio.h
 delete mode 100644 drivers/staging/ath6kl/include/common/cnxmgmt.h
 delete mode 100644 drivers/staging/ath6kl/include/common/dbglog.h
 delete mode 100644 drivers/staging/ath6kl/include/common/dbglog_id.h
 delete mode 100644 drivers/staging/ath6kl/include/common/discovery.h
 delete mode 100644 drivers/staging/ath6kl/include/common/dset_internal.h
 delete mode 100644 drivers/staging/ath6kl/include/common/dsetid.h
 delete mode 100644 drivers/staging/ath6kl/include/common/epping_test.h
 delete mode 100644 drivers/staging/ath6kl/include/common/gmboxif.h
 delete mode 100644 drivers/staging/ath6kl/include/common/gpio.h
 delete mode 100644 drivers/staging/ath6kl/include/common/htc.h
 delete mode 100644 drivers/staging/ath6kl/include/common/htc_services.h
 delete mode 100644 drivers/staging/ath6kl/include/common/ini_dset.h
 delete mode 100644 drivers/staging/ath6kl/include/common/pkt_log.h
 delete mode 100644 drivers/staging/ath6kl/include/common/regDb.h
 delete mode 100644 drivers/staging/ath6kl/include/common/regdump.h
 delete mode 100644 drivers/staging/ath6kl/include/common/regulatory/reg_dbschema.h
 delete mode 100644 drivers/staging/ath6kl/include/common/regulatory/reg_dbvalues.h
 delete mode 100644 drivers/staging/ath6kl/include/common/roaming.h
 delete mode 100644 drivers/staging/ath6kl/include/common/targaddrs.h
 delete mode 100644 drivers/staging/ath6kl/include/common/testcmd.h
 delete mode 100644 drivers/staging/ath6kl/include/common/tlpm.h
 delete mode 100644 drivers/staging/ath6kl/include/common/wlan_defs.h
 delete mode 100644 drivers/staging/ath6kl/include/common/wlan_dset.h
 delete mode 100644 drivers/staging/ath6kl/include/common/wmi.h
 delete mode 100644 drivers/staging/ath6kl/include/common/wmi_thin.h
 delete mode 100644 drivers/staging/ath6kl/include/common/wmix.h
 create mode 100644 drivers/staging/ath6kl/include/config_linux.h
 create mode 100644 drivers/staging/ath6kl/include/dbglog.h
 create mode 100644 drivers/staging/ath6kl/include/dbglog_id.h
 create mode 100644 drivers/staging/ath6kl/include/debug_linux.h
 create mode 100644 drivers/staging/ath6kl/include/discovery.h
 create mode 100644 drivers/staging/ath6kl/include/dset_internal.h
 create mode 100644 drivers/staging/ath6kl/include/dsetid.h
 create mode 100644 drivers/staging/ath6kl/include/epping_test.h
 create mode 100644 drivers/staging/ath6kl/include/export_hci_transport.h
 create mode 100644 drivers/staging/ath6kl/include/gmboxif.h
 create mode 100644 drivers/staging/ath6kl/include/gpio.h
 create mode 100644 drivers/staging/ath6kl/include/hif_internal.h
 create mode 100644 drivers/staging/ath6kl/include/hif_sdio_common.h
 create mode 100644 drivers/staging/ath6kl/include/htc.h
 create mode 100644 drivers/staging/ath6kl/include/htc_debug.h
 create mode 100644 drivers/staging/ath6kl/include/htc_internal.h
 create mode 100644 drivers/staging/ath6kl/include/htc_services.h
 create mode 100644 drivers/staging/ath6kl/include/hw2.0/analog_intf_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw2.0/analog_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw2.0/apb_map.h
 create mode 100644 drivers/staging/ath6kl/include/hw2.0/gpio_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw2.0/mbox_host_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw2.0/mbox_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw2.0/rtc_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw2.0/si_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw2.0/uart_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw2.0/vmc_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/analog_intf_ares_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/analog_intf_athr_wlan_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/analog_intf_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/apb_athr_wlan_map.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/apb_map.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/bb_lc_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/efuse_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/gpio_athr_wlan_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/gpio_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/mac_dma_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/mac_pcu_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/mbox_host_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/mbox_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/mbox_wlan_host_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/mbox_wlan_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/rdma_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/rtc_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/rtc_wlan_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/si_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/uart_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/umbox_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/umbox_wlan_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/vmc_reg.h
 create mode 100644 drivers/staging/ath6kl/include/hw4.0/vmc_wlan_reg.h
 create mode 100644 drivers/staging/ath6kl/include/ieee80211.h
 create mode 100644 drivers/staging/ath6kl/include/ieee80211_ioctl.h
 create mode 100644 drivers/staging/ath6kl/include/ieee80211_node.h
 create mode 100644 drivers/staging/ath6kl/include/ini_dset.h
 create mode 100644 drivers/staging/ath6kl/include/miscdrv.h
 create mode 100644 drivers/staging/ath6kl/include/osapi_linux.h
 create mode 100644 drivers/staging/ath6kl/include/pkt_log.h
 create mode 100644 drivers/staging/ath6kl/include/regDb.h
 create mode 100644 drivers/staging/ath6kl/include/reg_dbschema.h
 create mode 100644 drivers/staging/ath6kl/include/reg_dbvalues.h
 create mode 100644 drivers/staging/ath6kl/include/regdump.h
 create mode 100644 drivers/staging/ath6kl/include/roaming.h
 create mode 100644 drivers/staging/ath6kl/include/targaddrs.h
 create mode 100644 drivers/staging/ath6kl/include/testcmd.h
 create mode 100644 drivers/staging/ath6kl/include/tlpm.h
 create mode 100644 drivers/staging/ath6kl/include/wlan_config.h
 create mode 100644 drivers/staging/ath6kl/include/wlan_defs.h
 create mode 100644 drivers/staging/ath6kl/include/wlan_dset.h
 create mode 100644 drivers/staging/ath6kl/include/wmi.h
 create mode 100644 drivers/staging/ath6kl/include/wmi_filter_linux.h
 create mode 100644 drivers/staging/ath6kl/include/wmi_host.h
 create mode 100644 drivers/staging/ath6kl/include/wmi_thin.h
 create mode 100644 drivers/staging/ath6kl/include/wmix.h
 create mode 100644 drivers/staging/ath6kl/ioctl.c
 delete mode 100644 drivers/staging/ath6kl/miscdrv/ar3kconfig.c
 delete mode 100644 drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c
 delete mode 100644 drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.h
 delete mode 100644 drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c
 delete mode 100644 drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.h
 delete mode 100644 drivers/staging/ath6kl/miscdrv/common_drv.c
 delete mode 100644 drivers/staging/ath6kl/miscdrv/credit_dist.c
 delete mode 100644 drivers/staging/ath6kl/miscdrv/miscdrv.h
 create mode 100644 drivers/staging/ath6kl/netbuf.c
 delete mode 100644 drivers/staging/ath6kl/os/linux/ar6000_android.c
 delete mode 100644 drivers/staging/ath6kl/os/linux/ar6000_drv.c
 delete mode 100644 drivers/staging/ath6kl/os/linux/ar6000_pm.c
 delete mode 100644 drivers/staging/ath6kl/os/linux/ar6000_raw_if.c
 delete mode 100644 drivers/staging/ath6kl/os/linux/ar6k_pal.c
 delete mode 100644 drivers/staging/ath6kl/os/linux/cfg80211.c
 delete mode 100644 drivers/staging/ath6kl/os/linux/eeprom.c
 delete mode 100644 drivers/staging/ath6kl/os/linux/export_hci_transport.c
 delete mode 100644 drivers/staging/ath6kl/os/linux/hci_bridge.c
 delete mode 100644 drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
 delete mode 100644 drivers/staging/ath6kl/os/linux/include/ar6k_pal.h
 delete mode 100644 drivers/staging/ath6kl/os/linux/include/ar6xapi_linux.h
 delete mode 100644 drivers/staging/ath6kl/os/linux/include/athdrv_linux.h
 delete mode 100644 drivers/staging/ath6kl/os/linux/include/athtypes_linux.h
 delete mode 100644 drivers/staging/ath6kl/os/linux/include/cfg80211.h
 delete mode 100644 drivers/staging/ath6kl/os/linux/include/config_linux.h
 delete mode 100644 drivers/staging/ath6kl/os/linux/include/debug_linux.h
 delete mode 100644 drivers/staging/ath6kl/os/linux/include/export_hci_transport.h
 delete mode 100644 drivers/staging/ath6kl/os/linux/include/ieee80211_ioctl.h
 delete mode 100644 drivers/staging/ath6kl/os/linux/include/osapi_linux.h
 delete mode 100644 drivers/staging/ath6kl/os/linux/include/wlan_config.h
 delete mode 100644 drivers/staging/ath6kl/os/linux/include/wmi_filter_linux.h
 delete mode 100644 drivers/staging/ath6kl/os/linux/ioctl.c
 delete mode 100644 drivers/staging/ath6kl/os/linux/netbuf.c
 delete mode 100644 drivers/staging/ath6kl/os/linux/wireless_ext.c
 create mode 100644 drivers/staging/ath6kl/rcv_aggr.c
 delete mode 100644 drivers/staging/ath6kl/reorder/aggr_rx_internal.h
 delete mode 100644 drivers/staging/ath6kl/reorder/rcv_aggr.c
 create mode 100644 drivers/staging/ath6kl/wireless_ext.c
 delete mode 100644 drivers/staging/ath6kl/wlan/include/ieee80211.h
 delete mode 100644 drivers/staging/ath6kl/wlan/include/ieee80211_node.h
 delete mode 100644 drivers/staging/ath6kl/wlan/src/wlan_node.c
 delete mode 100644 drivers/staging/ath6kl/wlan/src/wlan_recv_beacon.c
 delete mode 100644 drivers/staging/ath6kl/wlan/src/wlan_utils.c
 create mode 100644 drivers/staging/ath6kl/wlan_node.c
 create mode 100644 drivers/staging/ath6kl/wlan_recv_beacon.c
 create mode 100644 drivers/staging/ath6kl/wlan_utils.c
 create mode 100644 drivers/staging/ath6kl/wmi.c
 delete mode 100644 drivers/staging/ath6kl/wmi/wmi.c
 delete mode 100644 drivers/staging/ath6kl/wmi/wmi_host.h


^ permalink raw reply

* Re: [PATCH 00/83] staging: ath6kl: Style cleanup
From: Greg KH @ 2011-01-21 19:38 UTC (permalink / raw)
  To: Vipin Mehta; +Cc: linux-wireless, devel, joe
In-Reply-To: <1295637798-18355-1-git-send-email-vmehta@atheros.com>

On Fri, Jan 21, 2011 at 11:23:18AM -0800, Vipin Mehta wrote:
> The following set of patches fixes the driver's coding style in 
> accordance with the Linux kernel coding style. The patches ended 
> being huge so putting them up on a shared location where they can 
> be retrieved using wget.
> 
> http://userweb.kernel.org/~vmehta/ath6kl-cleanup.tar.bz2

Interesting, however the very first patch fails to apply :(

So, care to make up a git tree that I could pull these from?  Or at the
least, rebase them so that I can apply them?

thanks,

greg k-h

^ permalink raw reply

* [PATCH] rtlwifi: Fix possible NULL dereference
From: Larry Finger @ 2011-01-21 19:40 UTC (permalink / raw)
  To: John W Linville; +Cc: chaoming_li, linux-kernel, linux-wireless, netdev

From: Jesper Juhl <jj@chaosbits.net>

In drivers/net/wireless/rtlwifi/pci.c::_rtl_pci_rx_interrupt() we call 
dev_alloc_skb(), which may fail and return NULL, but we do not check the 
returned value against NULL before dereferencing the returned pointer. 
This may lead to a NULL pointer dereference which means we'll crash - not 
good.

In a separate call to dev_alloc_skb(), the debug level is changed so that
the failure message will always be logged.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---

John,

Material for 2.6.38.

Larry

Index: wireless-testing/drivers/net/wireless/rtlwifi/pci.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/rtlwifi/pci.c
+++ wireless-testing/drivers/net/wireless/rtlwifi/pci.c
@@ -619,6 +619,13 @@ static void _rtl_pci_rx_interrupt(struct
 					struct sk_buff *uskb = NULL;
 					u8 *pdata;
 					uskb = dev_alloc_skb(skb->len + 128);
+					if (!uskb) {
+						RT_TRACE(rtlpriv,
+							(COMP_INTR | COMP_RECV),
+							DBG_EMERG,
+							("can't alloc rx skb\n"));
+						goto done;
+					}
 					memcpy(IEEE80211_SKB_RXCB(uskb),
 							&rx_status,
 							sizeof(rx_status));
@@ -641,7 +648,7 @@ static void _rtl_pci_rx_interrupt(struct
 			new_skb = dev_alloc_skb(rtlpci->rxbuffersize);
 			if (unlikely(!new_skb)) {
 				RT_TRACE(rtlpriv, (COMP_INTR | COMP_RECV),
-					 DBG_DMESG,
+					 DBG_EMERG,
 					 ("can't alloc skb for rx\n"));
 				goto done;
 			}
@@ -1066,9 +1073,9 @@ static int _rtl_pci_init_rx_ring(struct
 			struct sk_buff *skb =
 			    dev_alloc_skb(rtlpci->rxbuffersize);
 			u32 bufferaddress;
-			entry = &rtlpci->rx_ring[rx_queue_idx].desc[i];
 			if (!skb)
 				return 0;
+			entry = &rtlpci->rx_ring[rx_queue_idx].desc[i];
 
 			/*skb->dev = dev; */
 

^ permalink raw reply

* Re: [PATCH 00/83] staging: ath6kl: Style cleanup
From: Joe Perches @ 2011-01-21 19:43 UTC (permalink / raw)
  To: Greg KH; +Cc: Vipin Mehta, linux-wireless, devel
In-Reply-To: <20110121193830.GA17789@kroah.com>

On Fri, 2011-01-21 at 11:38 -0800, Greg KH wrote:
> On Fri, Jan 21, 2011 at 11:23:18AM -0800, Vipin Mehta wrote:
> > The following set of patches fixes the driver's coding style in 
> > accordance with the Linux kernel coding style. The patches ended 
> > being huge so putting them up on a shared location where they can 
> > be retrieved using wget.
> > 
> > http://userweb.kernel.org/~vmehta/ath6kl-cleanup.tar.bz2
> 
> Interesting, however the very first patch fails to apply :(
> 
> So, care to make up a git tree that I could pull these from?  Or at the
> least, rebase them so that I can apply them?

I'll have a tree to pull from soon.


^ permalink raw reply

* Re: [PATCH 00/83] staging: ath6kl: Style cleanup
From: Vipin Mehta @ 2011-01-21 19:48 UTC (permalink / raw)
  To: Greg KH
  Cc: Vipin Mehta, linux-wireless@vger.kernel.org,
	devel@driverdev.osuosl.org, joe@perches.com
In-Reply-To: <20110121193830.GA17789@kroah.com>

On Fri, Jan 21, 2011 at 11:38:30AM -0800, Greg KH wrote:
> On Fri, Jan 21, 2011 at 11:23:18AM -0800, Vipin Mehta wrote:
> > The following set of patches fixes the driver's coding style in 
> > accordance with the Linux kernel coding style. The patches ended 
> > being huge so putting them up on a shared location where they can 
> > be retrieved using wget.
> > 
> > http://userweb.kernel.org/~vmehta/ath6kl-cleanup.tar.bz2
> 
> Interesting, however the very first patch fails to apply :(

I generated the patches after rebasing my tree to the remotes/origin/staging-linus in the staging-2.6 tree. I tested it again just a whilw back and the patches do apply.
> 
> So, care to make up a git tree that I could pull these from?  Or at the
> least, rebase them so that I can apply them?

There is git tree here which was originally pulled from the staging-2.6 tree and has all these changes.

http://git.kernel.org/?p=linux/kernel/git/vmehta/ath6kl.git;a=shortlog;h=refs/heads/ath6kl-cleanup

Tree: git://git.kernel.org/pub/scm/linux/kernel/git/vmehta/ath6kl.git
Head: ath6kl-cleanup
> 
> thanks,
> 
> greg k-h

^ permalink raw reply

* Re: [PATCH 00/83] staging: ath6kl: Style cleanup
From: Greg KH @ 2011-01-21 19:55 UTC (permalink / raw)
  To: Vipin Mehta
  Cc: Vipin Mehta, linux-wireless@vger.kernel.org,
	devel@driverdev.osuosl.org, joe@perches.com
In-Reply-To: <20110121194840.GA18603@vmehta-desktop>

On Fri, Jan 21, 2011 at 11:48:40AM -0800, Vipin Mehta wrote:
> On Fri, Jan 21, 2011 at 11:38:30AM -0800, Greg KH wrote:
> > On Fri, Jan 21, 2011 at 11:23:18AM -0800, Vipin Mehta wrote:
> > > The following set of patches fixes the driver's coding style in 
> > > accordance with the Linux kernel coding style. The patches ended 
> > > being huge so putting them up on a shared location where they can 
> > > be retrieved using wget.
> > > 
> > > http://userweb.kernel.org/~vmehta/ath6kl-cleanup.tar.bz2
> > 
> > Interesting, however the very first patch fails to apply :(
> 
> I generated the patches after rebasing my tree to the
> remotes/origin/staging-linus in the staging-2.6 tree. I tested it
> again just a whilw back and the patches do apply.

These patches are NOT for staging-linus as they are not to go to him
until the .39 merge window is open, right?  Please rebase them on the
staging-next tree.

thanks,

greg k-h

^ permalink raw reply

* [PATCH] rtlwifi: Fix firmware upload errors
From: Larry Finger @ 2011-01-21 19:57 UTC (permalink / raw)
  To: John W Linville; +Cc: chaoming_li, linux-wireless

From: Chaoming Li <chaoming_li@realsil.com.cn>

When the source code from Realtek was prepared for kernel inclusion,
some routines were refactored to reduce the level of indentation. This
patch repairs errors introduced in that process.

Signed-off-by: Chaoming Li <chaoming_li@realsil.com.cn>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---

John,

This is 2.6.38 material.

Larry
---

Index: linux-2.6/drivers/net/wireless/rtlwifi/efuse.c
===================================================================
--- linux-2.6.orig/drivers/net/wireless/rtlwifi/efuse.c
+++ linux-2.6/drivers/net/wireless/rtlwifi/efuse.c
@@ -726,9 +726,9 @@ static int efuse_pg_packet_read(struct i
 }
 
 static void efuse_write_data_case1(struct ieee80211_hw *hw, u16 *efuse_addr,
-				u8 efuse_data, u8 offset, int *bcontinual,
-				u8 *write_state, struct pgpkt_struct target_pkt,
-				int *repeat_times, int *bresult, u8 word_en)
+			u8 efuse_data, u8 offset, int *bcontinual,
+			u8 *write_state, struct pgpkt_struct *target_pkt,
+			int *repeat_times, int *bresult, u8 word_en)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct pgpkt_struct tmp_pkt;
@@ -744,8 +744,8 @@ static void efuse_write_data_case1(struc
 	tmp_pkt.word_en = tmp_header & 0x0F;
 	tmp_word_cnts = efuse_calculate_word_cnts(tmp_pkt.word_en);
 
-	if (tmp_pkt.offset != target_pkt.offset) {
-		efuse_addr = efuse_addr + (tmp_word_cnts * 2) + 1;
+	if (tmp_pkt.offset != target_pkt->offset) {
+		*efuse_addr = *efuse_addr + (tmp_word_cnts * 2) + 1;
 		*write_state = PG_STATE_HEADER;
 	} else {
 		for (tmpindex = 0; tmpindex < (tmp_word_cnts * 2); tmpindex++) {
@@ -756,23 +756,23 @@ static void efuse_write_data_case1(struc
 		}
 
 		if (bdataempty == false) {
-			efuse_addr = efuse_addr + (tmp_word_cnts * 2) + 1;
+			*efuse_addr = *efuse_addr + (tmp_word_cnts * 2) + 1;
 			*write_state = PG_STATE_HEADER;
 		} else {
 			match_word_en = 0x0F;
-			if (!((target_pkt.word_en & BIT(0)) |
+			if (!((target_pkt->word_en & BIT(0)) |
 			     (tmp_pkt.word_en & BIT(0))))
 				match_word_en &= (~BIT(0));
 
-			if (!((target_pkt.word_en & BIT(1)) |
+			if (!((target_pkt->word_en & BIT(1)) |
 			     (tmp_pkt.word_en & BIT(1))))
 				match_word_en &= (~BIT(1));
 
-			if (!((target_pkt.word_en & BIT(2)) |
+			if (!((target_pkt->word_en & BIT(2)) |
 			     (tmp_pkt.word_en & BIT(2))))
 				match_word_en &= (~BIT(2));
 
-			if (!((target_pkt.word_en & BIT(3)) |
+			if (!((target_pkt->word_en & BIT(3)) |
 			     (tmp_pkt.word_en & BIT(3))))
 				match_word_en &= (~BIT(3));
 
@@ -780,7 +780,7 @@ static void efuse_write_data_case1(struc
 				badworden = efuse_word_enable_data_write(
 							    hw, *efuse_addr + 1,
 							    tmp_pkt.word_en,
-							    target_pkt.data);
+							    target_pkt->data);
 
 				if (0x0F != (badworden & 0x0F)) {
 					u8 reorg_offset = offset;
@@ -791,26 +791,26 @@ static void efuse_write_data_case1(struc
 				}
 
 				tmp_word_en = 0x0F;
-				if ((target_pkt.word_en & BIT(0)) ^
+				if ((target_pkt->word_en & BIT(0)) ^
 				    (match_word_en & BIT(0)))
 					tmp_word_en &= (~BIT(0));
 
-				if ((target_pkt.word_en & BIT(1)) ^
+				if ((target_pkt->word_en & BIT(1)) ^
 				    (match_word_en & BIT(1)))
 					tmp_word_en &= (~BIT(1));
 
-				if ((target_pkt.word_en & BIT(2)) ^
+				if ((target_pkt->word_en & BIT(2)) ^
 					(match_word_en & BIT(2)))
 					tmp_word_en &= (~BIT(2));
 
-				if ((target_pkt.word_en & BIT(3)) ^
+				if ((target_pkt->word_en & BIT(3)) ^
 				    (match_word_en & BIT(3)))
 					tmp_word_en &= (~BIT(3));
 
 				if ((tmp_word_en & 0x0F) != 0x0F) {
 					*efuse_addr = efuse_get_current_size(hw);
-					target_pkt.offset = offset;
-					target_pkt.word_en = tmp_word_en;
+					target_pkt->offset = offset;
+					target_pkt->word_en = tmp_word_en;
 				} else
 					*bcontinual = false;
 				*write_state = PG_STATE_HEADER;
@@ -821,8 +821,8 @@ static void efuse_write_data_case1(struc
 				}
 			} else {
 				*efuse_addr += (2 * tmp_word_cnts) + 1;
-				target_pkt.offset = offset;
-				target_pkt.word_en = word_en;
+				target_pkt->offset = offset;
+				target_pkt->word_en = word_en;
 				*write_state = PG_STATE_HEADER;
 			}
 		}
@@ -938,7 +938,7 @@ static int efuse_pg_packet_write(struct
 				efuse_write_data_case1(hw, &efuse_addr,
 						       efuse_data, offset,
 						       &bcontinual,
-						       &write_state, target_pkt,
+						       &write_state, &target_pkt,
 						       &repeat_times, &bresult,
 						       word_en);
 			else

^ permalink raw reply

* Compat-wireless release for 2011-01-21 is baked
From: Compat-wireless cronjob account @ 2011-01-21 20:04 UTC (permalink / raw)
  To: linux-wireless

>From git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next
   fc5eb2b..9f3eae0  history    -> origin/history
 + 212a2fa...47db3d1 master     -> origin/master  (forced update)
   c56eb8f..12fcdba  stable     -> origin/stable
 * [new tag]         next-20110121 -> next-20110121

compat-wireless code metrics

    782984 - Total upstream lines of code being pulled
      2103 - backport code changes
      1843 - backport code additions
       260 - backport code deletions
      7279 - backport from compat module
      9382 - total backport code
    1.1982 - % of code consists of backport work
      1531 - Crap changes not yet posted
      1488 - Crap additions not yet posted
        43 - Crap deletions not yet posted
    0.1955 - % of crap code

Base tree: linux-next.git
Base tree version: next-20110121
compat-wireless release: compat-wireless-2011-01-06-3-g8db1608-pc

^ permalink raw reply

* Re: [PATCH 00/83] staging: ath6kl: Style cleanup
From: Vipin Mehta @ 2011-01-21 20:09 UTC (permalink / raw)
  To: Greg KH
  Cc: Vipin Mehta, linux-wireless@vger.kernel.org,
	devel@driverdev.osuosl.org, joe@perches.com
In-Reply-To: <20110121195509.GB18700@kroah.com>

On Fri, Jan 21, 2011 at 11:55:09AM -0800, Greg KH wrote:
> On Fri, Jan 21, 2011 at 11:48:40AM -0800, Vipin Mehta wrote:
> > On Fri, Jan 21, 2011 at 11:38:30AM -0800, Greg KH wrote:
> > > On Fri, Jan 21, 2011 at 11:23:18AM -0800, Vipin Mehta wrote:
> > > > The following set of patches fixes the driver's coding style in 
> > > > accordance with the Linux kernel coding style. The patches ended 
> > > > being huge so putting them up on a shared location where they can 
> > > > be retrieved using wget.
> > > > 
> > > > http://userweb.kernel.org/~vmehta/ath6kl-cleanup.tar.bz2
> > > 
> > > Interesting, however the very first patch fails to apply :(
> > 
> > I generated the patches after rebasing my tree to the
> > remotes/origin/staging-linus in the staging-2.6 tree. I tested it
> > again just a whilw back and the patches do apply.
> 
> These patches are NOT for staging-linus as they are not to go to him
> until the .39 merge window is open, right?  Please rebase them on the
> staging-next tree.
>
The only difference in ath6kl between the staging-linus and staging-next 
is the following patch that was applied yesterday in the staging-linus 
branch:

http://git.kernel.org/?p=linux/kernel/git/gregkh/staging-2.6.git;a=commit;h=64911e4b133ff633563d6dd2b021fa1ca0608992

The reason I used staging-linus is because I wanted to apply these 
patches on top of the above patch which we will have to do eventually. 
We will have to go through the pain later which I already went through 
yesterday while redoing these patches on top of the above one. Is it 
possible for you to apply the commit 
64911e4b133ff633563d6dd2b021fa1ca0608992 
before applying this series?

Regards,
Vipin

^ permalink raw reply

* Re: Fwd: [Linux Wireless] Update of "en/users/Drivers/carl9170" by PaulFertser
From: Christian Lamparter @ 2011-01-21 20:31 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Paul Fertser, Luis R. Rodriguez, linux-wireless
In-Reply-To: <1295550433.3693.50.camel@jlt3.sipsolutions.net>

On Thursday 20 January 2011 20:07:13 Johannes Berg wrote:
> On Thu, 2011-01-20 at 21:54 +0300, Paul Fertser wrote:
> > On Thu, Jan 20, 2011 at 10:50:43AM -0800, Luis R. Rodriguez wrote:
> > > On Thu, Jan 20, 2011 at 10:43 AM, Paul Fertser <fercerpav@gmail.com> wrote:
> > > > On Thu, Jan 20, 2011 at 10:37:20AM -0800, Luis R. Rodriguez wrote:
> > > >> Huh?
> > > >
> > > > Christian asked me to add that info to the wiki, is something i wrote wrong?
> > > 
> > > It is unclear to me, are you saying carl9170 does not support QoS and
> > > aggregation?
> > 
> > At the same time, apparently, yes. This commit[1] has more
> > clarifications.
> > 
> > [1] http://git.kernel.org/?p=linux/kernel/git/chr/carl9170fw.git;a=commitdiff;h=39be7dc384e0dd45dc36b4b517fd9fae874b06f0
> 
> It could still do QoS but refuse aggregation sessions on anything but
> TID 0 and 1?
> 
Uh, no cc: me ;) ? I almost missed this one.

Anyway, when I wrote that I tried a lot of possible workarounds. 
Including this suggestion [limit ampdu to tid 0 & 1], but it had
no effect, the TX-QoS arbiter just gets stuck :(.




^ permalink raw reply

* [PATCH 0/3] libertas_spi fixes
From: Vasily Khoruzhick @ 2011-01-21 20:44 UTC (permalink / raw)
  To: libertas-dev, linux-wireless, Andrey Yurovsky, Colin McCabe,
	Marek Vasut, anarsoul

This series attempts to fix libertas_spi bug (it calls functions that
may sleep from atomic context) and add pm support to libertas_spi.
Tested on Zipit Z2 device.


^ permalink raw reply

* [PATCH 1/3] libertas_spi: Use workqueue in hw_host_to_card
From: Vasily Khoruzhick @ 2011-01-21 20:44 UTC (permalink / raw)
  To: libertas-dev, linux-wireless, Andrey Yurovsky, Colin McCabe,
	Marek Vasut, anarsoul
In-Reply-To: <1295642690-16646-1-git-send-email-anarsoul@gmail.com>

Use workqueue to perform SPI xfers, it's necessary to fix
nasty "BUG: scheduling while atomic", because
spu_write() calls spi_sync() and spi_sync() may sleep, but
hw_host_to_card() callback can be called from atomic context.
Remove kthread completely, workqueue now does its job.
Restore intermediate buffers which were removed in commit
86c34fe89e9cad9e1ba4d1a8bbf98259035f4caf that introduced
mentioned bug.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 drivers/net/wireless/libertas/if_spi.c |  368 +++++++++++++++++++++-----------
 1 files changed, 239 insertions(+), 129 deletions(-)

diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index 0060023..f6c2cd6 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -20,10 +20,8 @@
 #include <linux/moduleparam.h>
 #include <linux/firmware.h>
 #include <linux/jiffies.h>
-#include <linux/kthread.h>
 #include <linux/list.h>
 #include <linux/netdevice.h>
-#include <linux/semaphore.h>
 #include <linux/slab.h>
 #include <linux/spi/libertas_spi.h>
 #include <linux/spi/spi.h>
@@ -34,6 +32,12 @@
 #include "dev.h"
 #include "if_spi.h"
 
+struct if_spi_packet {
+	struct list_head		list;
+	u16				blen;
+	u8				buffer[0] __attribute__((aligned(4)));
+};
+
 struct if_spi_card {
 	struct spi_device		*spi;
 	struct lbs_private		*priv;
@@ -51,18 +55,36 @@ struct if_spi_card {
 	unsigned long			spu_reg_delay;
 
 	/* Handles all SPI communication (except for FW load) */
-	struct task_struct		*spi_thread;
-	int				run_thread;
-
-	/* Used to wake up the spi_thread */
-	struct semaphore		spi_ready;
-	struct semaphore		spi_thread_terminated;
+	struct workqueue_struct		*workqueue;
+	struct work_struct		packet_work;
 
 	u8				cmd_buffer[IF_SPI_CMD_BUF_SIZE];
+
+	/* A buffer of incoming packets from libertas core.
+	 * Since we can't sleep in hw_host_to_card, we have to buffer
+	 * them. */
+	struct list_head		cmd_packet_list;
+	struct list_head		data_packet_list;
+
+	/* Protects cmd_packet_list and data_packet_list */
+	spinlock_t			buffer_lock;
 };
 
 static void free_if_spi_card(struct if_spi_card *card)
 {
+	struct list_head *cursor, *next;
+	struct if_spi_packet *packet;
+
+	list_for_each_safe(cursor, next, &card->cmd_packet_list) {
+		packet = container_of(cursor, struct if_spi_packet, list);
+		list_del(&packet->list);
+		kfree(packet);
+	}
+	list_for_each_safe(cursor, next, &card->data_packet_list) {
+		packet = container_of(cursor, struct if_spi_packet, list);
+		list_del(&packet->list);
+		kfree(packet);
+	}
 	spi_set_drvdata(card->spi, NULL);
 	kfree(card);
 }
@@ -622,7 +644,7 @@ out:
 /*
  * SPI Transfer Thread
  *
- * The SPI thread handles all SPI transfers, so there is no need for a lock.
+ * The SPI worker handles all SPI transfers, so there is no need for a lock.
  */
 
 /* Move a command from the card to the host */
@@ -742,6 +764,40 @@ out:
 	return err;
 }
 
+/* Move data or a command from the host to the card. */
+static void if_spi_h2c(struct if_spi_card *card,
+			struct if_spi_packet *packet, int type)
+{
+	int err = 0;
+	u16 int_type, port_reg;
+
+	switch (type) {
+	case MVMS_DAT:
+		int_type = IF_SPI_CIC_TX_DOWNLOAD_OVER;
+		port_reg = IF_SPI_DATA_RDWRPORT_REG;
+		break;
+	case MVMS_CMD:
+		int_type = IF_SPI_CIC_CMD_DOWNLOAD_OVER;
+		port_reg = IF_SPI_CMD_RDWRPORT_REG;
+		break;
+	default:
+		lbs_pr_err("can't transfer buffer of type %d\n", type);
+		err = -EINVAL;
+		goto out;
+	}
+
+	/* Write the data to the card */
+	err = spu_write(card, port_reg, packet->buffer, packet->blen);
+	if (err)
+		goto out;
+
+out:
+	kfree(packet);
+
+	if (err)
+		lbs_pr_err("%s: error %d\n", __func__, err);
+}
+
 /* Inform the host about a card event */
 static void if_spi_e2h(struct if_spi_card *card)
 {
@@ -766,71 +822,88 @@ out:
 		lbs_pr_err("%s: error %d\n", __func__, err);
 }
 
-static int lbs_spi_thread(void *data)
+static void if_spi_host_to_card_worker(struct work_struct *work)
 {
 	int err;
-	struct if_spi_card *card = data;
+	struct if_spi_card *card;
 	u16 hiStatus;
+	unsigned long flags;
+	struct if_spi_packet *packet;
 
-	while (1) {
-		/* Wait to be woken up by one of two things.  First, our ISR
-		 * could tell us that something happened on the WLAN.
-		 * Secondly, libertas could call hw_host_to_card with more
-		 * data, which we might be able to send.
-		 */
-		do {
-			err = down_interruptible(&card->spi_ready);
-			if (!card->run_thread) {
-				up(&card->spi_thread_terminated);
-				do_exit(0);
-			}
-		} while (err == -EINTR);
+	card = container_of(work, struct if_spi_card, packet_work);
 
-		/* Read the host interrupt status register to see what we
-		 * can do. */
-		err = spu_read_u16(card, IF_SPI_HOST_INT_STATUS_REG,
-					&hiStatus);
-		if (err) {
-			lbs_pr_err("I/O error\n");
+	lbs_deb_enter(LBS_DEB_SPI);
+
+	/* Read the host interrupt status register to see what we
+	 * can do. */
+	err = spu_read_u16(card, IF_SPI_HOST_INT_STATUS_REG,
+				&hiStatus);
+	if (err) {
+		lbs_pr_err("I/O error\n");
+		goto err;
+	}
+
+	if (hiStatus & IF_SPI_HIST_CMD_UPLOAD_RDY) {
+		err = if_spi_c2h_cmd(card);
+		if (err)
 			goto err;
-		}
+	}
+	if (hiStatus & IF_SPI_HIST_RX_UPLOAD_RDY) {
+		err = if_spi_c2h_data(card);
+		if (err)
+			goto err;
+	}
 
-		if (hiStatus & IF_SPI_HIST_CMD_UPLOAD_RDY) {
-			err = if_spi_c2h_cmd(card);
-			if (err)
-				goto err;
-		}
-		if (hiStatus & IF_SPI_HIST_RX_UPLOAD_RDY) {
-			err = if_spi_c2h_data(card);
-			if (err)
-				goto err;
+	/* workaround: in PS mode, the card does not set the Command
+	 * Download Ready bit, but it sets TX Download Ready. */
+	if (hiStatus & IF_SPI_HIST_CMD_DOWNLOAD_RDY ||
+	   (card->priv->psstate != PS_STATE_FULL_POWER &&
+	    (hiStatus & IF_SPI_HIST_TX_DOWNLOAD_RDY))) {
+		/* This means two things. First of all,
+		 * if there was a previous command sent, the card has
+		 * successfully received it.
+		 * Secondly, it is now ready to download another
+		 * command.
+		 */
+		lbs_host_to_card_done(card->priv);
+
+		/* Do we have any command packets from the host to
+		 * send? */
+		packet = NULL;
+		spin_lock_irqsave(&card->buffer_lock, flags);
+		if (!list_empty(&card->cmd_packet_list)) {
+			packet = (struct if_spi_packet *)(card->
+					cmd_packet_list.next);
+			list_del(&packet->list);
 		}
+		spin_unlock_irqrestore(&card->buffer_lock, flags);
 
-		/* workaround: in PS mode, the card does not set the Command
-		 * Download Ready bit, but it sets TX Download Ready. */
-		if (hiStatus & IF_SPI_HIST_CMD_DOWNLOAD_RDY ||
-		   (card->priv->psstate != PS_STATE_FULL_POWER &&
-		    (hiStatus & IF_SPI_HIST_TX_DOWNLOAD_RDY))) {
-			lbs_host_to_card_done(card->priv);
+		if (packet)
+			if_spi_h2c(card, packet, MVMS_CMD);
+	}
+	if (hiStatus & IF_SPI_HIST_TX_DOWNLOAD_RDY) {
+		/* Do we have any data packets from the host to
+		 * send? */
+		packet = NULL;
+		spin_lock_irqsave(&card->buffer_lock, flags);
+		if (!list_empty(&card->data_packet_list)) {
+			packet = (struct if_spi_packet *)(card->
+					data_packet_list.next);
+			list_del(&packet->list);
 		}
+		spin_unlock_irqrestore(&card->buffer_lock, flags);
 
-		if (hiStatus & IF_SPI_HIST_CARD_EVENT)
-			if_spi_e2h(card);
+		if (packet)
+			if_spi_h2c(card, packet, MVMS_DAT);
+	}
+	if (hiStatus & IF_SPI_HIST_CARD_EVENT)
+		if_spi_e2h(card);
 
 err:
-		if (err)
-			lbs_pr_err("%s: got error %d\n", __func__, err);
-	}
-}
+	if (err)
+		lbs_pr_err("%s: got error %d\n", __func__, err);
 
-/* Block until lbs_spi_thread thread has terminated */
-static void if_spi_terminate_spi_thread(struct if_spi_card *card)
-{
-	/* It would be nice to use kthread_stop here, but that function
-	 * can't wake threads waiting for a semaphore. */
-	card->run_thread = 0;
-	up(&card->spi_ready);
-	down(&card->spi_thread_terminated);
+	lbs_deb_leave(LBS_DEB_SPI);
 }
 
 /*
@@ -842,18 +915,40 @@ static int if_spi_host_to_card(struct lbs_private *priv,
 				u8 type, u8 *buf, u16 nb)
 {
 	int err = 0;
+	unsigned long flags;
 	struct if_spi_card *card = priv->card;
+	struct if_spi_packet *packet;
+	u16 blen;
 
 	lbs_deb_enter_args(LBS_DEB_SPI, "type %d, bytes %d", type, nb);
 
-	nb = ALIGN(nb, 4);
+	if (nb == 0) {
+		lbs_pr_err("%s: invalid size requested: %d\n", __func__, nb);
+		err = -EINVAL;
+		goto out;
+	}
+	blen = ALIGN(nb, 4);
+	packet = kzalloc(sizeof(struct if_spi_packet) + blen, GFP_ATOMIC);
+	if (!packet) {
+		err = -ENOMEM;
+		goto out;
+	}
+	packet->blen = blen;
+	memcpy(packet->buffer, buf, nb);
+	memset(packet->buffer + nb, 0, blen - nb);
 
 	switch (type) {
 	case MVMS_CMD:
-		err = spu_write(card, IF_SPI_CMD_RDWRPORT_REG, buf, nb);
+		priv->dnld_sent = DNLD_CMD_SENT;
+		spin_lock_irqsave(&card->buffer_lock, flags);
+		list_add_tail(&packet->list, &card->cmd_packet_list);
+		spin_unlock_irqrestore(&card->buffer_lock, flags);
 		break;
 	case MVMS_DAT:
-		err = spu_write(card, IF_SPI_DATA_RDWRPORT_REG, buf, nb);
+		priv->dnld_sent = DNLD_DATA_SENT;
+		spin_lock_irqsave(&card->buffer_lock, flags);
+		list_add_tail(&packet->list, &card->data_packet_list);
+		spin_unlock_irqrestore(&card->buffer_lock, flags);
 		break;
 	default:
 		lbs_pr_err("can't transfer buffer of type %d", type);
@@ -861,6 +956,9 @@ static int if_spi_host_to_card(struct lbs_private *priv,
 		break;
 	}
 
+	/* Queue spi xfer work */
+	queue_work(card->workqueue, &card->packet_work);
+out:
 	lbs_deb_leave_args(LBS_DEB_SPI, "err=%d", err);
 	return err;
 }
@@ -869,13 +967,14 @@ static int if_spi_host_to_card(struct lbs_private *priv,
  * Host Interrupts
  *
  * Service incoming interrupts from the WLAN device. We can't sleep here, so
- * don't try to talk on the SPI bus, just wake up the SPI thread.
+ * don't try to talk on the SPI bus, just queue the SPI xfer work.
  */
 static irqreturn_t if_spi_host_interrupt(int irq, void *dev_id)
 {
 	struct if_spi_card *card = dev_id;
 
-	up(&card->spi_ready);
+	queue_work(card->workqueue, &card->packet_work);
+
 	return IRQ_HANDLED;
 }
 
@@ -883,56 +982,26 @@ static irqreturn_t if_spi_host_interrupt(int irq, void *dev_id)
  * SPI callbacks
  */
 
-static int __devinit if_spi_probe(struct spi_device *spi)
+static int if_spi_init_card(struct if_spi_card *card)
 {
-	struct if_spi_card *card;
-	struct lbs_private *priv = NULL;
-	struct libertas_spi_platform_data *pdata = spi->dev.platform_data;
-	int err = 0, i;
+	struct spi_device *spi = card->spi;
+	int err, i;
 	u32 scratch;
-	struct sched_param param = { .sched_priority = 1 };
 	const struct firmware *helper = NULL;
 	const struct firmware *mainfw = NULL;
 
 	lbs_deb_enter(LBS_DEB_SPI);
 
-	if (!pdata) {
-		err = -EINVAL;
-		goto out;
-	}
-
-	if (pdata->setup) {
-		err = pdata->setup(spi);
-		if (err)
-			goto out;
-	}
-
-	/* Allocate card structure to represent this specific device */
-	card = kzalloc(sizeof(struct if_spi_card), GFP_KERNEL);
-	if (!card) {
-		err = -ENOMEM;
-		goto out;
-	}
-	spi_set_drvdata(spi, card);
-	card->pdata = pdata;
-	card->spi = spi;
-	card->prev_xfer_time = jiffies;
-
-	sema_init(&card->spi_ready, 0);
-	sema_init(&card->spi_thread_terminated, 0);
-
-	/* Initialize the SPI Interface Unit */
-	err = spu_init(card, pdata->use_dummy_writes);
+	err = spu_init(card, card->pdata->use_dummy_writes);
 	if (err)
-		goto free_card;
+		goto out;
 	err = spu_get_chip_revision(card, &card->card_id, &card->card_rev);
 	if (err)
-		goto free_card;
+		goto out;
 
-	/* Firmware load */
 	err = spu_read_u32(card, IF_SPI_SCRATCH_4_REG, &scratch);
 	if (err)
-		goto free_card;
+		goto out;
 	if (scratch == SUCCESSFUL_FW_DOWNLOAD_MAGIC)
 		lbs_deb_spi("Firmware is already loaded for "
 			    "Marvell WLAN 802.11 adapter\n");
@@ -946,7 +1015,7 @@ static int __devinit if_spi_probe(struct spi_device *spi)
 			lbs_pr_err("Unsupported chip_id: 0x%02x\n",
 					card->card_id);
 			err = -ENODEV;
-			goto free_card;
+			goto out;
 		}
 
 		err = lbs_get_firmware(&card->spi->dev, NULL, NULL,
@@ -954,7 +1023,7 @@ static int __devinit if_spi_probe(struct spi_device *spi)
 					&mainfw);
 		if (err) {
 			lbs_pr_err("failed to find firmware (%d)\n", err);
-			goto free_card;
+			goto out;
 		}
 
 		lbs_deb_spi("Initializing FW for Marvell WLAN 802.11 adapter "
@@ -966,15 +1035,68 @@ static int __devinit if_spi_probe(struct spi_device *spi)
 				spi->max_speed_hz);
 		err = if_spi_prog_helper_firmware(card, helper);
 		if (err)
-			goto free_card;
+			goto out;
 		err = if_spi_prog_main_firmware(card, mainfw);
 		if (err)
-			goto free_card;
+			goto out;
 		lbs_deb_spi("loaded FW for Marvell WLAN 802.11 adapter\n");
 	}
 
 	err = spu_set_interrupt_mode(card, 0, 1);
 	if (err)
+		goto out;
+
+out:
+	if (helper)
+		release_firmware(helper);
+	if (mainfw)
+		release_firmware(mainfw);
+
+	lbs_deb_leave_args(LBS_DEB_SPI, "err %d\n", err);
+
+	return err;
+}
+
+static int __devinit if_spi_probe(struct spi_device *spi)
+{
+	struct if_spi_card *card;
+	struct lbs_private *priv = NULL;
+	struct libertas_spi_platform_data *pdata = spi->dev.platform_data;
+	int err = 0;
+
+	lbs_deb_enter(LBS_DEB_SPI);
+
+	if (!pdata) {
+		err = -EINVAL;
+		goto out;
+	}
+
+	if (pdata->setup) {
+		err = pdata->setup(spi);
+		if (err)
+			goto out;
+	}
+
+	/* Allocate card structure to represent this specific device */
+	card = kzalloc(sizeof(struct if_spi_card), GFP_KERNEL);
+	if (!card) {
+		err = -ENOMEM;
+		goto teardown;
+	}
+	spi_set_drvdata(spi, card);
+	card->pdata = pdata;
+	card->spi = spi;
+	card->prev_xfer_time = jiffies;
+
+	INIT_LIST_HEAD(&card->cmd_packet_list);
+	INIT_LIST_HEAD(&card->data_packet_list);
+	spin_lock_init(&card->buffer_lock);
+
+	/* Initialize the SPI Interface Unit */
+
+	/* Firmware load */
+	err = if_spi_init_card(card);
+	if (err)
 		goto free_card;
 
 	/* Register our card with libertas.
@@ -993,27 +1115,16 @@ static int __devinit if_spi_probe(struct spi_device *spi)
 	priv->fw_ready = 1;
 
 	/* Initialize interrupt handling stuff. */
-	card->run_thread = 1;
-	card->spi_thread = kthread_run(lbs_spi_thread, card, "lbs_spi_thread");
-	if (IS_ERR(card->spi_thread)) {
-		card->run_thread = 0;
-		err = PTR_ERR(card->spi_thread);
-		lbs_pr_err("error creating SPI thread: err=%d\n", err);
-		goto remove_card;
-	}
-	if (sched_setscheduler(card->spi_thread, SCHED_FIFO, &param))
-		lbs_pr_err("Error setting scheduler, using default.\n");
+	card->workqueue = create_workqueue("libertas_spi");
+	INIT_WORK(&card->packet_work, if_spi_host_to_card_worker);
 
 	err = request_irq(spi->irq, if_spi_host_interrupt,
 			IRQF_TRIGGER_FALLING, "libertas_spi", card);
 	if (err) {
 		lbs_pr_err("can't get host irq line-- request_irq failed\n");
-		goto terminate_thread;
+		goto terminate_workqueue;
 	}
 
-	/* poke the IRQ handler so that we don't miss the first interrupt */
-	up(&card->spi_ready);
-
 	/* Start the card.
 	 * This will call register_netdev, and we'll start
 	 * getting interrupts... */
@@ -1028,18 +1139,16 @@ static int __devinit if_spi_probe(struct spi_device *spi)
 
 release_irq:
 	free_irq(spi->irq, card);
-terminate_thread:
-	if_spi_terminate_spi_thread(card);
-remove_card:
+terminate_workqueue:
+	flush_workqueue(card->workqueue);
+	destroy_workqueue(card->workqueue);
 	lbs_remove_card(priv); /* will call free_netdev */
 free_card:
 	free_if_spi_card(card);
+teardown:
+	if (pdata->teardown)
+		pdata->teardown(spi);
 out:
-	if (helper)
-		release_firmware(helper);
-	if (mainfw)
-		release_firmware(mainfw);
-
 	lbs_deb_leave_args(LBS_DEB_SPI, "err %d\n", err);
 	return err;
 }
@@ -1056,7 +1165,8 @@ static int __devexit libertas_spi_remove(struct spi_device *spi)
 	lbs_remove_card(priv); /* will call free_netdev */
 
 	free_irq(spi->irq, card);
-	if_spi_terminate_spi_thread(card);
+	flush_workqueue(card->workqueue);
+	destroy_workqueue(card->workqueue);
 	if (card->pdata->teardown)
 		card->pdata->teardown(spi);
 	free_if_spi_card(card);
-- 
1.7.4.rc1


^ permalink raw reply related

* [PATCH 2/3] libertas: Prepare stuff for if_spi.c pm support
From: Vasily Khoruzhick @ 2011-01-21 20:44 UTC (permalink / raw)
  To: libertas-dev, linux-wireless, Andrey Yurovsky, Colin McCabe,
	Marek Vasut, anarsoul
In-Reply-To: <1295642690-16646-1-git-send-email-anarsoul@gmail.com>

To support suspend/resume in if_spi we need two things:
- re-setup fw in lbs_resume(), because if_spi powercycles card;
- don't touch hwaddr on second lbs_update_hw_spec() call for same
  reason;

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 drivers/net/wireless/libertas/cmd.c  |   10 +++-
 drivers/net/wireless/libertas/dev.h  |    2 +
 drivers/net/wireless/libertas/main.c |   77 +++++++++++++++++----------------
 3 files changed, 49 insertions(+), 40 deletions(-)

diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 78c4da1..7e8a658 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -145,9 +145,13 @@ int lbs_update_hw_spec(struct lbs_private *priv)
 	if (priv->current_addr[0] == 0xff)
 		memmove(priv->current_addr, cmd.permanentaddr, ETH_ALEN);
 
-	memcpy(priv->dev->dev_addr, priv->current_addr, ETH_ALEN);
-	if (priv->mesh_dev)
-		memcpy(priv->mesh_dev->dev_addr, priv->current_addr, ETH_ALEN);
+	if (!priv->copied_hwaddr) {
+		memcpy(priv->dev->dev_addr, priv->current_addr, ETH_ALEN);
+		if (priv->mesh_dev)
+			memcpy(priv->mesh_dev->dev_addr,
+				priv->current_addr, ETH_ALEN);
+		priv->copied_hwaddr = 1;
+	}
 
 out:
 	lbs_deb_leave(LBS_DEB_CMD);
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index 18dd9a0..bc461eb 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -90,6 +90,7 @@ struct lbs_private {
 	void *card;
 	u8 fw_ready;
 	u8 surpriseremoved;
+	u8 setup_fw_on_resume;
 	int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb);
 	void (*reset_card) (struct lbs_private *priv);
 	int (*enter_deep_sleep) (struct lbs_private *priv);
@@ -101,6 +102,7 @@ struct lbs_private {
 	u32 fwcapinfo;
 	u16 regioncode;
 	u8 current_addr[ETH_ALEN];
+	u8 copied_hwaddr;
 
 	/* Command download */
 	u8 dnld_sent;
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 6836a6d..ca8149c 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -539,6 +539,43 @@ static int lbs_thread(void *data)
 	return 0;
 }
 
+/**
+ * @brief This function gets the HW spec from the firmware and sets
+ *        some basic parameters.
+ *
+ *  @param priv    A pointer to struct lbs_private structure
+ *  @return        0 or -1
+ */
+static int lbs_setup_firmware(struct lbs_private *priv)
+{
+	int ret = -1;
+	s16 curlevel = 0, minlevel = 0, maxlevel = 0;
+
+	lbs_deb_enter(LBS_DEB_FW);
+
+	/* Read MAC address from firmware */
+	memset(priv->current_addr, 0xff, ETH_ALEN);
+	ret = lbs_update_hw_spec(priv);
+	if (ret)
+		goto done;
+
+	/* Read power levels if available */
+	ret = lbs_get_tx_power(priv, &curlevel, &minlevel, &maxlevel);
+	if (ret == 0) {
+		priv->txpower_cur = curlevel;
+		priv->txpower_min = minlevel;
+		priv->txpower_max = maxlevel;
+	}
+
+	/* Send cmd to FW to enable 11D function */
+	ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_11D_ENABLE, 1);
+
+	lbs_set_mac_control(priv);
+done:
+	lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
+	return ret;
+}
+
 int lbs_suspend(struct lbs_private *priv)
 {
 	int ret;
@@ -584,47 +621,13 @@ int lbs_resume(struct lbs_private *priv)
 			lbs_pr_err("deep sleep activation failed: %d\n", ret);
 	}
 
-	lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
-	return ret;
-}
-EXPORT_SYMBOL_GPL(lbs_resume);
-
-/**
- * @brief This function gets the HW spec from the firmware and sets
- *        some basic parameters.
- *
- *  @param priv    A pointer to struct lbs_private structure
- *  @return 	   0 or -1
- */
-static int lbs_setup_firmware(struct lbs_private *priv)
-{
-	int ret = -1;
-	s16 curlevel = 0, minlevel = 0, maxlevel = 0;
-
-	lbs_deb_enter(LBS_DEB_FW);
-
-	/* Read MAC address from firmware */
-	memset(priv->current_addr, 0xff, ETH_ALEN);
-	ret = lbs_update_hw_spec(priv);
-	if (ret)
-		goto done;
-
-	/* Read power levels if available */
-	ret = lbs_get_tx_power(priv, &curlevel, &minlevel, &maxlevel);
-	if (ret == 0) {
-		priv->txpower_cur = curlevel;
-		priv->txpower_min = minlevel;
-		priv->txpower_max = maxlevel;
-	}
+	if (priv->setup_fw_on_resume)
+		ret = lbs_setup_firmware(priv);
 
-	/* Send cmd to FW to enable 11D function */
-	ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_11D_ENABLE, 1);
-
-	lbs_set_mac_control(priv);
-done:
 	lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
 	return ret;
 }
+EXPORT_SYMBOL_GPL(lbs_resume);
 
 /**
  *  This function handles the timeout of command sending.
-- 
1.7.4.rc1


^ permalink raw reply related

* [PATCH 3/3] libertas_spi: Add support for suspend/resume
From: Vasily Khoruzhick @ 2011-01-21 20:44 UTC (permalink / raw)
  To: libertas-dev, linux-wireless, Andrey Yurovsky, Colin McCabe,
	Marek Vasut, anarsoul
In-Reply-To: <1295642690-16646-1-git-send-email-anarsoul@gmail.com>

Add support for suspend/resume in if_spi.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 drivers/net/wireless/libertas/if_spi.c |   55 ++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index f6c2cd6..772da3a 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -57,6 +57,7 @@ struct if_spi_card {
 	/* Handles all SPI communication (except for FW load) */
 	struct workqueue_struct		*workqueue;
 	struct work_struct		packet_work;
+	struct work_struct		resume_work;
 
 	u8				cmd_buffer[IF_SPI_CMD_BUF_SIZE];
 
@@ -1057,6 +1058,24 @@ out:
 	return err;
 }
 
+static void if_spi_resume_worker(struct work_struct *work)
+{
+	struct if_spi_card *card;
+
+	card = container_of(work, struct if_spi_card, resume_work);
+
+	if (card->pdata->setup)
+		card->pdata->setup(card->spi);
+
+	/* Init card ... */
+	if_spi_init_card(card);
+
+	enable_irq(card->spi->irq);
+
+	/* And resume it ... */
+	lbs_resume(card->priv);
+}
+
 static int __devinit if_spi_probe(struct spi_device *spi)
 {
 	struct if_spi_card *card;
@@ -1107,6 +1126,7 @@ static int __devinit if_spi_probe(struct spi_device *spi)
 		goto free_card;
 	}
 	card->priv = priv;
+	priv->setup_fw_on_resume = 1;
 	priv->card = card;
 	priv->hw_host_to_card = if_spi_host_to_card;
 	priv->enter_deep_sleep = NULL;
@@ -1117,6 +1137,7 @@ static int __devinit if_spi_probe(struct spi_device *spi)
 	/* Initialize interrupt handling stuff. */
 	card->workqueue = create_workqueue("libertas_spi");
 	INIT_WORK(&card->packet_work, if_spi_host_to_card_worker);
+	INIT_WORK(&card->resume_work, if_spi_resume_worker);
 
 	err = request_irq(spi->irq, if_spi_host_interrupt,
 			IRQF_TRIGGER_FALLING, "libertas_spi", card);
@@ -1161,6 +1182,8 @@ static int __devexit libertas_spi_remove(struct spi_device *spi)
 	lbs_deb_spi("libertas_spi_remove\n");
 	lbs_deb_enter(LBS_DEB_SPI);
 
+	cancel_work_sync(&card->resume_work);
+
 	lbs_stop_card(priv);
 	lbs_remove_card(priv); /* will call free_netdev */
 
@@ -1174,6 +1197,37 @@ static int __devexit libertas_spi_remove(struct spi_device *spi)
 	return 0;
 }
 
+static int if_spi_suspend(struct device *dev)
+{
+	struct spi_device *spi = to_spi_device(dev);
+	struct if_spi_card *card = spi_get_drvdata(spi);
+
+	lbs_suspend(card->priv);
+	flush_workqueue(card->workqueue);
+	disable_irq(spi->irq);
+
+	if (card->pdata->teardown)
+		card->pdata->teardown(spi);
+
+	return 0;
+}
+
+static int if_spi_resume(struct device *dev)
+{
+	struct spi_device *spi = to_spi_device(dev);
+	struct if_spi_card *card = spi_get_drvdata(spi);
+
+	/* Schedule delayed work */
+	schedule_work(&card->resume_work);
+
+	return 0;
+}
+
+static const struct dev_pm_ops if_spi_pm_ops = {
+	.suspend	= if_spi_suspend,
+	.resume		= if_spi_resume,
+};
+
 static struct spi_driver libertas_spi_driver = {
 	.probe	= if_spi_probe,
 	.remove = __devexit_p(libertas_spi_remove),
@@ -1181,6 +1235,7 @@ static struct spi_driver libertas_spi_driver = {
 		.name	= "libertas_spi",
 		.bus	= &spi_bus_type,
 		.owner	= THIS_MODULE,
+		.pm	= &if_spi_pm_ops,
 	},
 };
 
-- 
1.7.4.rc1


^ permalink raw reply related

* Re: [PATCH 00/83] staging: ath6kl: Style cleanup
From: Greg KH @ 2011-01-21 21:16 UTC (permalink / raw)
  To: Vipin Mehta
  Cc: Vipin Mehta, linux-wireless@vger.kernel.org,
	devel@driverdev.osuosl.org, joe@perches.com
In-Reply-To: <20110121200907.GA18651@vmehta-desktop>

On Fri, Jan 21, 2011 at 12:09:07PM -0800, Vipin Mehta wrote:
> On Fri, Jan 21, 2011 at 11:55:09AM -0800, Greg KH wrote:
> > On Fri, Jan 21, 2011 at 11:48:40AM -0800, Vipin Mehta wrote:
> > > On Fri, Jan 21, 2011 at 11:38:30AM -0800, Greg KH wrote:
> > > > On Fri, Jan 21, 2011 at 11:23:18AM -0800, Vipin Mehta wrote:
> > > > > The following set of patches fixes the driver's coding style in 
> > > > > accordance with the Linux kernel coding style. The patches ended 
> > > > > being huge so putting them up on a shared location where they can 
> > > > > be retrieved using wget.
> > > > > 
> > > > > http://userweb.kernel.org/~vmehta/ath6kl-cleanup.tar.bz2
> > > > 
> > > > Interesting, however the very first patch fails to apply :(
> > > 
> > > I generated the patches after rebasing my tree to the
> > > remotes/origin/staging-linus in the staging-2.6 tree. I tested it
> > > again just a whilw back and the patches do apply.
> > 
> > These patches are NOT for staging-linus as they are not to go to him
> > until the .39 merge window is open, right?  Please rebase them on the
> > staging-next tree.
> >
> The only difference in ath6kl between the staging-linus and staging-next 
> is the following patch that was applied yesterday in the staging-linus 
> branch:
> 
> http://git.kernel.org/?p=linux/kernel/git/gregkh/staging-2.6.git;a=commit;h=64911e4b133ff633563d6dd2b021fa1ca0608992
> 
> The reason I used staging-linus is because I wanted to apply these 
> patches on top of the above patch which we will have to do eventually. 

That's nice, but not how I can do things, sorry.

> We will have to go through the pain later which I already went through 
> yesterday while redoing these patches on top of the above one. Is it 
> possible for you to apply the commit 
> 64911e4b133ff633563d6dd2b021fa1ca0608992 
> before applying this series?

No, I don't want to apply the same patch to 2 different branches.  When
that patch is in Linus's tree, then I will worry about merging them
together, but that's something I do all the time, and not a big deal.

I need this series against the proper branch, if I am going to be able
to apply them.

Otherwise I will gladly just ignore them, which is not what I think you
or Joe wants...

thanks,

greg k-h

^ permalink raw reply

* Re: [PATCH 1/3] libertas_spi: Use workqueue in hw_host_to_card
From: Marek Vasut @ 2011-01-21 21:22 UTC (permalink / raw)
  To: Vasily Khoruzhick
  Cc: libertas-dev, linux-wireless, Andrey Yurovsky, Colin McCabe
In-Reply-To: <1295642690-16646-2-git-send-email-anarsoul@gmail.com>

On Friday 21 January 2011 21:44:48 Vasily Khoruzhick wrote:
> Use workqueue to perform SPI xfers, it's necessary to fix
> nasty "BUG: scheduling while atomic", because
> spu_write() calls spi_sync() and spi_sync() may sleep, but
> hw_host_to_card() callback can be called from atomic context.
> Remove kthread completely, workqueue now does its job.
> Restore intermediate buffers which were removed in commit
> 86c34fe89e9cad9e1ba4d1a8bbf98259035f4caf that introduced
> mentioned bug.

I have two questions:

1) Why not leave kthread there? ie. why switch to workqueue
2) This should be split into two patches I guess -- a) revert the change b) 
convert to workqueue -- so they can be (N)ACKed separatedly

Cheers
> 
> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> ---
>  drivers/net/wireless/libertas/if_spi.c |  368
> +++++++++++++++++++++----------- 1 files changed, 239 insertions(+), 129
> deletions(-)
> 
> diff --git a/drivers/net/wireless/libertas/if_spi.c
> b/drivers/net/wireless/libertas/if_spi.c index 0060023..f6c2cd6 100644
> --- a/drivers/net/wireless/libertas/if_spi.c
> +++ b/drivers/net/wireless/libertas/if_spi.c
> @@ -20,10 +20,8 @@
>  #include <linux/moduleparam.h>
>  #include <linux/firmware.h>
>  #include <linux/jiffies.h>
> -#include <linux/kthread.h>
>  #include <linux/list.h>
>  #include <linux/netdevice.h>
> -#include <linux/semaphore.h>
>  #include <linux/slab.h>
>  #include <linux/spi/libertas_spi.h>
>  #include <linux/spi/spi.h>
> @@ -34,6 +32,12 @@
>  #include "dev.h"
>  #include "if_spi.h"
> 
> +struct if_spi_packet {
> +	struct list_head		list;
> +	u16				blen;
> +	u8				buffer[0] __attribute__((aligned(4)));
> +};
> +
>  struct if_spi_card {
>  	struct spi_device		*spi;
>  	struct lbs_private		*priv;
> @@ -51,18 +55,36 @@ struct if_spi_card {
>  	unsigned long			spu_reg_delay;
> 
>  	/* Handles all SPI communication (except for FW load) */
> -	struct task_struct		*spi_thread;
> -	int				run_thread;
> -
> -	/* Used to wake up the spi_thread */
> -	struct semaphore		spi_ready;
> -	struct semaphore		spi_thread_terminated;
> +	struct workqueue_struct		*workqueue;
> +	struct work_struct		packet_work;
> 
>  	u8				cmd_buffer[IF_SPI_CMD_BUF_SIZE];
> +
> +	/* A buffer of incoming packets from libertas core.
> +	 * Since we can't sleep in hw_host_to_card, we have to buffer
> +	 * them. */
> +	struct list_head		cmd_packet_list;
> +	struct list_head		data_packet_list;
> +
> +	/* Protects cmd_packet_list and data_packet_list */
> +	spinlock_t			buffer_lock;
>  };
> 
>  static void free_if_spi_card(struct if_spi_card *card)
>  {
> +	struct list_head *cursor, *next;
> +	struct if_spi_packet *packet;
> +
> +	list_for_each_safe(cursor, next, &card->cmd_packet_list) {
> +		packet = container_of(cursor, struct if_spi_packet, list);
> +		list_del(&packet->list);
> +		kfree(packet);
> +	}
> +	list_for_each_safe(cursor, next, &card->data_packet_list) {
> +		packet = container_of(cursor, struct if_spi_packet, list);
> +		list_del(&packet->list);
> +		kfree(packet);
> +	}
>  	spi_set_drvdata(card->spi, NULL);
>  	kfree(card);
>  }
> @@ -622,7 +644,7 @@ out:
>  /*
>   * SPI Transfer Thread
>   *
> - * The SPI thread handles all SPI transfers, so there is no need for a
> lock. + * The SPI worker handles all SPI transfers, so there is no need
> for a lock. */
> 
>  /* Move a command from the card to the host */
> @@ -742,6 +764,40 @@ out:
>  	return err;
>  }
> 
> +/* Move data or a command from the host to the card. */
> +static void if_spi_h2c(struct if_spi_card *card,
> +			struct if_spi_packet *packet, int type)
> +{
> +	int err = 0;
> +	u16 int_type, port_reg;
> +
> +	switch (type) {
> +	case MVMS_DAT:
> +		int_type = IF_SPI_CIC_TX_DOWNLOAD_OVER;
> +		port_reg = IF_SPI_DATA_RDWRPORT_REG;
> +		break;
> +	case MVMS_CMD:
> +		int_type = IF_SPI_CIC_CMD_DOWNLOAD_OVER;
> +		port_reg = IF_SPI_CMD_RDWRPORT_REG;
> +		break;
> +	default:
> +		lbs_pr_err("can't transfer buffer of type %d\n", type);
> +		err = -EINVAL;
> +		goto out;
> +	}
> +
> +	/* Write the data to the card */
> +	err = spu_write(card, port_reg, packet->buffer, packet->blen);
> +	if (err)
> +		goto out;
> +
> +out:
> +	kfree(packet);
> +
> +	if (err)
> +		lbs_pr_err("%s: error %d\n", __func__, err);
> +}
> +
>  /* Inform the host about a card event */
>  static void if_spi_e2h(struct if_spi_card *card)
>  {
> @@ -766,71 +822,88 @@ out:
>  		lbs_pr_err("%s: error %d\n", __func__, err);
>  }
> 
> -static int lbs_spi_thread(void *data)
> +static void if_spi_host_to_card_worker(struct work_struct *work)
>  {
>  	int err;
> -	struct if_spi_card *card = data;
> +	struct if_spi_card *card;
>  	u16 hiStatus;
> +	unsigned long flags;
> +	struct if_spi_packet *packet;
> 
> -	while (1) {
> -		/* Wait to be woken up by one of two things.  First, our ISR
> -		 * could tell us that something happened on the WLAN.
> -		 * Secondly, libertas could call hw_host_to_card with more
> -		 * data, which we might be able to send.
> -		 */
> -		do {
> -			err = down_interruptible(&card->spi_ready);
> -			if (!card->run_thread) {
> -				up(&card->spi_thread_terminated);
> -				do_exit(0);
> -			}
> -		} while (err == -EINTR);
> +	card = container_of(work, struct if_spi_card, packet_work);
> 
> -		/* Read the host interrupt status register to see what we
> -		 * can do. */
> -		err = spu_read_u16(card, IF_SPI_HOST_INT_STATUS_REG,
> -					&hiStatus);
> -		if (err) {
> -			lbs_pr_err("I/O error\n");
> +	lbs_deb_enter(LBS_DEB_SPI);
> +
> +	/* Read the host interrupt status register to see what we
> +	 * can do. */
> +	err = spu_read_u16(card, IF_SPI_HOST_INT_STATUS_REG,
> +				&hiStatus);
> +	if (err) {
> +		lbs_pr_err("I/O error\n");
> +		goto err;
> +	}
> +
> +	if (hiStatus & IF_SPI_HIST_CMD_UPLOAD_RDY) {
> +		err = if_spi_c2h_cmd(card);
> +		if (err)
>  			goto err;
> -		}
> +	}
> +	if (hiStatus & IF_SPI_HIST_RX_UPLOAD_RDY) {
> +		err = if_spi_c2h_data(card);
> +		if (err)
> +			goto err;
> +	}
> 
> -		if (hiStatus & IF_SPI_HIST_CMD_UPLOAD_RDY) {
> -			err = if_spi_c2h_cmd(card);
> -			if (err)
> -				goto err;
> -		}
> -		if (hiStatus & IF_SPI_HIST_RX_UPLOAD_RDY) {
> -			err = if_spi_c2h_data(card);
> -			if (err)
> -				goto err;
> +	/* workaround: in PS mode, the card does not set the Command
> +	 * Download Ready bit, but it sets TX Download Ready. */
> +	if (hiStatus & IF_SPI_HIST_CMD_DOWNLOAD_RDY ||
> +	   (card->priv->psstate != PS_STATE_FULL_POWER &&
> +	    (hiStatus & IF_SPI_HIST_TX_DOWNLOAD_RDY))) {
> +		/* This means two things. First of all,
> +		 * if there was a previous command sent, the card has
> +		 * successfully received it.
> +		 * Secondly, it is now ready to download another
> +		 * command.
> +		 */
> +		lbs_host_to_card_done(card->priv);
> +
> +		/* Do we have any command packets from the host to
> +		 * send? */
> +		packet = NULL;
> +		spin_lock_irqsave(&card->buffer_lock, flags);
> +		if (!list_empty(&card->cmd_packet_list)) {
> +			packet = (struct if_spi_packet *)(card->
> +					cmd_packet_list.next);
> +			list_del(&packet->list);
>  		}
> +		spin_unlock_irqrestore(&card->buffer_lock, flags);
> 
> -		/* workaround: in PS mode, the card does not set the Command
> -		 * Download Ready bit, but it sets TX Download Ready. */
> -		if (hiStatus & IF_SPI_HIST_CMD_DOWNLOAD_RDY ||
> -		   (card->priv->psstate != PS_STATE_FULL_POWER &&
> -		    (hiStatus & IF_SPI_HIST_TX_DOWNLOAD_RDY))) {
> -			lbs_host_to_card_done(card->priv);
> +		if (packet)
> +			if_spi_h2c(card, packet, MVMS_CMD);
> +	}
> +	if (hiStatus & IF_SPI_HIST_TX_DOWNLOAD_RDY) {
> +		/* Do we have any data packets from the host to
> +		 * send? */
> +		packet = NULL;
> +		spin_lock_irqsave(&card->buffer_lock, flags);
> +		if (!list_empty(&card->data_packet_list)) {
> +			packet = (struct if_spi_packet *)(card->
> +					data_packet_list.next);
> +			list_del(&packet->list);
>  		}
> +		spin_unlock_irqrestore(&card->buffer_lock, flags);
> 
> -		if (hiStatus & IF_SPI_HIST_CARD_EVENT)
> -			if_spi_e2h(card);
> +		if (packet)
> +			if_spi_h2c(card, packet, MVMS_DAT);
> +	}
> +	if (hiStatus & IF_SPI_HIST_CARD_EVENT)
> +		if_spi_e2h(card);
> 
>  err:
> -		if (err)
> -			lbs_pr_err("%s: got error %d\n", __func__, err);
> -	}
> -}
> +	if (err)
> +		lbs_pr_err("%s: got error %d\n", __func__, err);
> 
> -/* Block until lbs_spi_thread thread has terminated */
> -static void if_spi_terminate_spi_thread(struct if_spi_card *card)
> -{
> -	/* It would be nice to use kthread_stop here, but that function
> -	 * can't wake threads waiting for a semaphore. */
> -	card->run_thread = 0;
> -	up(&card->spi_ready);
> -	down(&card->spi_thread_terminated);
> +	lbs_deb_leave(LBS_DEB_SPI);
>  }
> 
>  /*
> @@ -842,18 +915,40 @@ static int if_spi_host_to_card(struct lbs_private
> *priv, u8 type, u8 *buf, u16 nb)
>  {
>  	int err = 0;
> +	unsigned long flags;
>  	struct if_spi_card *card = priv->card;
> +	struct if_spi_packet *packet;
> +	u16 blen;
> 
>  	lbs_deb_enter_args(LBS_DEB_SPI, "type %d, bytes %d", type, nb);
> 
> -	nb = ALIGN(nb, 4);
> +	if (nb == 0) {
> +		lbs_pr_err("%s: invalid size requested: %d\n", __func__, nb);
> +		err = -EINVAL;
> +		goto out;
> +	}
> +	blen = ALIGN(nb, 4);
> +	packet = kzalloc(sizeof(struct if_spi_packet) + blen, GFP_ATOMIC);
> +	if (!packet) {
> +		err = -ENOMEM;
> +		goto out;
> +	}
> +	packet->blen = blen;
> +	memcpy(packet->buffer, buf, nb);
> +	memset(packet->buffer + nb, 0, blen - nb);
> 
>  	switch (type) {
>  	case MVMS_CMD:
> -		err = spu_write(card, IF_SPI_CMD_RDWRPORT_REG, buf, nb);
> +		priv->dnld_sent = DNLD_CMD_SENT;
> +		spin_lock_irqsave(&card->buffer_lock, flags);
> +		list_add_tail(&packet->list, &card->cmd_packet_list);
> +		spin_unlock_irqrestore(&card->buffer_lock, flags);
>  		break;
>  	case MVMS_DAT:
> -		err = spu_write(card, IF_SPI_DATA_RDWRPORT_REG, buf, nb);
> +		priv->dnld_sent = DNLD_DATA_SENT;
> +		spin_lock_irqsave(&card->buffer_lock, flags);
> +		list_add_tail(&packet->list, &card->data_packet_list);
> +		spin_unlock_irqrestore(&card->buffer_lock, flags);
>  		break;
>  	default:
>  		lbs_pr_err("can't transfer buffer of type %d", type);
> @@ -861,6 +956,9 @@ static int if_spi_host_to_card(struct lbs_private
> *priv, break;
>  	}
> 
> +	/* Queue spi xfer work */
> +	queue_work(card->workqueue, &card->packet_work);
> +out:
>  	lbs_deb_leave_args(LBS_DEB_SPI, "err=%d", err);
>  	return err;
>  }
> @@ -869,13 +967,14 @@ static int if_spi_host_to_card(struct lbs_private
> *priv, * Host Interrupts
>   *
>   * Service incoming interrupts from the WLAN device. We can't sleep here,
> so - * don't try to talk on the SPI bus, just wake up the SPI thread. + *
> don't try to talk on the SPI bus, just queue the SPI xfer work. */
>  static irqreturn_t if_spi_host_interrupt(int irq, void *dev_id)
>  {
>  	struct if_spi_card *card = dev_id;
> 
> -	up(&card->spi_ready);
> +	queue_work(card->workqueue, &card->packet_work);
> +
>  	return IRQ_HANDLED;
>  }
> 
> @@ -883,56 +982,26 @@ static irqreturn_t if_spi_host_interrupt(int irq,
> void *dev_id) * SPI callbacks
>   */
> 
> -static int __devinit if_spi_probe(struct spi_device *spi)
> +static int if_spi_init_card(struct if_spi_card *card)
>  {
> -	struct if_spi_card *card;
> -	struct lbs_private *priv = NULL;
> -	struct libertas_spi_platform_data *pdata = spi->dev.platform_data;
> -	int err = 0, i;
> +	struct spi_device *spi = card->spi;
> +	int err, i;
>  	u32 scratch;
> -	struct sched_param param = { .sched_priority = 1 };
>  	const struct firmware *helper = NULL;
>  	const struct firmware *mainfw = NULL;
> 
>  	lbs_deb_enter(LBS_DEB_SPI);
> 
> -	if (!pdata) {
> -		err = -EINVAL;
> -		goto out;
> -	}
> -
> -	if (pdata->setup) {
> -		err = pdata->setup(spi);
> -		if (err)
> -			goto out;
> -	}
> -
> -	/* Allocate card structure to represent this specific device */
> -	card = kzalloc(sizeof(struct if_spi_card), GFP_KERNEL);
> -	if (!card) {
> -		err = -ENOMEM;
> -		goto out;
> -	}
> -	spi_set_drvdata(spi, card);
> -	card->pdata = pdata;
> -	card->spi = spi;
> -	card->prev_xfer_time = jiffies;
> -
> -	sema_init(&card->spi_ready, 0);
> -	sema_init(&card->spi_thread_terminated, 0);
> -
> -	/* Initialize the SPI Interface Unit */
> -	err = spu_init(card, pdata->use_dummy_writes);
> +	err = spu_init(card, card->pdata->use_dummy_writes);
>  	if (err)
> -		goto free_card;
> +		goto out;
>  	err = spu_get_chip_revision(card, &card->card_id, &card->card_rev);
>  	if (err)
> -		goto free_card;
> +		goto out;
> 
> -	/* Firmware load */
>  	err = spu_read_u32(card, IF_SPI_SCRATCH_4_REG, &scratch);
>  	if (err)
> -		goto free_card;
> +		goto out;
>  	if (scratch == SUCCESSFUL_FW_DOWNLOAD_MAGIC)
>  		lbs_deb_spi("Firmware is already loaded for "
>  			    "Marvell WLAN 802.11 adapter\n");
> @@ -946,7 +1015,7 @@ static int __devinit if_spi_probe(struct spi_device
> *spi) lbs_pr_err("Unsupported chip_id: 0x%02x\n",
>  					card->card_id);
>  			err = -ENODEV;
> -			goto free_card;
> +			goto out;
>  		}
> 
>  		err = lbs_get_firmware(&card->spi->dev, NULL, NULL,
> @@ -954,7 +1023,7 @@ static int __devinit if_spi_probe(struct spi_device
> *spi) &mainfw);
>  		if (err) {
>  			lbs_pr_err("failed to find firmware (%d)\n", err);
> -			goto free_card;
> +			goto out;
>  		}
> 
>  		lbs_deb_spi("Initializing FW for Marvell WLAN 802.11 adapter "
> @@ -966,15 +1035,68 @@ static int __devinit if_spi_probe(struct spi_device
> *spi) spi->max_speed_hz);
>  		err = if_spi_prog_helper_firmware(card, helper);
>  		if (err)
> -			goto free_card;
> +			goto out;
>  		err = if_spi_prog_main_firmware(card, mainfw);
>  		if (err)
> -			goto free_card;
> +			goto out;
>  		lbs_deb_spi("loaded FW for Marvell WLAN 802.11 adapter\n");
>  	}
> 
>  	err = spu_set_interrupt_mode(card, 0, 1);
>  	if (err)
> +		goto out;
> +
> +out:
> +	if (helper)
> +		release_firmware(helper);
> +	if (mainfw)
> +		release_firmware(mainfw);
> +
> +	lbs_deb_leave_args(LBS_DEB_SPI, "err %d\n", err);
> +
> +	return err;
> +}
> +
> +static int __devinit if_spi_probe(struct spi_device *spi)
> +{
> +	struct if_spi_card *card;
> +	struct lbs_private *priv = NULL;
> +	struct libertas_spi_platform_data *pdata = spi->dev.platform_data;
> +	int err = 0;
> +
> +	lbs_deb_enter(LBS_DEB_SPI);
> +
> +	if (!pdata) {
> +		err = -EINVAL;
> +		goto out;
> +	}
> +
> +	if (pdata->setup) {
> +		err = pdata->setup(spi);
> +		if (err)
> +			goto out;
> +	}
> +
> +	/* Allocate card structure to represent this specific device */
> +	card = kzalloc(sizeof(struct if_spi_card), GFP_KERNEL);
> +	if (!card) {
> +		err = -ENOMEM;
> +		goto teardown;
> +	}
> +	spi_set_drvdata(spi, card);
> +	card->pdata = pdata;
> +	card->spi = spi;
> +	card->prev_xfer_time = jiffies;
> +
> +	INIT_LIST_HEAD(&card->cmd_packet_list);
> +	INIT_LIST_HEAD(&card->data_packet_list);
> +	spin_lock_init(&card->buffer_lock);
> +
> +	/* Initialize the SPI Interface Unit */
> +
> +	/* Firmware load */
> +	err = if_spi_init_card(card);
> +	if (err)
>  		goto free_card;
> 
>  	/* Register our card with libertas.
> @@ -993,27 +1115,16 @@ static int __devinit if_spi_probe(struct spi_device
> *spi) priv->fw_ready = 1;
> 
>  	/* Initialize interrupt handling stuff. */
> -	card->run_thread = 1;
> -	card->spi_thread = kthread_run(lbs_spi_thread, card, "lbs_spi_thread");
> -	if (IS_ERR(card->spi_thread)) {
> -		card->run_thread = 0;
> -		err = PTR_ERR(card->spi_thread);
> -		lbs_pr_err("error creating SPI thread: err=%d\n", err);
> -		goto remove_card;
> -	}
> -	if (sched_setscheduler(card->spi_thread, SCHED_FIFO, &param))
> -		lbs_pr_err("Error setting scheduler, using default.\n");
> +	card->workqueue = create_workqueue("libertas_spi");
> +	INIT_WORK(&card->packet_work, if_spi_host_to_card_worker);
> 
>  	err = request_irq(spi->irq, if_spi_host_interrupt,
>  			IRQF_TRIGGER_FALLING, "libertas_spi", card);
>  	if (err) {
>  		lbs_pr_err("can't get host irq line-- request_irq failed\n");
> -		goto terminate_thread;
> +		goto terminate_workqueue;
>  	}
> 
> -	/* poke the IRQ handler so that we don't miss the first interrupt */
> -	up(&card->spi_ready);
> -
>  	/* Start the card.
>  	 * This will call register_netdev, and we'll start
>  	 * getting interrupts... */
> @@ -1028,18 +1139,16 @@ static int __devinit if_spi_probe(struct spi_device
> *spi)
> 
>  release_irq:
>  	free_irq(spi->irq, card);
> -terminate_thread:
> -	if_spi_terminate_spi_thread(card);
> -remove_card:
> +terminate_workqueue:
> +	flush_workqueue(card->workqueue);
> +	destroy_workqueue(card->workqueue);
>  	lbs_remove_card(priv); /* will call free_netdev */
>  free_card:
>  	free_if_spi_card(card);
> +teardown:
> +	if (pdata->teardown)
> +		pdata->teardown(spi);
>  out:
> -	if (helper)
> -		release_firmware(helper);
> -	if (mainfw)
> -		release_firmware(mainfw);
> -
>  	lbs_deb_leave_args(LBS_DEB_SPI, "err %d\n", err);
>  	return err;
>  }
> @@ -1056,7 +1165,8 @@ static int __devexit libertas_spi_remove(struct
> spi_device *spi) lbs_remove_card(priv); /* will call free_netdev */
> 
>  	free_irq(spi->irq, card);
> -	if_spi_terminate_spi_thread(card);
> +	flush_workqueue(card->workqueue);
> +	destroy_workqueue(card->workqueue);
>  	if (card->pdata->teardown)
>  		card->pdata->teardown(spi);
>  	free_if_spi_card(card);

^ permalink raw reply

* Re: [PATCH 3/3] libertas_spi: Add support for suspend/resume
From: Marek Vasut @ 2011-01-21 21:25 UTC (permalink / raw)
  To: Vasily Khoruzhick
  Cc: libertas-dev, linux-wireless, Andrey Yurovsky, Colin McCabe
In-Reply-To: <1295642690-16646-4-git-send-email-anarsoul@gmail.com>

On Friday 21 January 2011 21:44:50 Vasily Khoruzhick wrote:
> Add support for suspend/resume in if_spi.

Isn't there some pin to put the card asleep ? I think these LBS ones have it.

Also, do you need to do this via workqueue ? Can't you just do it in the resume 
handler?

Cheers
> 
> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> ---
>  drivers/net/wireless/libertas/if_spi.c |   55
> ++++++++++++++++++++++++++++++++ 1 files changed, 55 insertions(+), 0
> deletions(-)
> 
> diff --git a/drivers/net/wireless/libertas/if_spi.c
> b/drivers/net/wireless/libertas/if_spi.c index f6c2cd6..772da3a 100644
> --- a/drivers/net/wireless/libertas/if_spi.c
> +++ b/drivers/net/wireless/libertas/if_spi.c
> @@ -57,6 +57,7 @@ struct if_spi_card {
>  	/* Handles all SPI communication (except for FW load) */
>  	struct workqueue_struct		*workqueue;
>  	struct work_struct		packet_work;
> +	struct work_struct		resume_work;
> 
>  	u8				cmd_buffer[IF_SPI_CMD_BUF_SIZE];
> 
> @@ -1057,6 +1058,24 @@ out:
>  	return err;
>  }
> 
> +static void if_spi_resume_worker(struct work_struct *work)
> +{
> +	struct if_spi_card *card;
> +
> +	card = container_of(work, struct if_spi_card, resume_work);
> +
> +	if (card->pdata->setup)
> +		card->pdata->setup(card->spi);
> +
> +	/* Init card ... */
> +	if_spi_init_card(card);
> +
> +	enable_irq(card->spi->irq);
> +
> +	/* And resume it ... */
> +	lbs_resume(card->priv);
> +}
> +
>  static int __devinit if_spi_probe(struct spi_device *spi)
>  {
>  	struct if_spi_card *card;
> @@ -1107,6 +1126,7 @@ static int __devinit if_spi_probe(struct spi_device
> *spi) goto free_card;
>  	}
>  	card->priv = priv;
> +	priv->setup_fw_on_resume = 1;
>  	priv->card = card;
>  	priv->hw_host_to_card = if_spi_host_to_card;
>  	priv->enter_deep_sleep = NULL;
> @@ -1117,6 +1137,7 @@ static int __devinit if_spi_probe(struct spi_device
> *spi) /* Initialize interrupt handling stuff. */
>  	card->workqueue = create_workqueue("libertas_spi");
>  	INIT_WORK(&card->packet_work, if_spi_host_to_card_worker);
> +	INIT_WORK(&card->resume_work, if_spi_resume_worker);
> 
>  	err = request_irq(spi->irq, if_spi_host_interrupt,
>  			IRQF_TRIGGER_FALLING, "libertas_spi", card);
> @@ -1161,6 +1182,8 @@ static int __devexit libertas_spi_remove(struct
> spi_device *spi) lbs_deb_spi("libertas_spi_remove\n");
>  	lbs_deb_enter(LBS_DEB_SPI);
> 
> +	cancel_work_sync(&card->resume_work);
> +
>  	lbs_stop_card(priv);
>  	lbs_remove_card(priv); /* will call free_netdev */
> 
> @@ -1174,6 +1197,37 @@ static int __devexit libertas_spi_remove(struct
> spi_device *spi) return 0;
>  }
> 
> +static int if_spi_suspend(struct device *dev)
> +{
> +	struct spi_device *spi = to_spi_device(dev);
> +	struct if_spi_card *card = spi_get_drvdata(spi);
> +
> +	lbs_suspend(card->priv);
> +	flush_workqueue(card->workqueue);
> +	disable_irq(spi->irq);
> +
> +	if (card->pdata->teardown)
> +		card->pdata->teardown(spi);
> +
> +	return 0;
> +}
> +
> +static int if_spi_resume(struct device *dev)
> +{
> +	struct spi_device *spi = to_spi_device(dev);
> +	struct if_spi_card *card = spi_get_drvdata(spi);
> +
> +	/* Schedule delayed work */
> +	schedule_work(&card->resume_work);
> +
> +	return 0;
> +}
> +
> +static const struct dev_pm_ops if_spi_pm_ops = {
> +	.suspend	= if_spi_suspend,
> +	.resume		= if_spi_resume,
> +};
> +
>  static struct spi_driver libertas_spi_driver = {
>  	.probe	= if_spi_probe,
>  	.remove = __devexit_p(libertas_spi_remove),
> @@ -1181,6 +1235,7 @@ static struct spi_driver libertas_spi_driver = {
>  		.name	= "libertas_spi",
>  		.bus	= &spi_bus_type,
>  		.owner	= THIS_MODULE,
> +		.pm	= &if_spi_pm_ops,
>  	},
>  };

^ permalink raw reply

* Re: [PATCH 1/3] libertas_spi: Use workqueue in hw_host_to_card
From: Vasily Khoruzhick @ 2011-01-21 21:24 UTC (permalink / raw)
  To: Marek Vasut; +Cc: libertas-dev, linux-wireless, Andrey Yurovsky, Colin McCabe
In-Reply-To: <201101212222.37667.marek.vasut@gmail.com>

On Friday 21 January 2011 23:22:37 Marek Vasut wrote:
> On Friday 21 January 2011 21:44:48 Vasily Khoruzhick wrote:
> > Use workqueue to perform SPI xfers, it's necessary to fix
> > nasty "BUG: scheduling while atomic", because
> > spu_write() calls spi_sync() and spi_sync() may sleep, but
> > hw_host_to_card() callback can be called from atomic context.
> > Remove kthread completely, workqueue now does its job.
> > Restore intermediate buffers which were removed in commit
> > 86c34fe89e9cad9e1ba4d1a8bbf98259035f4caf that introduced
> > mentioned bug.
> 
> I have two questions:
> 
> 1) Why not leave kthread there? ie. why switch to workqueue

Because it's not easy to ensure that kthread did its job in suspend handler,
and to make if_spi.c look similar to if_sdio.c.

> 2) This should be split into two patches I guess -- a) revert the change b)
> convert to workqueue -- so they can be (N)ACKed separatedly

Actually just reverting commit does not make driver work (it will fail on 
rmmod), and it can impact on future bisect (if it'll be necessary). But if 
it's requirement - ok.

> Cheers

^ permalink raw reply

* Re: [RFC/WIP 00/33] ath9k_htc AP mode
From: Christian Lamparter @ 2011-01-21 21:26 UTC (permalink / raw)
  To: Sujith; +Cc: linux-wireless, ath9k-devel, Jouni Malinen
In-Reply-To: <19768.62903.947245.576431@gargle.gargle.HOWL>

On Friday 21 January 2011 03:55:51 Sujith wrote:
> This series is the preliminary work for enabling AP mode for ath9k_htc.
> 
> A firmware update is needed, place look at:
> http://wireless.kernel.org/en/users/Drivers/ath9k_htc#AP_Mode
> 
> Known issues:
> 
> * Beacon misses under heavy TX load
>   ( hopefully, a fix would be sent out soon).
> 
> This has not been tested rigorously, so consider this series as
> experimental code.
> 
Hey that's great! I gave this series a quick whirl and it worked on the first try!
I had no probles getting ath9k to connect, well apart form a WARN_ON_ONCE

WARNING: at net/mac80211/tx.c:57 ieee80211_duration+0x50/0x1b3 [mac80211]()
Call Trace:
[  322.971940]  [<ffffffffa01d1cb0>] ? ieee80211_duration+0x50/0x1b3 [mac80211]
[  322.979297]  [<ffffffffa01d33d5>] ? invoke_tx_handlers+0xf65/0x1001 [mac80211]
[  322.987053]  [<ffffffffa01d0f2d>] ? ieee80211_prepare_and_rx_handle+0x7ff/0x845 [mac80211]
[  322.995865]  [<ffffffffa0004f5d>] ? usb_hcd_giveback_urb+0x76/0xa5 [usbcore]

but that's ok, ieee80211_duration does not make sense when
the rate control is done by the firmware.

--------

But what seems to be strange is the tx feedback...
Because it looks like ath9k_htc just sets IEEE80211_TX_STAT_ACK
for every frame, which obviously can't be "true", right? ;)

This might also break mac80211's *unicast buffering*.

Because the code in ieee80211_tx_status - net/mac80211/status.c
works like this:

211  acked = !!(info->flags & IEEE80211_TX_STAT_ACK);
212  if (!acked && test_sta_flags(sta, WLAN_STA_PS_STA)) {
213		/*
214		 * The STA is in power save mode, so assume
215		 * that this TX packet failed because of that.
216		 */
217		ieee80211_handle_filtered_frame(local, sta, skb);
218		rcu_read_unlock();
219		return;
220	}
...
239	if (info->flags & IEEE80211_TX_STAT_TX_FILTERED) {
240		ieee80211_handle_filtered_frame(local, sta, skb);
241		rcu_read_unlock();
242		return;
243	} else {
244		if (!acked)
245			sta->tx_retry_failed++;
246		sta->tx_retry_count += retry_count;
247	}

so, mac80211 will never know when it needs to resend certain
frame which could be affected by the race between the "sleepy"
station sending a frame with a PSM-bit set and mac80211 finally
updating the WLAN_STA_PS_STA flag.
[see long comment in mac80211/status.c @ line 73]

unless of course, you don't need it and the firmware can
buffer those frames until the STA comes back?!

Best regards,
	Christian

^ permalink raw reply

* Re: [PATCH 3/3] libertas_spi: Add support for suspend/resume
From: Vasily Khoruzhick @ 2011-01-21 21:27 UTC (permalink / raw)
  To: Marek Vasut; +Cc: libertas-dev, linux-wireless, Andrey Yurovsky, Colin McCabe
In-Reply-To: <201101212225.02775.marek.vasut@gmail.com>

On Friday 21 January 2011 23:25:02 Marek Vasut wrote:
> On Friday 21 January 2011 21:44:50 Vasily Khoruzhick wrote:
> > Add support for suspend/resume in if_spi.
> 
> Isn't there some pin to put the card asleep ? I think these LBS ones have
> it.

Is there datasheet on these cards?
 
> Also, do you need to do this via workqueue ? Can't you just do it in the
> resume handler?

Hmm, is it OK to request firmware if userspace is not ready yet?
 
> Cheers

Regards
Vasily

^ permalink raw reply

* Re: [PATCH] mac80211: use DECLARE_EVENT_CLASS
From: John W. Linville @ 2011-01-21 21:24 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless@vger.kernel.org
In-Reply-To: <1295437859.4685.4.camel@jlt3.sipsolutions.net>

On Wed, Jan 19, 2011 at 12:50:59PM +0100, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> For events that include only the local struct as
> their parameter, we can use DECLARE_EVENT_CLASS
> and save quite some binary size across segments
> as well lines of code.
> 
>    text	   data	    bss	    dec	    hex	filename
>  375745	  19296	    916	 395957	  60ab5	mac80211.ko.before
>  367473	  17888	    916	 386277	  5e4e5	mac80211.ko.after
>   -8272   -1408       0   -9680   -25d0 delta
> 
> Some more tracepoints with identical arguments
> could be combined like this but for now this is
> the one that benefits most.
> 
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Is this patch complete?  It seems to break the build with undefined symbols...

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox