All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2
@ 2011-09-24  2:08 Franky Lin
  2011-09-24  2:08 ` [PATCH 01/20] staging: brcm80211: remove uncoditional code blocks from brcmsmac Franky Lin
                   ` (19 more replies)
  0 siblings, 20 replies; 35+ messages in thread
From: Franky Lin @ 2011-09-24  2:08 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

Code clean up for softmac.

This series applies to staging-next and depends on the following patch set:

Message-ID: <1316736476-23725-1-git-send-email-frankyl@broadcom.com>

Arend van Spriel (9):
  staging: brcm80211: remove uncoditional code blocks from brcmsmac
  staging: brcm80211: cleanup structure fields used for scanning
  staging: brcm80211: use endian annotated structures in brcmsmac
  staging: brcm80211: remove ht_cap field from brcms_c_info structure
  staging: brcm80211: use fragment number provided in transmit frame
  staging: brcm80211: remove unused function si_pmu_ilp_clock()
  staging: brcm80211: make device initializer table for wme constant
  staging: brcm80211: remove dongle firmware related debug code
  staging: brcm80211: remove unnecessary mac80211 callbacks

Roland Vossen (11):
  staging: brcm80211: removed unused argument from softmac functions
  staging: brcm80211: deleted unused array of bss configurations in
    softmac
  staging: brcm80211: removed redundant wlc->cfg struct member
  staging: brcm80211: removed global var from aiutils.c
  staging: brcm80211: removed global vars in softmac ucode handling
  staging: brcm80211: removed unused softmac workaround
  staging: brcm80211: declared global vars in softmac phy as const
  staging: brcm80211: removed band related global vars from softmac
  staging: brcm80211: removed global var global_scb from softmac
  staging: brcm80211: various global var related changes in softmac
  staging: brcm80211: removed global variable in softmac otp

 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c      |  259 +-------
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c   |   32 +-
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h   |    5 +-
 drivers/staging/brcm80211/brcmsmac/Makefile        |    3 +-
 drivers/staging/brcm80211/brcmsmac/aiutils.c       |   15 +-
 drivers/staging/brcm80211/brcmsmac/aiutils.h       |    2 -
 drivers/staging/brcm80211/brcmsmac/ampdu.c         |    6 +-
 drivers/staging/brcm80211/brcmsmac/d11.h           |   83 ++-
 drivers/staging/brcm80211/brcmsmac/dma.c           |   41 +-
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c   |  125 +---
 drivers/staging/brcm80211/brcmsmac/mac80211_if.h   |    3 +-
 drivers/staging/brcm80211/brcmsmac/main.c          |  729 +++++++++-----------
 drivers/staging/brcm80211/brcmsmac/main.h          |   19 +-
 drivers/staging/brcm80211/brcmsmac/otp.c           |  147 +----
 drivers/staging/brcm80211/brcmsmac/otp.h           |    8 -
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c   |   49 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_int.h   |   23 -
 drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c   |  112 ++--
 drivers/staging/brcm80211/brcmsmac/phy/phy_n.c     |   62 +-
 .../staging/brcm80211/brcmsmac/phy/phytbl_lcn.c    |    2 +-
 drivers/staging/brcm80211/brcmsmac/pmu.c           |   22 -
 drivers/staging/brcm80211/brcmsmac/pmu.h           |    1 -
 drivers/staging/brcm80211/brcmsmac/pub.h           |    1 -
 drivers/staging/brcm80211/brcmsmac/rate.h          |    1 -
 drivers/staging/brcm80211/brcmsmac/srom.c          |   19 +-
 drivers/staging/brcm80211/brcmsmac/stf.c           |    9 -
 drivers/staging/brcm80211/brcmsmac/types.h         |    5 -
 drivers/staging/brcm80211/brcmsmac/ucode_loader.c  |  121 ++--
 drivers/staging/brcm80211/brcmsmac/ucode_loader.h  |   46 +-
 29 files changed, 656 insertions(+), 1294 deletions(-)



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

* [PATCH 01/20] staging: brcm80211: remove uncoditional code blocks from brcmsmac
  2011-09-24  2:08 [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2 Franky Lin
@ 2011-09-24  2:08 ` Franky Lin
  2011-09-24  2:08 ` [PATCH 02/20] staging: brcm80211: removed unused argument from softmac functions Franky Lin
                   ` (18 subsequent siblings)
  19 siblings, 0 replies; 35+ messages in thread
From: Franky Lin @ 2011-09-24  2:08 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

From: Arend van Spriel <arend@broadcom.com>

Using a block statement to scope function variables is not
common in linux kernel development. Browsed through the brcmsmac
to remove those.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/main.c        |    9 +--
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c |   31 +++----
 drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c |  106 ++++++++++------------
 3 files changed, 63 insertions(+), 83 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 2c9ac6d..d6b43ff 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -5076,7 +5076,7 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
 {
 	struct brcms_c_info *wlc;
 	uint err = 0;
-	uint j;
+	uint i, j;
 	struct brcms_pub *pub;
 	uint n_disabled;
 
@@ -5149,11 +5149,8 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
 			       wlc->stf->hw_rxchain);
 
 	/* pull up some info resulting from the low attach */
-	{
-		int i;
-		for (i = 0; i < NFIFO; i++)
-			wlc->core->txavail[i] = wlc->hw->txavail[i];
-	}
+	for (i = 0; i < NFIFO; i++)
+		wlc->core->txavail[i] = wlc->hw->txavail[i];
 
 	brcms_b_hw_etheraddr(wlc->hw, wlc->perm_etheraddr);
 
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
index 196a595..a26c682 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
@@ -1199,12 +1199,7 @@ static bool wlc_phy_cal_txpower_recalc_sw(struct brcms_phy *pi)
 void wlc_phy_switch_radio(struct brcms_phy_pub *pih, bool on)
 {
 	struct brcms_phy *pi = (struct brcms_phy *) pih;
-
-	{
-		uint mc;
-
-		mc = R_REG(&pi->regs->maccontrol);
-	}
+	(void)R_REG(&pi->regs->maccontrol);
 
 	if (ISNPHY(pi)) {
 		wlc_phy_switch_radio_nphy(pi, on);
@@ -1696,26 +1691,22 @@ void wlc_phy_txpower_recalc_target(struct brcms_phy *pi)
 								 band,
 								 rate);
 
-		{
-
-			wlc_phy_txpower_sromlimit((struct brcms_phy_pub *) pi,
-						  target_chan,
-						  &mintxpwr, &maxtxpwr, rate);
+		wlc_phy_txpower_sromlimit((struct brcms_phy_pub *) pi,
+					  target_chan,
+					  &mintxpwr, &maxtxpwr, rate);
 
-			maxtxpwr = min(maxtxpwr, pi->txpwr_limit[rate]);
+		maxtxpwr = min(maxtxpwr, pi->txpwr_limit[rate]);
 
-			maxtxpwr =
-				(maxtxpwr > pactrl) ? (maxtxpwr - pactrl) : 0;
+		maxtxpwr = (maxtxpwr > pactrl) ? (maxtxpwr - pactrl) : 0;
 
-			maxtxpwr = (maxtxpwr > 6) ? (maxtxpwr - 6) : 0;
+		maxtxpwr = (maxtxpwr > 6) ? (maxtxpwr - 6) : 0;
 
-			maxtxpwr = min(maxtxpwr, tx_pwr_target[rate]);
+		maxtxpwr = min(maxtxpwr, tx_pwr_target[rate]);
 
-			if (pi->txpwr_percent <= 100)
-				maxtxpwr = (maxtxpwr * pi->txpwr_percent) / 100;
+		if (pi->txpwr_percent <= 100)
+			maxtxpwr = (maxtxpwr * pi->txpwr_percent) / 100;
 
-			tx_pwr_target[rate] = max(maxtxpwr, mintxpwr);
-		}
+		tx_pwr_target[rate] = max(maxtxpwr, mintxpwr);
 
 		tx_pwr_target[rate] =
 			min(tx_pwr_target[rate], pi->txpwr_env_limit[rate]);
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c
index 46661b8..fdcea56 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c
@@ -69,6 +69,14 @@
 #define LCN_TEMPSENSE_OFFSET  80812
 #define LCN_TEMPSENSE_DEN  2647
 
+#define LCN_BW_LMT	200
+#define LCN_CUR_LMT	1250
+#define LCN_MULT	1
+#define LCN_VCO_DIV	30
+#define LCN_OFFSET	680
+#define LCN_FACT	490
+#define LCN_CUR_DIV	2640
+
 #define LCNPHY_txgainctrlovrval1_pagain_ovr_val1_SHIFT \
 	(0 + 8)
 #define LCNPHY_txgainctrlovrval1_pagain_ovr_val1_MASK \
@@ -1054,21 +1062,17 @@ static int wlc_lcnphy_calc_floor(s16 coeff_x, int type)
 static void
 wlc_lcnphy_get_tx_gain(struct brcms_phy *pi, struct lcnphy_txgains *gains)
 {
-	u16 dac_gain;
+	u16 dac_gain, rfgain0, rfgain1;
 
 	dac_gain = read_phy_reg(pi, 0x439) >> 0;
 	gains->dac_gain = (dac_gain & 0x380) >> 7;
 
-	{
-		u16 rfgain0, rfgain1;
-
-		rfgain0 = (read_phy_reg(pi, 0x4b5) & (0xffff << 0)) >> 0;
-		rfgain1 = (read_phy_reg(pi, 0x4fb) & (0x7fff << 0)) >> 0;
+	rfgain0 = (read_phy_reg(pi, 0x4b5) & (0xffff << 0)) >> 0;
+	rfgain1 = (read_phy_reg(pi, 0x4fb) & (0x7fff << 0)) >> 0;
 
-		gains->gm_gain = rfgain0 & 0xff;
-		gains->pga_gain = (rfgain0 >> 8) & 0xff;
-		gains->pad_gain = rfgain1 & 0xff;
-	}
+	gains->gm_gain = rfgain0 & 0xff;
+	gains->pga_gain = (rfgain0 >> 8) & 0xff;
+	gains->pad_gain = rfgain1 & 0xff;
 }
 
 
@@ -1634,6 +1638,9 @@ wlc_lcnphy_radio_2064_channel_tune_4313(struct brcms_phy *pi, u8 channel)
 	u32 div_int, div_frac, fvco3, fpfd, fref3, fcal_div;
 	u16 loop_bw, d30, setCount;
 
+	u8 h29, h28_ten, e30, h30_ten, cp_current;
+	u16 g30, d28;
+
 	ci = &chan_info_2064_lcnphy[0];
 	rfpll_doubler = 1;
 
@@ -1746,27 +1753,18 @@ wlc_lcnphy_radio_2064_channel_tune_4313(struct brcms_phy *pi, u8 channel)
 	write_radio_reg(pi, RADIO_2064_REG042, 0xA3);
 	write_radio_reg(pi, RADIO_2064_REG043, 0x0C);
 
-	{
-		u8 h29, h23, c28, d29, h28_ten, e30, h30_ten, cp_current;
-		u16 c29, c38, c30, g30, d28;
-		c29 = loop_bw;
-		d29 = 200;
-		c38 = 1250;
-		h29 = d29 / c29;
-		h23 = 1;
-		c28 = 30;
-		d28 = (((PLL_2064_HIGH_END_KVCO - PLL_2064_LOW_END_KVCO) *
-			(fvco3 / 2 - PLL_2064_LOW_END_VCO)) /
-		       (PLL_2064_HIGH_END_VCO - PLL_2064_LOW_END_VCO))
-		      + PLL_2064_LOW_END_KVCO;
-		h28_ten = (d28 * 10) / c28;
-		c30 = 2640;
-		e30 = (d30 - 680) / 490;
-		g30 = 680 + (e30 * 490);
-		h30_ten = (g30 * 10) / c30;
-		cp_current = ((c38 * h29 * h23 * 100) / h28_ten) / h30_ten;
-		mod_radio_reg(pi, RADIO_2064_REG03C, 0x3f, cp_current);
-	}
+	h29 = LCN_BW_LMT / loop_bw;
+	d28 = (((PLL_2064_HIGH_END_KVCO - PLL_2064_LOW_END_KVCO) *
+		(fvco3 / 2 - PLL_2064_LOW_END_VCO)) /
+	       (PLL_2064_HIGH_END_VCO - PLL_2064_LOW_END_VCO))
+	      + PLL_2064_LOW_END_KVCO;
+	h28_ten = (d28 * 10) / LCN_VCO_DIV;
+	e30 = (d30 - LCN_OFFSET) / LCN_FACT;
+	g30 = LCN_OFFSET + (e30 * LCN_FACT);
+	h30_ten = (g30 * 10) / LCN_CUR_DIV;
+	cp_current = ((LCN_CUR_LMT * h29 * LCN_MULT * 100) / h28_ten) / h30_ten;
+	mod_radio_reg(pi, RADIO_2064_REG03C, 0x3f, cp_current);
+
 	if (channel >= 1 && channel <= 5)
 		write_radio_reg(pi, RADIO_2064_REG03C, 0x8);
 	else
@@ -4838,18 +4836,13 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
 		pi_lcn->lcnphy_rssi_vc = (u8) PHY_GETINTVAR(pi, "rssismc2g");
 		pi_lcn->lcnphy_rssi_gs = (u8) PHY_GETINTVAR(pi, "rssisav2g");
 
-		{
-			pi_lcn->lcnphy_rssi_vf_lowtemp = pi_lcn->lcnphy_rssi_vf;
-			pi_lcn->lcnphy_rssi_vc_lowtemp = pi_lcn->lcnphy_rssi_vc;
-			pi_lcn->lcnphy_rssi_gs_lowtemp = pi_lcn->lcnphy_rssi_gs;
-
-			pi_lcn->lcnphy_rssi_vf_hightemp =
-				pi_lcn->lcnphy_rssi_vf;
-			pi_lcn->lcnphy_rssi_vc_hightemp =
-				pi_lcn->lcnphy_rssi_vc;
-			pi_lcn->lcnphy_rssi_gs_hightemp =
-				pi_lcn->lcnphy_rssi_gs;
-		}
+		pi_lcn->lcnphy_rssi_vf_lowtemp = pi_lcn->lcnphy_rssi_vf;
+		pi_lcn->lcnphy_rssi_vc_lowtemp = pi_lcn->lcnphy_rssi_vc;
+		pi_lcn->lcnphy_rssi_gs_lowtemp = pi_lcn->lcnphy_rssi_gs;
+
+		pi_lcn->lcnphy_rssi_vf_hightemp = pi_lcn->lcnphy_rssi_vf;
+		pi_lcn->lcnphy_rssi_vc_hightemp = pi_lcn->lcnphy_rssi_vc;
+		pi_lcn->lcnphy_rssi_gs_hightemp = pi_lcn->lcnphy_rssi_gs;
 
 		txpwr = (s8) PHY_GETINTVAR(pi, "maxp2ga0");
 		pi->tx_srom_max_2g = txpwr;
@@ -5098,6 +5091,8 @@ s32 wlc_lcnphy_rx_signal_power(struct brcms_phy *pi, s32 gain_index)
 	s32 log_val, gain_mismatch, desired_gain, input_power_offset_db,
 	    input_power_db;
 	s32 received_power, temperature;
+	u32 power;
+	u32 msb1, msb2, val1, val2, diff1, diff2;
 	uint freq;
 	struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy;
 
@@ -5107,20 +5102,17 @@ s32 wlc_lcnphy_rx_signal_power(struct brcms_phy *pi, s32 gain_index)
 
 	nominal_power_db = read_phy_reg(pi, 0x425) >> 8;
 
-	{
-		u32 power = (received_power * 16);
-		u32 msb1, msb2, val1, val2, diff1, diff2;
-		msb1 = ffs(power) - 1;
-		msb2 = msb1 + 1;
-		val1 = 1 << msb1;
-		val2 = 1 << msb2;
-		diff1 = (power - val1);
-		diff2 = (val2 - power);
-		if (diff1 < diff2)
-			log_val = msb1;
-		else
-			log_val = msb2;
-	}
+	power = (received_power * 16);
+	msb1 = ffs(power) - 1;
+	msb2 = msb1 + 1;
+	val1 = 1 << msb1;
+	val2 = 1 << msb2;
+	diff1 = (power - val1);
+	diff2 = (val2 - power);
+	if (diff1 < diff2)
+		log_val = msb1;
+	else
+		log_val = msb2;
 
 	log_val = log_val * 3;
 
-- 
1.7.1



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

* [PATCH 02/20] staging: brcm80211: removed unused argument from softmac functions
  2011-09-24  2:08 [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2 Franky Lin
  2011-09-24  2:08 ` [PATCH 01/20] staging: brcm80211: remove uncoditional code blocks from brcmsmac Franky Lin
@ 2011-09-24  2:08 ` Franky Lin
  2011-09-24  2:08 ` [PATCH 03/20] staging: brcm80211: deleted unused array of bss configurations in softmac Franky Lin
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 35+ messages in thread
From: Franky Lin @ 2011-09-24  2:08 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

From: Roland Vossen <rvossen@broadcom.com>

Parameter 's2' was unused. Affected function was only used internally
to main.c and has been made static and moved above its callers.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/main.c |  380 ++++++++++++++---------------
 drivers/staging/brcm80211/brcmsmac/main.h |    2 -
 2 files changed, 188 insertions(+), 194 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index d6b43ff..d160212 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -830,9 +830,193 @@ brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound)
 	return n >= bound_limit;
 }
 
+static void brcms_c_war16165(struct brcms_c_info *wlc, bool tx)
+{
+	if (tx) {
+		/* the post-increment is used in STAY_AWAKE macro */
+		if (wlc->txpend16165war++ == 0)
+			brcms_c_set_ps_ctrl(wlc);
+	} else {
+		wlc->txpend16165war--;
+		if (wlc->txpend16165war == 0)
+			brcms_c_set_ps_ctrl(wlc);
+	}
+}
+
+/* process an individual struct tx_status */
 static bool
-brcms_b_dotxstatus(struct brcms_hardware *wlc_hw, struct tx_status *txs,
-		   u32 s2)
+brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs)
+{
+	struct sk_buff *p;
+	uint queue;
+	struct d11txh *txh;
+	struct scb *scb = NULL;
+	bool free_pdu;
+	int tx_rts, tx_frame_count, tx_rts_count;
+	uint totlen, supr_status;
+	bool lastframe;
+	struct ieee80211_hdr *h;
+	u16 mcl;
+	struct ieee80211_tx_info *tx_info;
+	struct ieee80211_tx_rate *txrate;
+	int i;
+
+	/* discard intermediate indications for ucode with one legitimate case:
+	 *   e.g. if "useRTS" is set. ucode did a successful rts/cts exchange,
+	 *   but the subsequent tx of DATA failed. so it will start rts/cts
+	 *   from the beginning (resetting the rts transmission count)
+	 */
+	if (!(txs->status & TX_STATUS_AMPDU)
+	    && (txs->status & TX_STATUS_INTERMEDIATE)) {
+		wiphy_err(wlc->wiphy, "%s: INTERMEDIATE but not AMPDU\n",
+			  __func__);
+		return false;
+	}
+
+	queue = txs->frameid & TXFID_QUEUE_MASK;
+	if (queue >= NFIFO) {
+		p = NULL;
+		goto fatal;
+	}
+
+	p = dma_getnexttxp(wlc->hw->di[queue], DMA_RANGE_TRANSMITTED);
+	if (wlc->war16165)
+		brcms_c_war16165(wlc, false);
+	if (p == NULL)
+		goto fatal;
+
+	txh = (struct d11txh *) (p->data);
+	mcl = le16_to_cpu(txh->MacTxControlLow);
+
+	if (txs->phyerr) {
+		if (brcm_msg_level & LOG_ERROR_VAL) {
+			wiphy_err(wlc->wiphy, "phyerr 0x%x, rate 0x%x\n",
+				  txs->phyerr, txh->MainRates);
+			brcms_c_print_txdesc(txh);
+		}
+		brcms_c_print_txstatus(txs);
+	}
+
+	if (txs->frameid != cpu_to_le16(txh->TxFrameID))
+		goto fatal;
+	tx_info = IEEE80211_SKB_CB(p);
+	h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN);
+
+	if (tx_info->control.sta)
+		scb = (struct scb *)tx_info->control.sta->drv_priv;
+
+	if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
+		brcms_c_ampdu_dotxstatus(wlc->ampdu, scb, p, txs);
+		return false;
+	}
+
+	supr_status = txs->status & TX_STATUS_SUPR_MASK;
+	if (supr_status == TX_STATUS_SUPR_BADCH)
+		BCMMSG(wlc->wiphy,
+		       "%s: Pkt tx suppressed, possibly channel %d\n",
+		       __func__, CHSPEC_CHANNEL(wlc->default_bss->chanspec));
+
+	tx_rts = cpu_to_le16(txh->MacTxControlLow) & TXC_SENDRTS;
+	tx_frame_count =
+	    (txs->status & TX_STATUS_FRM_RTX_MASK) >> TX_STATUS_FRM_RTX_SHIFT;
+	tx_rts_count =
+	    (txs->status & TX_STATUS_RTS_RTX_MASK) >> TX_STATUS_RTS_RTX_SHIFT;
+
+	lastframe = !ieee80211_has_morefrags(h->frame_control);
+
+	if (!lastframe) {
+		wiphy_err(wlc->wiphy, "Not last frame!\n");
+	} else {
+		/*
+		 * Set information to be consumed by Minstrel ht.
+		 *
+		 * The "fallback limit" is the number of tx attempts a given
+		 * MPDU is sent at the "primary" rate. Tx attempts beyond that
+		 * limit are sent at the "secondary" rate.
+		 * A 'short frame' does not exceed RTS treshold.
+		 */
+		u16 sfbl,	/* Short Frame Rate Fallback Limit */
+		    lfbl,	/* Long Frame Rate Fallback Limit */
+		    fbl;
+
+		if (queue < AC_COUNT) {
+			sfbl = GFIELD(wlc->wme_retries[wme_fifo2ac[queue]],
+				      EDCF_SFB);
+			lfbl = GFIELD(wlc->wme_retries[wme_fifo2ac[queue]],
+				      EDCF_LFB);
+		} else {
+			sfbl = wlc->SFBL;
+			lfbl = wlc->LFBL;
+		}
+
+		txrate = tx_info->status.rates;
+		if (txrate[0].flags & IEEE80211_TX_RC_USE_RTS_CTS)
+			fbl = lfbl;
+		else
+			fbl = sfbl;
+
+		ieee80211_tx_info_clear_status(tx_info);
+
+		if ((tx_frame_count > fbl) && (txrate[1].idx >= 0)) {
+			/*
+			 * rate selection requested a fallback rate
+			 * and we used it
+			 */
+			txrate[0].count = fbl;
+			txrate[1].count = tx_frame_count - fbl;
+		} else {
+			/*
+			 * rate selection did not request fallback rate, or
+			 * we didn't need it
+			 */
+			txrate[0].count = tx_frame_count;
+			/*
+			 * rc80211_minstrel.c:minstrel_tx_status() expects
+			 * unused rates to be marked with idx = -1
+			 */
+			txrate[1].idx = -1;
+			txrate[1].count = 0;
+		}
+
+		/* clear the rest of the rates */
+		for (i = 2; i < IEEE80211_TX_MAX_RATES; i++) {
+			txrate[i].idx = -1;
+			txrate[i].count = 0;
+		}
+
+		if (txs->status & TX_STATUS_ACK_RCV)
+			tx_info->flags |= IEEE80211_TX_STAT_ACK;
+	}
+
+	totlen = brcmu_pkttotlen(p);
+	free_pdu = true;
+
+	brcms_c_txfifo_complete(wlc, queue, 1);
+
+	if (lastframe) {
+		p->next = NULL;
+		p->prev = NULL;
+		/* remove PLCP & Broadcom tx descriptor header */
+		skb_pull(p, D11_PHY_HDR_LEN);
+		skb_pull(p, D11_TXH_LEN);
+		ieee80211_tx_status_irqsafe(wlc->pub->ieee_hw, p);
+	} else {
+		wiphy_err(wlc->wiphy, "%s: Not last frame => not calling "
+			  "tx_status\n", __func__);
+	}
+
+	return false;
+
+ fatal:
+	if (p)
+		brcmu_pkt_buf_free_skb(p);
+
+	return true;
+
+}
+
+static bool
+brcms_b_dotxstatus(struct brcms_hardware *wlc_hw, struct tx_status *txs)
 {
 	/* discard intermediate indications for ucode with one legitimate case:
 	 *   e.g. if "useRTS" is set. ucode did a successful rts/cts exchange,
@@ -843,7 +1027,7 @@ brcms_b_dotxstatus(struct brcms_hardware *wlc_hw, struct tx_status *txs,
 	    && (txs->status & TX_STATUS_INTERMEDIATE))
 		return false;
 
-	return brcms_c_dotxstatus(wlc_hw->wlc, txs, s2);
+	return brcms_c_dotxstatus(wlc_hw->wlc, txs);
 }
 
 /* process tx completion events in BMAC
@@ -885,7 +1069,7 @@ brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal)
 		txs->phyerr = (s2 & TXS_PTX_MASK) >> TXS_PTX_SHIFT;
 		txs->lasttxtime = 0;
 
-		*fatal = brcms_b_dotxstatus(wlc_hw, txs, s2);
+		*fatal = brcms_b_dotxstatus(wlc_hw, txs);
 
 		/* !give others some time to run! */
 		if (++n >= max_tx_num)
@@ -7654,19 +7838,6 @@ void brcms_c_send_q(struct brcms_c_info *wlc)
 	in_send_q = false;
 }
 
-static void brcms_c_war16165(struct brcms_c_info *wlc, bool tx)
-{
-	if (tx) {
-		/* the post-increment is used in STAY_AWAKE macro */
-		if (wlc->txpend16165war++ == 0)
-			brcms_c_set_ps_ctrl(wlc);
-	} else {
-		wlc->txpend16165war--;
-		if (wlc->txpend16165war == 0)
-			brcms_c_set_ps_ctrl(wlc);
-	}
-}
-
 void
 brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, struct sk_buff *p,
 	       bool commit, s8 txpktpend)
@@ -7978,181 +8149,6 @@ void brcms_c_tbtt(struct brcms_c_info *wlc)
 		wlc->qvalid |= MCMD_DIRFRMQVAL;
 }
 
-/* process an individual struct tx_status */
-bool
-brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs, u32 frm_tx2)
-{
-	struct sk_buff *p;
-	uint queue;
-	struct d11txh *txh;
-	struct scb *scb = NULL;
-	bool free_pdu;
-	int tx_rts, tx_frame_count, tx_rts_count;
-	uint totlen, supr_status;
-	bool lastframe;
-	struct ieee80211_hdr *h;
-	u16 mcl;
-	struct ieee80211_tx_info *tx_info;
-	struct ieee80211_tx_rate *txrate;
-	int i;
-
-	/* Compiler reference to avoid unused variable warning */
-	(void)(frm_tx2);
-
-	/* discard intermediate indications for ucode with one legitimate case:
-	 *   e.g. if "useRTS" is set. ucode did a successful rts/cts exchange,
-	 *   but the subsequent tx of DATA failed. so it will start rts/cts
-	 *   from the beginning (resetting the rts transmission count)
-	 */
-	if (!(txs->status & TX_STATUS_AMPDU)
-	    && (txs->status & TX_STATUS_INTERMEDIATE)) {
-		wiphy_err(wlc->wiphy, "%s: INTERMEDIATE but not AMPDU\n",
-			  __func__);
-		return false;
-	}
-
-	queue = txs->frameid & TXFID_QUEUE_MASK;
-	if (queue >= NFIFO) {
-		p = NULL;
-		goto fatal;
-	}
-
-	p = dma_getnexttxp(wlc->hw->di[queue], DMA_RANGE_TRANSMITTED);
-	if (wlc->war16165)
-		brcms_c_war16165(wlc, false);
-	if (p == NULL)
-		goto fatal;
-
-	txh = (struct d11txh *) (p->data);
-	mcl = le16_to_cpu(txh->MacTxControlLow);
-
-	if (txs->phyerr) {
-		if (brcm_msg_level & LOG_ERROR_VAL) {
-			wiphy_err(wlc->wiphy, "phyerr 0x%x, rate 0x%x\n",
-				  txs->phyerr, txh->MainRates);
-			brcms_c_print_txdesc(txh);
-		}
-		brcms_c_print_txstatus(txs);
-	}
-
-	if (txs->frameid != cpu_to_le16(txh->TxFrameID))
-		goto fatal;
-	tx_info = IEEE80211_SKB_CB(p);
-	h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN);
-
-	if (tx_info->control.sta)
-		scb = (struct scb *)tx_info->control.sta->drv_priv;
-
-	if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
-		brcms_c_ampdu_dotxstatus(wlc->ampdu, scb, p, txs);
-		return false;
-	}
-
-	supr_status = txs->status & TX_STATUS_SUPR_MASK;
-	if (supr_status == TX_STATUS_SUPR_BADCH)
-		BCMMSG(wlc->wiphy,
-		       "%s: Pkt tx suppressed, possibly channel %d\n",
-		       __func__, CHSPEC_CHANNEL(wlc->default_bss->chanspec));
-
-	tx_rts = cpu_to_le16(txh->MacTxControlLow) & TXC_SENDRTS;
-	tx_frame_count =
-	    (txs->status & TX_STATUS_FRM_RTX_MASK) >> TX_STATUS_FRM_RTX_SHIFT;
-	tx_rts_count =
-	    (txs->status & TX_STATUS_RTS_RTX_MASK) >> TX_STATUS_RTS_RTX_SHIFT;
-
-	lastframe = !ieee80211_has_morefrags(h->frame_control);
-
-	if (!lastframe) {
-		wiphy_err(wlc->wiphy, "Not last frame!\n");
-	} else {
-		/*
-		 * Set information to be consumed by Minstrel ht.
-		 *
-		 * The "fallback limit" is the number of tx attempts a given
-		 * MPDU is sent at the "primary" rate. Tx attempts beyond that
-		 * limit are sent at the "secondary" rate.
-		 * A 'short frame' does not exceed RTS treshold.
-		 */
-		u16 sfbl,	/* Short Frame Rate Fallback Limit */
-		    lfbl,	/* Long Frame Rate Fallback Limit */
-		    fbl;
-
-		if (queue < AC_COUNT) {
-			sfbl = GFIELD(wlc->wme_retries[wme_fifo2ac[queue]],
-				      EDCF_SFB);
-			lfbl = GFIELD(wlc->wme_retries[wme_fifo2ac[queue]],
-				      EDCF_LFB);
-		} else {
-			sfbl = wlc->SFBL;
-			lfbl = wlc->LFBL;
-		}
-
-		txrate = tx_info->status.rates;
-		if (txrate[0].flags & IEEE80211_TX_RC_USE_RTS_CTS)
-			fbl = lfbl;
-		else
-			fbl = sfbl;
-
-		ieee80211_tx_info_clear_status(tx_info);
-
-		if ((tx_frame_count > fbl) && (txrate[1].idx >= 0)) {
-			/*
-			 * rate selection requested a fallback rate
-			 * and we used it
-			 */
-			txrate[0].count = fbl;
-			txrate[1].count = tx_frame_count - fbl;
-		} else {
-			/*
-			 * rate selection did not request fallback rate, or
-			 * we didn't need it
-			 */
-			txrate[0].count = tx_frame_count;
-			/*
-			 * rc80211_minstrel.c:minstrel_tx_status() expects
-			 * unused rates to be marked with idx = -1
-			 */
-			txrate[1].idx = -1;
-			txrate[1].count = 0;
-		}
-
-		/* clear the rest of the rates */
-		for (i = 2; i < IEEE80211_TX_MAX_RATES; i++) {
-			txrate[i].idx = -1;
-			txrate[i].count = 0;
-		}
-
-		if (txs->status & TX_STATUS_ACK_RCV)
-			tx_info->flags |= IEEE80211_TX_STAT_ACK;
-	}
-
-	totlen = brcmu_pkttotlen(p);
-	free_pdu = true;
-
-	brcms_c_txfifo_complete(wlc, queue, 1);
-
-	if (lastframe) {
-		p->next = NULL;
-		p->prev = NULL;
-		/* remove PLCP & Broadcom tx descriptor header */
-		skb_pull(p, D11_PHY_HDR_LEN);
-		skb_pull(p, D11_TXH_LEN);
-		ieee80211_tx_status_irqsafe(wlc->pub->ieee_hw, p);
-	} else {
-		wiphy_err(wlc->wiphy, "%s: Not last frame => not calling "
-			  "tx_status\n", __func__);
-	}
-
-	return false;
-
- fatal:
-	if (p)
-		brcmu_pkt_buf_free_skb(p);
-
-	return true;
-
-}
-
 void
 brcms_c_txfifo_complete(struct brcms_c_info *wlc, uint fifo, s8 txpktpend)
 {
diff --git a/drivers/staging/brcm80211/brcmsmac/main.h b/drivers/staging/brcm80211/brcmsmac/main.h
index aa0bf03..1572e46 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.h
+++ b/drivers/staging/brcm80211/brcmsmac/main.h
@@ -702,8 +702,6 @@ struct brcms_bss_cfg {
 extern void brcms_c_fatal_error(struct brcms_c_info *wlc);
 extern void brcms_b_rpc_watchdog(struct brcms_c_info *wlc);
 extern void brcms_c_recv(struct brcms_c_info *wlc, struct sk_buff *p);
-extern bool brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs,
-			       u32 frm_tx2);
 extern void brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo,
 			   struct sk_buff *p,
 			   bool commit, s8 txpktpend);
-- 
1.7.1



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

* [PATCH 03/20] staging: brcm80211: deleted unused array of bss configurations in softmac
  2011-09-24  2:08 [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2 Franky Lin
  2011-09-24  2:08 ` [PATCH 01/20] staging: brcm80211: remove uncoditional code blocks from brcmsmac Franky Lin
  2011-09-24  2:08 ` [PATCH 02/20] staging: brcm80211: removed unused argument from softmac functions Franky Lin
@ 2011-09-24  2:08 ` Franky Lin
  2011-09-24  2:08 ` [PATCH 04/20] staging: brcm80211: removed redundant wlc->cfg struct member Franky Lin
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 35+ messages in thread
From: Franky Lin @ 2011-09-24  2:08 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

From: Roland Vossen <rvossen@broadcom.com>

List always had one element. Converted the array to a scalar.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/main.c  |  139 +++++++++-------------------
 drivers/staging/brcm80211/brcmsmac/main.h  |    2 +-
 drivers/staging/brcm80211/brcmsmac/types.h |    5 -
 3 files changed, 43 insertions(+), 103 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index d160212..138f63b 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -342,15 +342,6 @@ static u16 frametype(u32 rspec, u8 mimoframe)
 /* Starting corerev for the fifo size table */
 #define XMTFIFOTBL_STARTREV	20
 
-/* iterate through all valid bsscfg entries */
-#define FOREACH_BSS(wlc, idx, cfg) \
-	for (idx = 0; (int) idx < BRCMS_MAXBSSCFG; idx++) { \
-		cfg = (wlc)->bsscfg[idx]; \
-		if (!cfg) \
-			continue;
-/* close marker for iterator code block */
-#define END_FOREACH_BSS()	}
-
 /* currently the best mechanism for determining SIFS is the band in use */
 static u16 get_sifs(struct brcms_band *band)
 {
@@ -3278,8 +3269,7 @@ static void brcms_b_antsel_set(struct brcms_hardware *wlc_hw, u32 antsel_avail)
  */
 bool brcms_c_ps_allowed(struct brcms_c_info *wlc)
 {
-	int idx;
-	struct brcms_bss_cfg *cfg;
+	struct brcms_bss_cfg *cfg = wlc->bsscfg;
 
 	/* disallow PS when one of the following global conditions meets */
 	if (!wlc->pub->associated)
@@ -3289,19 +3279,16 @@ bool brcms_c_ps_allowed(struct brcms_c_info *wlc)
 	if (wlc->monitor)
 		return false;
 
-	for (idx = 0; idx < BRCMS_MAXBSSCFG; idx++) {
-		cfg = wlc->bsscfg[idx];
-		if (cfg && cfg->associated) {
-			/*
-			 * disallow PS when one of the following
-			 * bsscfg specific conditions meets
-			 */
-			if (!cfg->BSS)
-				return false;
+	if (cfg->associated) {
+		/*
+		 * disallow PS when one of the following
+		 * bsscfg specific conditions meets
+		 */
+		if (!cfg->BSS)
+			return false;
 
-			if (!cfg->dtim_programmed)
-				return false;
-		}
+		if (!cfg->dtim_programmed)
+			return false;
 	}
 
 	return true;
@@ -3779,8 +3766,6 @@ void brcms_c_init(struct brcms_c_info *wlc)
 {
 	struct d11regs *regs;
 	u16 chanspec;
-	int i;
-	struct brcms_bss_cfg *bsscfg;
 	bool mute = false;
 
 	BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit);
@@ -3806,32 +3791,24 @@ void brcms_c_init(struct brcms_c_info *wlc)
 	brcms_c_reprate_init(wlc);
 
 	/* write ethernet address to core */
-	FOREACH_BSS(wlc, i, bsscfg)
-		brcms_c_set_mac(bsscfg);
-		brcms_c_set_bssid(bsscfg);
-	END_FOREACH_BSS()
+	brcms_c_set_mac(wlc->bsscfg);
+	brcms_c_set_bssid(wlc->bsscfg);
 
 	/* Update tsf_cfprep if associated and up */
-	if (wlc->pub->associated) {
-		FOREACH_BSS(wlc, i, bsscfg)
-			if (bsscfg->up) {
-				u32 bi;
+	if (wlc->pub->associated && wlc->bsscfg->up) {
+		u32 bi;
 
-				/* get beacon period and convert to uS */
-				bi = bsscfg->current_bss->beacon_period << 10;
-				/*
-				 * update since init path would reset
-				 * to default value
-				 */
-				W_REG(&regs->tsf_cfprep,
-				      (bi << CFPREP_CBI_SHIFT));
-
-				/* Update maccontrol PM related bits */
-				brcms_c_set_ps_ctrl(wlc);
+		/* get beacon period and convert to uS */
+		bi = wlc->bsscfg->current_bss->beacon_period << 10;
+		/*
+		 * update since init path would reset
+		 * to default value
+		 */
+		W_REG(&regs->tsf_cfprep,
+		      (bi << CFPREP_CBI_SHIFT));
 
-				break;
-			}
-		END_FOREACH_BSS()
+		/* Update maccontrol PM related bits */
+		brcms_c_set_ps_ctrl(wlc);
 	}
 
 	brcms_c_bandinit_ordered(wlc, chanspec);
@@ -4021,26 +3998,13 @@ void brcms_c_switch_shortslot(struct brcms_c_info *wlc, bool shortslot)
 	brcms_b_set_shortslot(wlc->hw, shortslot);
 }
 
-/*
- * propagate home chanspec to all bsscfgs in
- * case bsscfg->current_bss->chanspec is referenced
- */
 void brcms_c_set_home_chanspec(struct brcms_c_info *wlc, u16 chanspec)
 {
 	if (wlc->home_chanspec != chanspec) {
-		int idx;
-		struct brcms_bss_cfg *cfg;
-
 		wlc->home_chanspec = chanspec;
 
-		FOREACH_BSS(wlc, idx, cfg)
-			if (!cfg->associated)
-				continue;
-
-			cfg->current_bss->chanspec = chanspec;
-		END_FOREACH_BSS()
-
-
+		if (wlc->bsscfg->associated)
+			wlc->bsscfg->current_bss->chanspec = chanspec;
 	}
 }
 
@@ -4092,8 +4056,7 @@ brcms_b_set_chanspec(struct brcms_hardware *wlc_hw, u16 chanspec,
 static void brcms_c_setband(struct brcms_c_info *wlc,
 					   uint bandunit)
 {
-	int idx;
-	struct brcms_bss_cfg *cfg;
+	struct brcms_bss_cfg *cfg = wlc->bsscfg;
 
 	wlc->band = wlc->bandstate[bandunit];
 
@@ -4101,11 +4064,9 @@ static void brcms_c_setband(struct brcms_c_info *wlc,
 		return;
 
 	/* wait for at least one beacon before entering sleeping state */
-	for (idx = 0; idx < BRCMS_MAXBSSCFG; idx++) {
-		cfg = wlc->bsscfg[idx];
-		if (cfg && cfg->associated)
-			cfg->PMawakebcn = true;
-	}
+	if (cfg->associated)
+		cfg->PMawakebcn = true;
+
 	brcms_c_set_ps_ctrl(wlc);
 
 	/* band-specific initializations */
@@ -5427,7 +5388,7 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
 		goto fail;
 	}
 
-	wlc->bsscfg[0] = wlc->cfg;
+	wlc->bsscfg = wlc->cfg;
 	wlc->cfg->_idx = 0;
 	wlc->cfg->wlc = wlc;
 
@@ -5840,19 +5801,15 @@ int brcms_c_up(struct brcms_c_info *wlc)
 		if (status == -ENOMEDIUM) {
 			if (!mboolisset
 			    (wlc->pub->radio_disabled, WL_RADIO_HW_DISABLE)) {
-				int idx;
-				struct brcms_bss_cfg *bsscfg;
+				struct brcms_bss_cfg *bsscfg = wlc->bsscfg;
 				mboolset(wlc->pub->radio_disabled,
 					 WL_RADIO_HW_DISABLE);
 
-				FOREACH_BSS(wlc, idx, bsscfg)
-					if (!bsscfg->enable || !bsscfg->BSS)
-						continue;
-					wiphy_err(wlc->wiphy, "wl%d.%d: up"
+				if (bsscfg->enable && bsscfg->BSS)
+					wiphy_err(wlc->wiphy, "wl%d: up"
 						  ": rfdisable -> "
 						  "bsscfg_disable()\n",
-						   wlc->pub->unit, idx);
-				END_FOREACH_BSS()
+						   wlc->pub->unit);
 			}
 		}
 	}
@@ -8993,14 +8950,10 @@ void brcms_c_bss_update_beacon(struct brcms_c_info *wlc,
  */
 void brcms_c_update_beacon(struct brcms_c_info *wlc)
 {
-	int idx;
-	struct brcms_bss_cfg *bsscfg;
+	struct brcms_bss_cfg *bsscfg = wlc->bsscfg;
 
-	/* update AP or IBSS beacons */
-	FOREACH_BSS(wlc, idx, bsscfg)
-		if (bsscfg->up && !bsscfg->BSS)
-			brcms_c_bss_update_beacon(wlc, bsscfg);
-	END_FOREACH_BSS()
+	if (bsscfg->up && !bsscfg->BSS)
+		brcms_c_bss_update_beacon(wlc, bsscfg);
 }
 
 /* Write ssid into shared memory */
@@ -9020,14 +8973,11 @@ void brcms_c_shm_ssid_upd(struct brcms_c_info *wlc, struct brcms_bss_cfg *cfg)
 
 void brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend)
 {
-	int idx;
-	struct brcms_bss_cfg *bsscfg;
+	struct brcms_bss_cfg *bsscfg = wlc->bsscfg;
 
 	/* update AP or IBSS probe responses */
-	FOREACH_BSS(wlc, idx, bsscfg)
-		if (bsscfg->up && !bsscfg->BSS)
-			brcms_c_bss_update_probe_resp(wlc, bsscfg, suspend);
-	END_FOREACH_BSS()
+	if (bsscfg->up && !bsscfg->BSS)
+		brcms_c_bss_update_probe_resp(wlc, bsscfg, suspend);
 }
 
 void
@@ -9105,12 +9055,7 @@ int brcms_c_prep_pdu(struct brcms_c_info *wlc, struct sk_buff *pdu, uint *fifop)
 /* init tx reported rate mechanism */
 void brcms_c_reprate_init(struct brcms_c_info *wlc)
 {
-	int i;
-	struct brcms_bss_cfg *bsscfg;
-
-	FOREACH_BSS(wlc, i, bsscfg)
-		brcms_c_bsscfg_reprate_init(bsscfg);
-	END_FOREACH_BSS()
+	brcms_c_bsscfg_reprate_init(wlc->bsscfg);
 }
 
 /* per bsscfg init tx reported rate mechanism */
diff --git a/drivers/staging/brcm80211/brcmsmac/main.h b/drivers/staging/brcm80211/brcmsmac/main.h
index 1572e46..ede4aef 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.h
+++ b/drivers/staging/brcm80211/brcmsmac/main.h
@@ -564,7 +564,7 @@ struct brcms_c_info {
 	u16 tx_prec_map;
 	u16 fifo2prec_map[NFIFO];
 
-	struct brcms_bss_cfg *bsscfg[BRCMS_MAXBSSCFG];
+	struct brcms_bss_cfg *bsscfg;
 	struct brcms_bss_cfg *cfg;
 
 	/* tx queue */
diff --git a/drivers/staging/brcm80211/brcmsmac/types.h b/drivers/staging/brcm80211/brcmsmac/types.h
index ace210c..415ab8b 100644
--- a/drivers/staging/brcm80211/brcmsmac/types.h
+++ b/drivers/staging/brcm80211/brcmsmac/types.h
@@ -244,11 +244,6 @@
  * ********************************************************************
  */
 
-/* NetBSD also needs to keep track of this */
-
-/* max # BSS configs */
-#define BRCMS_MAXBSSCFG		(1)
-
 #define BCMMSG(dev, fmt, args...)		\
 do {						\
 	if (brcm_msg_level & LOG_TRACE_VAL)	\
-- 
1.7.1



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

* [PATCH 04/20] staging: brcm80211: removed redundant wlc->cfg struct member
  2011-09-24  2:08 [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2 Franky Lin
                   ` (2 preceding siblings ...)
  2011-09-24  2:08 ` [PATCH 03/20] staging: brcm80211: deleted unused array of bss configurations in softmac Franky Lin
@ 2011-09-24  2:08 ` Franky Lin
  2011-09-24  2:08 ` [PATCH 05/20] staging: brcm80211: removed global var from aiutils.c Franky Lin
                   ` (15 subsequent siblings)
  19 siblings, 0 replies; 35+ messages in thread
From: Franky Lin @ 2011-09-24  2:08 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

From: Roland Vossen <rvossen@broadcom.com>

After initialization ('attach'), this struct member always pointed at
the same memory as wlc->bsscfg.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/main.c |   47 ++++++++++++----------------
 drivers/staging/brcm80211/brcmsmac/main.h |    1 -
 2 files changed, 20 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 138f63b..ee9c322 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -486,7 +486,7 @@ static void brcms_c_detach_mfree(struct brcms_c_info *wlc)
 	if (wlc == NULL)
 		return;
 
-	brcms_c_bsscfg_mfree(wlc->cfg);
+	brcms_c_bsscfg_mfree(wlc->bsscfg);
 	kfree(wlc->pub);
 	kfree(wlc->modulecb);
 	kfree(wlc->default_bss);
@@ -577,8 +577,8 @@ brcms_c_attach_malloc(uint unit, uint *err, uint devid)
 		goto fail;
 	}
 
-	wlc->cfg = brcms_c_bsscfg_malloc(unit);
-	if (wlc->cfg == NULL) {
+	wlc->bsscfg = brcms_c_bsscfg_malloc(unit);
+	if (wlc->bsscfg == NULL) {
 		*err = 1011;
 		goto fail;
 	}
@@ -3943,14 +3943,13 @@ void brcms_c_set_ps_ctrl(struct brcms_c_info *wlc)
  * Write this BSS config's MAC address to core.
  * Updates RXE match engine.
  */
-int brcms_c_set_mac(struct brcms_bss_cfg *cfg)
+int brcms_c_set_mac(struct brcms_bss_cfg *bsscfg)
 {
 	int err = 0;
-	struct brcms_c_info *wlc = cfg->wlc;
+	struct brcms_c_info *wlc = bsscfg->wlc;
 
-	if (cfg == wlc->cfg)
-		/* enter the MAC addr into the RXE match registers */
-		brcms_c_set_addrmatch(wlc, RCM_MAC_OFFSET, cfg->cur_etheraddr);
+	/* enter the MAC addr into the RXE match registers */
+	brcms_c_set_addrmatch(wlc, RCM_MAC_OFFSET, bsscfg->cur_etheraddr);
 
 	brcms_c_ampdu_macaddr_upd(wlc);
 
@@ -3960,13 +3959,10 @@ int brcms_c_set_mac(struct brcms_bss_cfg *cfg)
 /* Write the BSS config's BSSID address to core (set_bssid in d11procs.tcl).
  * Updates RXE match engine.
  */
-void brcms_c_set_bssid(struct brcms_bss_cfg *cfg)
+void brcms_c_set_bssid(struct brcms_bss_cfg *bsscfg)
 {
-	struct brcms_c_info *wlc = cfg->wlc;
-
-	/* if primary config, we need to update BSSID in RXE match registers */
-	if (cfg == wlc->cfg)
-		brcms_c_set_addrmatch(wlc, RCM_BSSID_OFFSET, cfg->BSSID);
+	/* we need to update BSSID in RXE match registers */
+	brcms_c_set_addrmatch(bsscfg->wlc, RCM_BSSID_OFFSET, bsscfg->BSSID);
 }
 
 static void brcms_b_set_shortslot(struct brcms_hardware *wlc_hw, bool shortslot)
@@ -5388,9 +5384,8 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
 		goto fail;
 	}
 
-	wlc->bsscfg = wlc->cfg;
-	wlc->cfg->_idx = 0;
-	wlc->cfg->wlc = wlc;
+	wlc->bsscfg->_idx = 0;
+	wlc->bsscfg->wlc = wlc;
 
 	wlc->mimoft = FT_HT;
 	wlc->ht_cap.cap_info = HT_CAP;
@@ -6241,8 +6236,8 @@ static void brcms_c_ofdm_rateset_war(struct brcms_c_info *wlc)
 	u8 r;
 	bool war = false;
 
-	if (wlc->cfg->associated)
-		r = wlc->cfg->current_bss->rateset.rates[0];
+	if (wlc->bsscfg->associated)
+		r = wlc->bsscfg->current_bss->rateset.rates[0];
 	else
 		r = wlc->default_bss->rateset.rates[0];
 
@@ -6311,7 +6306,7 @@ void brcms_c_get_current_rateset(struct brcms_c_info *wlc,
 	struct brcms_c_rateset *rs;
 
 	if (wlc->pub->associated)
-		rs = &wlc->cfg->current_bss->rateset;
+		rs = &wlc->bsscfg->current_bss->rateset;
 	else
 		rs = &wlc->default_bss->rateset;
 
@@ -6337,8 +6332,8 @@ int brcms_c_set_rateset(struct brcms_c_info *wlc, struct brcm_rateset *rs)
 	/* merge rateset coming in with the current mcsset */
 	if (wlc->pub->_n_enab & SUPPORT_11N) {
 		struct brcms_bss_info *mcsset_bss;
-		if (wlc->cfg->associated)
-			mcsset_bss = wlc->cfg->current_bss;
+		if (wlc->bsscfg->associated)
+			mcsset_bss = wlc->bsscfg->current_bss;
 		else
 			mcsset_bss = wlc->default_bss;
 		memcpy(internal_rs.mcs, &mcsset_bss->rateset.mcs[0],
@@ -8096,9 +8091,7 @@ brcms_c_rspec_to_rts_rspec(struct brcms_c_info *wlc, u32 rspec,
 
 void brcms_c_tbtt(struct brcms_c_info *wlc)
 {
-	struct brcms_bss_cfg *cfg = wlc->cfg;
-
-	if (!cfg->BSS)
+	if (!wlc->bsscfg->BSS)
 		/*
 		 * DirFrmQ is now valid...defer setting until end
 		 * of ATIM window
@@ -9144,7 +9137,7 @@ brcms_c_set_addrmatch(struct brcms_c_info *wlc, int match_reg_offset,
 {
 	brcms_b_set_addrmatch(wlc->hw, match_reg_offset, addr);
 	if (match_reg_offset == RCM_BSSID_OFFSET)
-		memcpy(wlc->cfg->BSSID, addr, ETH_ALEN);
+		memcpy(wlc->bsscfg->BSSID, addr, ETH_ALEN);
 }
 
 void brcms_c_pllreq(struct brcms_c_info *wlc, bool set, u32 req_bit)
@@ -9273,7 +9266,7 @@ void brcms_c_scan_stop(struct brcms_c_info *wlc)
 void brcms_c_associate_upd(struct brcms_c_info *wlc, bool state)
 {
 	wlc->pub->associated = state;
-	wlc->cfg->associated = state;
+	wlc->bsscfg->associated = state;
 }
 
 /*
diff --git a/drivers/staging/brcm80211/brcmsmac/main.h b/drivers/staging/brcm80211/brcmsmac/main.h
index ede4aef..d6de9c3 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.h
+++ b/drivers/staging/brcm80211/brcmsmac/main.h
@@ -565,7 +565,6 @@ struct brcms_c_info {
 	u16 fifo2prec_map[NFIFO];
 
 	struct brcms_bss_cfg *bsscfg;
-	struct brcms_bss_cfg *cfg;
 
 	/* tx queue */
 	struct brcms_txq_info *tx_queues;
-- 
1.7.1



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

* [PATCH 05/20] staging: brcm80211: removed global var from aiutils.c
  2011-09-24  2:08 [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2 Franky Lin
                   ` (3 preceding siblings ...)
  2011-09-24  2:08 ` [PATCH 04/20] staging: brcm80211: removed redundant wlc->cfg struct member Franky Lin
@ 2011-09-24  2:08 ` Franky Lin
  2011-09-24  2:08 ` [PATCH 06/20] staging: brcm80211: removed global vars in softmac ucode handling Franky Lin
                   ` (14 subsequent siblings)
  19 siblings, 0 replies; 35+ messages in thread
From: Franky Lin @ 2011-09-24  2:08 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

From: Roland Vossen <rvossen@broadcom.com>

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/aiutils.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/aiutils.c b/drivers/staging/brcm80211/brcmsmac/aiutils.c
index b7b0bdf..d05c4ba 100644
--- a/drivers/staging/brcm80211/brcmsmac/aiutils.c
+++ b/drivers/staging/brcm80211/brcmsmac/aiutils.c
@@ -477,9 +477,6 @@ struct aidmp {
 	u32 componentid3;	/* 0xffc */
 };
 
-/* global kernel resource */
-static struct si_info ksii;
-
 /* EROM parsing */
 
 static u32
@@ -1216,8 +1213,7 @@ void ai_detach(struct si_pub *sih)
 		pcicore_deinit(sii->pch);
 	sii->pch = NULL;
 
-	if (sii != &ksii)
-		kfree(sii);
+	kfree(sii);
 }
 
 /* register driver interrupt disabling and restoring callback functions */
-- 
1.7.1



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

* [PATCH 06/20] staging: brcm80211: removed global vars in softmac ucode handling
  2011-09-24  2:08 [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2 Franky Lin
                   ` (4 preceding siblings ...)
  2011-09-24  2:08 ` [PATCH 05/20] staging: brcm80211: removed global var from aiutils.c Franky Lin
@ 2011-09-24  2:08 ` Franky Lin
  2011-09-24  2:08 ` [PATCH 07/20] staging: brcm80211: removed unused softmac workaround Franky Lin
                   ` (13 subsequent siblings)
  19 siblings, 0 replies; 35+ messages in thread
From: Franky Lin @ 2011-09-24  2:08 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

From: Roland Vossen <rvossen@broadcom.com>

Moved global vars into a per-device structure.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c  |    4 +-
 drivers/staging/brcm80211/brcmsmac/mac80211_if.h  |    3 +-
 drivers/staging/brcm80211/brcmsmac/main.c         |   27 ++++--
 drivers/staging/brcm80211/brcmsmac/ucode_loader.c |  121 ++++++++++-----------
 drivers/staging/brcm80211/brcmsmac/ucode_loader.h |   46 +++++----
 5 files changed, 106 insertions(+), 95 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
index 32d7abf..9bd4b83 100644
--- a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
@@ -894,7 +894,7 @@ static int brcms_request_fw(struct brcms_info *wl, struct pci_dev *pdev)
 		    wl->fw.fw_hdr[i]->size / (sizeof(struct firmware_hdr));
 	}
 	wl->fw.fw_cnt = i;
-	return brcms_ucode_data_init(wl);
+	return brcms_ucode_data_init(wl, &wl->ucode);
 }
 
 /*
@@ -925,7 +925,7 @@ static void brcms_free(struct brcms_info *wl)
 
 	/* free ucode data */
 	if (wl->fw.fw_cnt)
-		brcms_ucode_data_free();
+		brcms_ucode_data_free(&wl->ucode);
 	if (wl->irq)
 		free_irq(wl->irq, wl);
 
diff --git a/drivers/staging/brcm80211/brcmsmac/mac80211_if.h b/drivers/staging/brcm80211/brcmsmac/mac80211_if.h
index 1eb36ed..2bdcd4c 100644
--- a/drivers/staging/brcm80211/brcmsmac/mac80211_if.h
+++ b/drivers/staging/brcm80211/brcmsmac/mac80211_if.h
@@ -19,7 +19,7 @@
 
 #include <linux/timer.h>
 #include <linux/interrupt.h>
-
+#include "ucode_loader.h"
 /*
  * Starting index for 5G rates in the
  * legacy rate table.
@@ -77,6 +77,7 @@ struct brcms_info {
 	bool resched;		/* dpc needs to be and is rescheduled */
 	struct brcms_firmware fw;
 	struct wiphy *wiphy;
+	struct brcms_ucode ucode;
 };
 
 /* misc callbacks */
diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index ee9c322..4d5c842 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -342,6 +342,12 @@ static u16 frametype(u32 rspec, u8 mimoframe)
 /* Starting corerev for the fifo size table */
 #define XMTFIFOTBL_STARTREV	20
 
+struct d11init {
+	u16 addr;
+	u16 size;
+	u32 value;
+};
+
 /* currently the best mechanism for determining SIFS is the band in use */
 static u16 get_sifs(struct brcms_band *band)
 {
@@ -349,6 +355,7 @@ static u16 get_sifs(struct brcms_band *band)
 				 BPHY_SIFS_TIME;
 }
 
+
 /*
  * Detect Card removed.
  * Even checking an sbconfig register read will not false trigger when the core
@@ -694,6 +701,7 @@ static void brcms_c_write_mhf(struct brcms_hardware *wlc_hw, u16 *mhfs)
 static void brcms_c_ucode_bsinit(struct brcms_hardware *wlc_hw)
 {
 	struct wiphy *wiphy = wlc_hw->wlc->wiphy;
+	struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode;
 
 	/* init microcode host flags */
 	brcms_c_write_mhf(wlc_hw, wlc_hw->band->mhfs);
@@ -701,7 +709,7 @@ static void brcms_c_ucode_bsinit(struct brcms_hardware *wlc_hw)
 	/* do band-specific ucode IHR, SHM, and SCR inits */
 	if (D11REV_IS(wlc_hw->corerev, 23)) {
 		if (BRCMS_ISNPHY(wlc_hw->band))
-			brcms_c_write_inits(wlc_hw, d11n0bsinitvals16);
+			brcms_c_write_inits(wlc_hw, ucode->d11n0bsinitvals16);
 		else
 			wiphy_err(wiphy, "%s: wl%d: unsupported phy in corerev"
 				  " %d\n", __func__, wlc_hw->unit,
@@ -710,7 +718,7 @@ static void brcms_c_ucode_bsinit(struct brcms_hardware *wlc_hw)
 		if (D11REV_IS(wlc_hw->corerev, 24)) {
 			if (BRCMS_ISLCNPHY(wlc_hw->band))
 				brcms_c_write_inits(wlc_hw,
-						    d11lcn0bsinitvals24);
+						    ucode->d11lcn0bsinitvals24);
 			else
 				wiphy_err(wiphy, "%s: wl%d: unsupported phy in"
 					  " core rev %d\n", __func__,
@@ -2457,6 +2465,8 @@ static void brcms_ucode_write(struct brcms_hardware *wlc_hw, const u32 ucode[],
 static void brcms_ucode_download(struct brcms_hardware *wlc_hw)
 {
 	struct brcms_c_info *wlc;
+	struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode;
+
 	wlc = wlc_hw->wlc;
 
 	if (wlc_hw->ucode_loaded)
@@ -2464,8 +2474,8 @@ static void brcms_ucode_download(struct brcms_hardware *wlc_hw)
 
 	if (D11REV_IS(wlc_hw->corerev, 23)) {
 		if (BRCMS_ISNPHY(wlc_hw->band)) {
-			brcms_ucode_write(wlc_hw, bcm43xx_16_mimo,
-					bcm43xx_16_mimosz);
+			brcms_ucode_write(wlc_hw, ucode->bcm43xx_16_mimo,
+					  ucode->bcm43xx_16_mimosz);
 			wlc_hw->ucode_loaded = true;
 		} else
 			wiphy_err(wlc->wiphy, "%s: wl%d: unsupported phy in "
@@ -2473,8 +2483,8 @@ static void brcms_ucode_download(struct brcms_hardware *wlc_hw)
 				  __func__, wlc_hw->unit, wlc_hw->corerev);
 	} else if (D11REV_IS(wlc_hw->corerev, 24)) {
 		if (BRCMS_ISLCNPHY(wlc_hw->band)) {
-			brcms_ucode_write(wlc_hw, bcm43xx_24_lcn,
-					bcm43xx_24_lcnsz);
+			brcms_ucode_write(wlc_hw, ucode->bcm43xx_24_lcn,
+					  ucode->bcm43xx_24_lcnsz);
 			wlc_hw->ucode_loaded = true;
 		} else {
 			wiphy_err(wlc->wiphy, "%s: wl%d: unsupported phy in "
@@ -3372,6 +3382,7 @@ static void brcms_b_coreinit(struct brcms_c_info *wlc)
 	int err = 0;
 	u16 buf[NFIFO];
 	struct wiphy *wiphy = wlc->wiphy;
+	struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode;
 
 	regs = wlc_hw->regs;
 
@@ -3404,14 +3415,14 @@ static void brcms_b_coreinit(struct brcms_c_info *wlc)
 
 	if (D11REV_IS(wlc_hw->corerev, 23)) {
 		if (BRCMS_ISNPHY(wlc_hw->band))
-			brcms_c_write_inits(wlc_hw, d11n0initvals16);
+			brcms_c_write_inits(wlc_hw, ucode->d11n0initvals16);
 		else
 			wiphy_err(wiphy, "%s: wl%d: unsupported phy in corerev"
 				  " %d\n", __func__, wlc_hw->unit,
 				  wlc_hw->corerev);
 	} else if (D11REV_IS(wlc_hw->corerev, 24)) {
 		if (BRCMS_ISLCNPHY(wlc_hw->band))
-			brcms_c_write_inits(wlc_hw, d11lcn0initvals24);
+			brcms_c_write_inits(wlc_hw, ucode->d11lcn0initvals24);
 		else
 			wiphy_err(wiphy, "%s: wl%d: unsupported phy in corerev"
 				  " %d\n", __func__, wlc_hw->unit,
diff --git a/drivers/staging/brcm80211/brcmsmac/ucode_loader.c b/drivers/staging/brcm80211/brcmsmac/ucode_loader.c
index c14bce8..80e3ccf 100644
--- a/drivers/staging/brcm80211/brcmsmac/ucode_loader.c
+++ b/drivers/staging/brcm80211/brcmsmac/ucode_loader.c
@@ -37,80 +37,73 @@ enum {
 	D11UCODE_OVERSIGHT_BOMMINOR
 };
 
-struct d11init *d11lcn0bsinitvals24;
-struct d11init *d11lcn0initvals24;
-struct d11init *d11lcn1bsinitvals24;
-struct d11init *d11lcn1initvals24;
-struct d11init *d11lcn2bsinitvals24;
-struct d11init *d11lcn2initvals24;
-struct d11init *d11n0absinitvals16;
-struct d11init *d11n0bsinitvals16;
-struct d11init *d11n0initvals16;
-u32 *bcm43xx_16_mimo;
-u32 bcm43xx_16_mimosz;
-u32 *bcm43xx_24_lcn;
-u32 bcm43xx_24_lcnsz;
-
-static u32 *bcm43xx_bommajor;
-static u32 *bcm43xx_bomminor;
-
-int brcms_ucode_data_init(struct brcms_info *wl)
+int brcms_ucode_data_init(struct brcms_info *wl, struct brcms_ucode *ucode)
 {
 	int rc;
+
 	rc = brcms_check_firmwares(wl);
 
 	rc = rc < 0 ? rc :
-		brcms_ucode_init_buf(wl, (void **)&d11lcn0bsinitvals24,
+		brcms_ucode_init_buf(wl, (void **)&ucode->d11lcn0bsinitvals24,
 				     D11LCN0BSINITVALS24);
-	rc = rc < 0 ? rc : brcms_ucode_init_buf(wl, (void **)&d11lcn0initvals24,
-					     D11LCN0INITVALS24);
+	rc = rc < 0 ?
+	     rc : brcms_ucode_init_buf(wl, (void **)&ucode->d11lcn0initvals24,
+				       D11LCN0INITVALS24);
+	rc = rc < 0 ?
+	     rc : brcms_ucode_init_buf(wl, (void **)&ucode->d11lcn1bsinitvals24,
+				       D11LCN1BSINITVALS24);
+	rc = rc < 0 ?
+	     rc : brcms_ucode_init_buf(wl, (void **)&ucode->d11lcn1initvals24,
+				       D11LCN1INITVALS24);
 	rc = rc < 0 ? rc :
-		brcms_ucode_init_buf(wl, (void **)&d11lcn1bsinitvals24,
-				     D11LCN1BSINITVALS24);
-	rc = rc < 0 ? rc : brcms_ucode_init_buf(wl, (void **)&d11lcn1initvals24,
-					     D11LCN1INITVALS24);
-	rc = rc < 0 ? rc :
-		brcms_ucode_init_buf(wl, (void **)&d11lcn2bsinitvals24,
+		brcms_ucode_init_buf(wl, (void **)&ucode->d11lcn2bsinitvals24,
 				     D11LCN2BSINITVALS24);
-	rc = rc < 0 ? rc : brcms_ucode_init_buf(wl, (void **)&d11lcn2initvals24,
-					     D11LCN2INITVALS24);
-	rc = rc < 0 ? rc :
-		brcms_ucode_init_buf(wl, (void **)&d11n0absinitvals16,
-				     D11N0ABSINITVALS16);
-	rc = rc < 0 ? rc : brcms_ucode_init_buf(wl, (void **)&d11n0bsinitvals16,
-					     D11N0BSINITVALS16);
-	rc = rc < 0 ? rc : brcms_ucode_init_buf(wl, (void **)&d11n0initvals16,
-					     D11N0INITVALS16);
-	rc = rc < 0 ? rc : brcms_ucode_init_buf(wl, (void **)&bcm43xx_16_mimo,
-					     D11UCODE_OVERSIGHT16_MIMO);
-	rc = rc < 0 ? rc : brcms_ucode_init_uint(wl, &bcm43xx_16_mimosz,
-					      D11UCODE_OVERSIGHT16_MIMOSZ);
-	rc = rc < 0 ? rc : brcms_ucode_init_buf(wl, (void **)&bcm43xx_24_lcn,
-					     D11UCODE_OVERSIGHT24_LCN);
-	rc = rc < 0 ? rc : brcms_ucode_init_uint(wl, &bcm43xx_24_lcnsz,
-					      D11UCODE_OVERSIGHT24_LCNSZ);
-	rc = rc < 0 ? rc : brcms_ucode_init_buf(wl, (void **)&bcm43xx_bommajor,
-					     D11UCODE_OVERSIGHT_BOMMAJOR);
-	rc = rc < 0 ? rc : brcms_ucode_init_buf(wl, (void **)&bcm43xx_bomminor,
-					     D11UCODE_OVERSIGHT_BOMMINOR);
+	rc = rc < 0 ?
+	     rc : brcms_ucode_init_buf(wl, (void **)&ucode->d11lcn2initvals24,
+				       D11LCN2INITVALS24);
+	rc = rc < 0 ?
+	     rc : brcms_ucode_init_buf(wl, (void **)&ucode->d11n0absinitvals16,
+				       D11N0ABSINITVALS16);
+	rc = rc < 0 ?
+	     rc : brcms_ucode_init_buf(wl, (void **)&ucode->d11n0bsinitvals16,
+				       D11N0BSINITVALS16);
+	rc = rc < 0 ?
+	     rc : brcms_ucode_init_buf(wl, (void **)&ucode->d11n0initvals16,
+				       D11N0INITVALS16);
+	rc = rc < 0 ?
+	     rc : brcms_ucode_init_buf(wl, (void **)&ucode->bcm43xx_16_mimo,
+				       D11UCODE_OVERSIGHT16_MIMO);
+	rc = rc < 0 ?
+	     rc : brcms_ucode_init_uint(wl, &ucode->bcm43xx_16_mimosz,
+					D11UCODE_OVERSIGHT16_MIMOSZ);
+	rc = rc < 0 ?
+	     rc : brcms_ucode_init_buf(wl, (void **)&ucode->bcm43xx_24_lcn,
+				       D11UCODE_OVERSIGHT24_LCN);
+	rc = rc < 0 ?
+	     rc : brcms_ucode_init_uint(wl, &ucode->bcm43xx_24_lcnsz,
+					D11UCODE_OVERSIGHT24_LCNSZ);
+	rc = rc < 0 ?
+	     rc : brcms_ucode_init_buf(wl, (void **)&ucode->bcm43xx_bommajor,
+				       D11UCODE_OVERSIGHT_BOMMAJOR);
+	rc = rc < 0 ?
+	     rc : brcms_ucode_init_buf(wl, (void **)&ucode->bcm43xx_bomminor,
+				       D11UCODE_OVERSIGHT_BOMMINOR);
 	return rc;
 }
 
-void brcms_ucode_data_free(void)
+void brcms_ucode_data_free(struct brcms_ucode *ucode)
 {
-	brcms_ucode_free_buf((void *)d11lcn0bsinitvals24);
-	brcms_ucode_free_buf((void *)d11lcn0initvals24);
-	brcms_ucode_free_buf((void *)d11lcn1bsinitvals24);
-	brcms_ucode_free_buf((void *)d11lcn1initvals24);
-	brcms_ucode_free_buf((void *)d11lcn2bsinitvals24);
-	brcms_ucode_free_buf((void *)d11lcn2initvals24);
-	brcms_ucode_free_buf((void *)d11n0absinitvals16);
-	brcms_ucode_free_buf((void *)d11n0bsinitvals16);
-	brcms_ucode_free_buf((void *)d11n0initvals16);
-	brcms_ucode_free_buf((void *)bcm43xx_16_mimo);
-	brcms_ucode_free_buf((void *)bcm43xx_24_lcn);
-	brcms_ucode_free_buf((void *)bcm43xx_bommajor);
-	brcms_ucode_free_buf((void *)bcm43xx_bomminor);
-
-	return;
+	brcms_ucode_free_buf((void *)ucode->d11lcn0bsinitvals24);
+	brcms_ucode_free_buf((void *)ucode->d11lcn0initvals24);
+	brcms_ucode_free_buf((void *)ucode->d11lcn1bsinitvals24);
+	brcms_ucode_free_buf((void *)ucode->d11lcn1initvals24);
+	brcms_ucode_free_buf((void *)ucode->d11lcn2bsinitvals24);
+	brcms_ucode_free_buf((void *)ucode->d11lcn2initvals24);
+	brcms_ucode_free_buf((void *)ucode->d11n0absinitvals16);
+	brcms_ucode_free_buf((void *)ucode->d11n0bsinitvals16);
+	brcms_ucode_free_buf((void *)ucode->d11n0initvals16);
+	brcms_ucode_free_buf((void *)ucode->bcm43xx_16_mimo);
+	brcms_ucode_free_buf((void *)ucode->bcm43xx_24_lcn);
+	brcms_ucode_free_buf((void *)ucode->bcm43xx_bommajor);
+	brcms_ucode_free_buf((void *)ucode->bcm43xx_bomminor);
 }
diff --git a/drivers/staging/brcm80211/brcmsmac/ucode_loader.h b/drivers/staging/brcm80211/brcmsmac/ucode_loader.h
index ca53dec..438675a 100644
--- a/drivers/staging/brcm80211/brcmsmac/ucode_loader.h
+++ b/drivers/staging/brcm80211/brcmsmac/ucode_loader.h
@@ -13,6 +13,8 @@
  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+#ifndef	_BRCM_UCODE_H_
+#define	_BRCM_UCODE_H_
 
 #include "types.h"		/* forward structure declarations */
 
@@ -21,28 +23,30 @@
 
 #define UCODE_LOADER_API_VER 0
 
-struct d11init {
-	u16 addr;
-	u16 size;
-	u32 value;
+struct d11init;
+
+struct brcms_ucode {
+	struct d11init *d11lcn0bsinitvals24;
+	struct d11init *d11lcn0initvals24;
+	struct d11init *d11lcn1bsinitvals24;
+	struct d11init *d11lcn1initvals24;
+	struct d11init *d11lcn2bsinitvals24;
+	struct d11init *d11lcn2initvals24;
+	struct d11init *d11n0absinitvals16;
+	struct d11init *d11n0bsinitvals16;
+	struct d11init *d11n0initvals16;
+	u32 *bcm43xx_16_mimo;
+	u32 bcm43xx_16_mimosz;
+	u32 *bcm43xx_24_lcn;
+	u32 bcm43xx_24_lcnsz;
+	u32 *bcm43xx_bommajor;
+	u32 *bcm43xx_bomminor;
 };
 
-extern struct d11init *d11lcn0bsinitvals24;
-extern struct d11init *d11lcn0initvals24;
-extern struct d11init *d11lcn1bsinitvals24;
-extern struct d11init *d11lcn1initvals24;
-extern struct d11init *d11lcn2bsinitvals24;
-extern struct d11init *d11lcn2initvals24;
-extern struct d11init *d11n0absinitvals16;
-extern struct d11init *d11n0bsinitvals16;
-extern struct d11init *d11n0initvals16;
-extern u32 *bcm43xx_16_mimo;
-extern u32 bcm43xx_16_mimosz;
-extern u32 *bcm43xx_24_lcn;
-extern u32 bcm43xx_24_lcnsz;
-
-extern int brcms_ucode_data_init(struct brcms_info *wl);
-extern void brcms_ucode_data_free(void);
+extern int
+brcms_ucode_data_init(struct brcms_info *wl, struct brcms_ucode *ucode);
+
+extern void brcms_ucode_data_free(struct brcms_ucode *ucode);
 
 extern int brcms_ucode_init_buf(struct brcms_info *wl, void **pbuf,
 				unsigned int idx);
@@ -50,3 +54,5 @@ extern int brcms_ucode_init_uint(struct brcms_info *wl, unsigned *data,
 			      unsigned int idx);
 extern void brcms_ucode_free_buf(void *);
 extern int  brcms_check_firmwares(struct brcms_info *wl);
+
+#endif	/* _BRCM_UCODE_H_ */
-- 
1.7.1



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

* [PATCH 07/20] staging: brcm80211: removed unused softmac workaround
  2011-09-24  2:08 [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2 Franky Lin
                   ` (5 preceding siblings ...)
  2011-09-24  2:08 ` [PATCH 06/20] staging: brcm80211: removed global vars in softmac ucode handling Franky Lin
@ 2011-09-24  2:08 ` Franky Lin
  2011-09-24  2:08 ` [PATCH 08/20] staging: brcm80211: cleanup structure fields used for scanning Franky Lin
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 35+ messages in thread
From: Franky Lin @ 2011-09-24  2:08 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

From: Roland Vossen <rvossen@broadcom.com>

WAR16165 is only used on older PCI chips, the driver does not support
these chips.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/aiutils.c |    9 -------
 drivers/staging/brcm80211/brcmsmac/aiutils.h |    2 -
 drivers/staging/brcm80211/brcmsmac/d11.h     |    3 +-
 drivers/staging/brcm80211/brcmsmac/main.c    |   31 --------------------------
 drivers/staging/brcm80211/brcmsmac/main.h    |    5 ----
 5 files changed, 1 insertions(+), 49 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/aiutils.c b/drivers/staging/brcm80211/brcmsmac/aiutils.c
index d05c4ba..790fdce 100644
--- a/drivers/staging/brcm80211/brcmsmac/aiutils.c
+++ b/drivers/staging/brcm80211/brcmsmac/aiutils.c
@@ -1852,15 +1852,6 @@ int ai_devpath(struct si_pub *sih, char *path, int size)
 	return 0;
 }
 
-bool ai_pci_war16165(struct si_pub *sih)
-{
-	struct si_info *sii;
-
-	sii = (struct si_info *)sih;
-
-	return PCI(sii) && (sih->buscorerev <= 10);
-}
-
 void ai_pci_up(struct si_pub *sih)
 {
 	struct si_info *sii;
diff --git a/drivers/staging/brcm80211/brcmsmac/aiutils.h b/drivers/staging/brcm80211/brcmsmac/aiutils.h
index a776945..3917192 100644
--- a/drivers/staging/brcm80211/brcmsmac/aiutils.h
+++ b/drivers/staging/brcm80211/brcmsmac/aiutils.h
@@ -322,8 +322,6 @@ extern void ai_write_wrap_reg(struct si_pub *sih, u32 offset, u32 val);
 extern struct si_pub *ai_attach(void *regs, struct pci_dev *sdh, char **vars,
 				uint *varsz);
 extern void ai_detach(struct si_pub *sih);
-extern bool ai_pci_war16165(struct si_pub *sih);
-
 extern uint ai_coreid(struct si_pub *sih);
 extern uint ai_corerev(struct si_pub *sih);
 extern uint ai_corereg(struct si_pub *sih, uint coreidx, uint regoff, uint mask,
diff --git a/drivers/staging/brcm80211/brcmsmac/d11.h b/drivers/staging/brcm80211/brcmsmac/d11.h
index 14e60a5..cbb574a 100644
--- a/drivers/staging/brcm80211/brcmsmac/d11.h
+++ b/drivers/staging/brcm80211/brcmsmac/d11.h
@@ -1330,8 +1330,7 @@ struct shm_acparams {
 #define	MHF1_FORCEFASTCLK	0x0400
 
 /* Flags in M_HOST_FLAGS2 */
-/* PR16165WAR : Enable ucode PCI slow clock WAR */
-#define MHF2_PCISLOWCLKWAR	0x0008
+
 /* Flush BCMC FIFO immediately */
 #define MHF2_TXBCMC_NOW		0x0040
 /* Enable ucode/hw power control */
diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 4d5c842..3ec952c 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -829,19 +829,6 @@ brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound)
 	return n >= bound_limit;
 }
 
-static void brcms_c_war16165(struct brcms_c_info *wlc, bool tx)
-{
-	if (tx) {
-		/* the post-increment is used in STAY_AWAKE macro */
-		if (wlc->txpend16165war++ == 0)
-			brcms_c_set_ps_ctrl(wlc);
-	} else {
-		wlc->txpend16165war--;
-		if (wlc->txpend16165war == 0)
-			brcms_c_set_ps_ctrl(wlc);
-	}
-}
-
 /* process an individual struct tx_status */
 static bool
 brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs)
@@ -879,8 +866,6 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs)
 	}
 
 	p = dma_getnexttxp(wlc->hw->di[queue], DMA_RANGE_TRANSMITTED);
-	if (wlc->war16165)
-		brcms_c_war16165(wlc, false);
 	if (p == NULL)
 		goto fatal;
 
@@ -3109,8 +3094,6 @@ static void brcms_c_flushqueues(struct brcms_c_info *wlc)
 	struct brcms_hardware *wlc_hw = wlc->hw;
 	uint i;
 
-	wlc->txpend16165war = 0;
-
 	/* free any posted tx packets */
 	for (i = 0; i < NFIFO; i++)
 		if (wlc_hw->di[i]) {
@@ -3532,9 +3515,6 @@ static void brcms_b_coreinit(struct brcms_c_info *wlc)
 	AND_REG(&regs->ifs_ctl, 0x0FFF);
 	W_REG(&regs->ifs_aifsn, EDCF_AIFSN_MIN);
 
-	/* dma initializations */
-	wlc->txpend16165war = 0;
-
 	/* init the tx dma engines */
 	for (i = 0; i < NFIFO; i++) {
 		if (wlc_hw->di[i])
@@ -4832,9 +4812,6 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,
 	if (wlc_hw->boardflags & BFL_NOPLLDOWN)
 		brcms_b_pllreq(wlc_hw, true, BRCMS_PLLREQ_SHARED);
 
-	if (ai_pci_war16165(wlc_hw->sih))
-		wlc->war16165 = true;
-
 	/* check device id(srom, nvram etc.) to set bands */
 	if (wlc_hw->deviceid == BCM43224_D11N_ID ||
 	    wlc_hw->deviceid == BCM43224_D11N_ID_VEN1)
@@ -5833,10 +5810,6 @@ int brcms_c_up(struct brcms_c_info *wlc)
 	/* Set EDCF hostflags */
 	brcms_c_mhf(wlc, MHF1, MHF1_EDCF, MHF1_EDCF, BRCM_BAND_ALL);
 
-	if (wlc->war16165)
-		brcms_c_mhf(wlc, MHF2, MHF2_PCISLOWCLKWAR, MHF2_PCISLOWCLKWAR,
-			BRCM_BAND_ALL);
-
 	brcms_init(wlc->wl);
 	wlc->pub->up = true;
 
@@ -7816,10 +7789,6 @@ brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, struct sk_buff *p,
 	if (fifo == TX_BCMC_FIFO)
 		frameid = le16_to_cpu(txh->TxFrameID);
 
-	if (wlc->war16165)
-		brcms_c_war16165(wlc, true);
-
-
 	/*
 	 * Bump up pending count for if not using rpc. If rpc is
 	 * used, this will be handled in brcms_b_txfifo()
diff --git a/drivers/staging/brcm80211/brcmsmac/main.h b/drivers/staging/brcm80211/brcmsmac/main.h
index d6de9c3..717843a 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.h
+++ b/drivers/staging/brcm80211/brcmsmac/main.h
@@ -416,8 +416,6 @@ struct brcms_txq_info {
  * band: pointer to active per-band state.
  * corestate: per-core state (one per hw core).
  * bandstate: per-band state (one per phy/radio).
- * war16165: PCI slow clock 16165 war flag.
- * txpend16165war: PCI slow clock 16165 war flag.
  * qvalid: DirFrmQValid and BcMcFrmQValid.
  * ampdu: ampdu module handler.
  * asi: antsel module handler.
@@ -508,9 +506,6 @@ struct brcms_c_info {
 	struct brcms_core *corestate;
 	struct brcms_band *bandstate[MAXBANDS];
 
-	bool war16165;
-	uint txpend16165war;
-
 	/* packet queue */
 	uint qvalid;
 
-- 
1.7.1



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

* [PATCH 08/20] staging: brcm80211: cleanup structure fields used for scanning
  2011-09-24  2:08 [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2 Franky Lin
                   ` (6 preceding siblings ...)
  2011-09-24  2:08 ` [PATCH 07/20] staging: brcm80211: removed unused softmac workaround Franky Lin
@ 2011-09-24  2:08 ` Franky Lin
  2011-09-26 19:07   ` Franky Lin
  2011-09-24  2:08 ` [PATCH 09/20] staging: brcm80211: use endian annotated structures in brcmsmac Franky Lin
                   ` (11 subsequent siblings)
  19 siblings, 1 reply; 35+ messages in thread
From: Franky Lin @ 2011-09-24  2:08 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

From: Arend van Spriel <arend@broadcom.com>

In the structure brcmf_cfg80211_priv two fields were defined
in which one was allocated and a second was referenced back to
the first for no obvious reasons. Also the name was misleading
giving the impression that the driver was maintaining a list of
BSS entries like cfg80211 does.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c |   32 ++++++++++++---------
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h |    5 +--
 2 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index b956c90..471f2d7 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -1972,7 +1972,7 @@ static s32 brcmf_inform_bss(struct brcmf_cfg80211_priv *cfg_priv)
 	s32 err = 0;
 	int i;
 
-	bss_list = cfg_priv->bss_list;
+	bss_list = cfg_priv->scan_list;
 	if (bss_list->version != BRCMF_BSS_INFO_VERSION) {
 		WL_ERR("Version %d != WL_BSS_INFO_VERSION\n",
 		       bss_list->version);
@@ -2288,12 +2288,18 @@ static void brcmf_cfg80211_iscan_handler(struct work_struct *work)
 	}
 
 	rtnl_lock();
-	if (brcmf_get_iscan_results(iscan, &status, &cfg_priv->bss_list)) {
+	/* obtain scan results in scan_list to be used by iscan handler below */
+	if (brcmf_get_iscan_results(iscan, &status, &cfg_priv->scan_list)) {
 		status = BRCMF_SCAN_RESULTS_ABORTED;
 		WL_ERR("Abort iscan\n");
 	}
 	rtnl_unlock();
 
+	/*
+	 * call handler based upon status provided by dongle.
+	 * The scan_list retrieved from the dongle may be used
+	 * or discarded depending on the status.
+	 */
 	el->handler[status](cfg_priv);
 }
 
@@ -3028,22 +3034,20 @@ brcmf_notify_scan_status(struct brcmf_cfg80211_priv *cfg_priv,
 	scan_channel = le32_to_cpu(channel_inform_le.scan_channel);
 	if (scan_channel)
 		WL_CONN("channel_inform.scan_channel (%d)\n", scan_channel);
-	cfg_priv->bss_list = cfg_priv->scan_results;
-	bss_list_le = (struct brcmf_scan_results_le *) cfg_priv->bss_list;
+	bss_list_le = (struct brcmf_scan_results_le *) cfg_priv->scan_list;
 
-	memset(cfg_priv->scan_results, 0, len);
+	memset(bss_list_le, 0, len);
 	bss_list_le->buflen = cpu_to_le32(len);
-	err = brcmf_dev_ioctl(ndev, BRCMF_C_SCAN_RESULTS,
-			      cfg_priv->scan_results, len);
+	err = brcmf_dev_ioctl(ndev, BRCMF_C_SCAN_RESULTS, bss_list_le, len);
 	if (err) {
 		WL_ERR("%s Scan_results error (%d)\n", ndev->name, err);
 		err = -EINVAL;
 		scan_abort = true;
 		goto scan_done_out;
 	}
-	cfg_priv->scan_results->buflen = le32_to_cpu(bss_list_le->buflen);
-	cfg_priv->scan_results->version = le32_to_cpu(bss_list_le->version);
-	cfg_priv->scan_results->count = le32_to_cpu(bss_list_le->count);
+	cfg_priv->scan_list->buflen = le32_to_cpu(bss_list_le->buflen);
+	cfg_priv->scan_list->version = le32_to_cpu(bss_list_le->version);
+	cfg_priv->scan_list->count = le32_to_cpu(bss_list_le->count);
 
 	err = brcmf_inform_bss(cfg_priv);
 	if (err) {
@@ -3086,8 +3090,8 @@ static void brcmf_init_eloop_handler(struct brcmf_cfg80211_event_loop *el)
 
 static void brcmf_deinit_priv_mem(struct brcmf_cfg80211_priv *cfg_priv)
 {
-	kfree(cfg_priv->scan_results);
-	cfg_priv->scan_results = NULL;
+	kfree(cfg_priv->scan_list);
+	cfg_priv->scan_list = NULL;
 	kfree(cfg_priv->bss_info);
 	cfg_priv->bss_info = NULL;
 	kfree(cfg_priv->conf);
@@ -3108,8 +3112,8 @@ static void brcmf_deinit_priv_mem(struct brcmf_cfg80211_priv *cfg_priv)
 
 static s32 brcmf_init_priv_mem(struct brcmf_cfg80211_priv *cfg_priv)
 {
-	cfg_priv->scan_results = kzalloc(WL_SCAN_BUF_MAX, GFP_KERNEL);
-	if (!cfg_priv->scan_results)
+	cfg_priv->scan_list = kzalloc(WL_SCAN_BUF_MAX, GFP_KERNEL);
+	if (!cfg_priv->scan_list)
 		goto init_priv_mem_out;
 	cfg_priv->conf = kzalloc(sizeof(*cfg_priv->conf), GFP_KERNEL);
 	if (!cfg_priv->conf)
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
index afc60d9..f40a878 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
@@ -285,9 +285,8 @@ struct brcmf_cfg80211_priv {
 	struct list_head evt_q_list;	/* used for event queue */
 	spinlock_t	 evt_q_lock;	/* for event queue synchronization */
 	struct mutex usr_sync;	/* maily for dongle up/down synchronization */
-	struct brcmf_scan_results *bss_list;	/* bss_list holding scanned
-						 ap information */
-	struct brcmf_scan_results *scan_results;
+	struct brcmf_scan_results *scan_list; /* holding bss scan result from
+						dongle */
 	struct brcmf_cfg80211_scan_req *scan_req_int;	/* scan request object
 						 for internal purpose */
 	struct wl_cfg80211_bss_info *bss_info;	/* bss information for
-- 
1.7.1



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

* [PATCH 09/20] staging: brcm80211: use endian annotated structures in brcmsmac
  2011-09-24  2:08 [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2 Franky Lin
                   ` (7 preceding siblings ...)
  2011-09-24  2:08 ` [PATCH 08/20] staging: brcm80211: cleanup structure fields used for scanning Franky Lin
@ 2011-09-24  2:08 ` Franky Lin
  2011-09-24 10:38   ` Johannes Berg
  2011-09-26 21:06   ` Rafał Miłecki
  2011-09-24  2:08 ` [PATCH 10/20] staging: brcm80211: remove ht_cap field from brcms_c_info structure Franky Lin
                   ` (10 subsequent siblings)
  19 siblings, 2 replies; 35+ messages in thread
From: Franky Lin @ 2011-09-24  2:08 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

From: Arend van Spriel <arend@broadcom.com>

Structures interfacing with the device have a specific endianess and
structures exchanged between host and device have been annotated so
sparse checking can be done. The Makefile has been modified to add
the __CHECK_ENDIAN__ flag.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/Makefile       |    3 +-
 drivers/staging/brcm80211/brcmsmac/d11.h          |   80 ++++++++++++--------
 drivers/staging/brcm80211/brcmsmac/dma.c          |   41 ++++++-----
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c  |   15 ++--
 drivers/staging/brcm80211/brcmsmac/main.c         |   81 +++++++++++----------
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c  |    2 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_n.c    |    2 +-
 drivers/staging/brcm80211/brcmsmac/srom.c         |    4 +-
 drivers/staging/brcm80211/brcmsmac/ucode_loader.h |    8 +-
 9 files changed, 130 insertions(+), 106 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/Makefile b/drivers/staging/brcm80211/brcmsmac/Makefile
index 8fdca2e..e44859d 100644
--- a/drivers/staging/brcm80211/brcmsmac/Makefile
+++ b/drivers/staging/brcm80211/brcmsmac/Makefile
@@ -15,7 +15,8 @@
 # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-ccflags-y :=				\
+ccflags-y := \
+	-D__CHECK_ENDIAN__ \
 	-Idrivers/staging/brcm80211/brcmsmac \
 	-Idrivers/staging/brcm80211/brcmsmac/phy \
 	-Idrivers/staging/brcm80211/include
diff --git a/drivers/staging/brcm80211/brcmsmac/d11.h b/drivers/staging/brcm80211/brcmsmac/d11.h
index cbb574a..392e282 100644
--- a/drivers/staging/brcm80211/brcmsmac/d11.h
+++ b/drivers/staging/brcm80211/brcmsmac/d11.h
@@ -745,37 +745,37 @@ struct cck_phy_hdr {
 
 /* TX DMA buffer header */
 struct d11txh {
-	u16 MacTxControlLow;	/* 0x0 */
-	u16 MacTxControlHigh;	/* 0x1 */
-	u16 MacFrameControl;	/* 0x2 */
-	u16 TxFesTimeNormal;	/* 0x3 */
-	u16 PhyTxControlWord;	/* 0x4 */
-	u16 PhyTxControlWord_1;	/* 0x5 */
-	u16 PhyTxControlWord_1_Fbr;	/* 0x6 */
-	u16 PhyTxControlWord_1_Rts;	/* 0x7 */
-	u16 PhyTxControlWord_1_FbrRts;	/* 0x8 */
-	u16 MainRates;	/* 0x9 */
-	u16 XtraFrameTypes;	/* 0xa */
+	__le16 MacTxControlLow;	/* 0x0 */
+	__le16 MacTxControlHigh;	/* 0x1 */
+	__le16 MacFrameControl;	/* 0x2 */
+	__le16 TxFesTimeNormal;	/* 0x3 */
+	__le16 PhyTxControlWord;	/* 0x4 */
+	__le16 PhyTxControlWord_1;	/* 0x5 */
+	__le16 PhyTxControlWord_1_Fbr;	/* 0x6 */
+	__le16 PhyTxControlWord_1_Rts;	/* 0x7 */
+	__le16 PhyTxControlWord_1_FbrRts;	/* 0x8 */
+	__le16 MainRates;	/* 0x9 */
+	__le16 XtraFrameTypes;	/* 0xa */
 	u8 IV[16];		/* 0x0b - 0x12 */
 	u8 TxFrameRA[6];	/* 0x13 - 0x15 */
-	u16 TxFesTimeFallback;	/* 0x16 */
+	__le16 TxFesTimeFallback;	/* 0x16 */
 	u8 RTSPLCPFallback[6];	/* 0x17 - 0x19 */
-	u16 RTSDurFallback;	/* 0x1a */
+	__le16 RTSDurFallback;	/* 0x1a */
 	u8 FragPLCPFallback[6];	/* 0x1b - 1d */
-	u16 FragDurFallback;	/* 0x1e */
-	u16 MModeLen;	/* 0x1f */
-	u16 MModeFbrLen;	/* 0x20 */
-	u16 TstampLow;	/* 0x21 */
-	u16 TstampHigh;	/* 0x22 */
-	u16 ABI_MimoAntSel;	/* 0x23 */
-	u16 PreloadSize;	/* 0x24 */
-	u16 AmpduSeqCtl;	/* 0x25 */
-	u16 TxFrameID;	/* 0x26 */
-	u16 TxStatus;	/* 0x27 */
-	u16 MaxNMpdus;	/* 0x28 */
-	u16 MaxABytes_MRT;	/* 0x29 */
-	u16 MaxABytes_FBR;	/* 0x2a */
-	u16 MinMBytes;	/* 0x2b */
+	__le16 FragDurFallback;	/* 0x1e */
+	__le16 MModeLen;	/* 0x1f */
+	__le16 MModeFbrLen;	/* 0x20 */
+	__le16 TstampLow;	/* 0x21 */
+	__le16 TstampHigh;	/* 0x22 */
+	__le16 ABI_MimoAntSel;	/* 0x23 */
+	__le16 PreloadSize;	/* 0x24 */
+	__le16 AmpduSeqCtl;	/* 0x25 */
+	__le16 TxFrameID;	/* 0x26 */
+	__le16 TxStatus;	/* 0x27 */
+	__le16 MaxNMpdus;	/* 0x28 */
+	__le16 MaxABytes_MRT;	/* 0x29 */
+	__le16 MaxABytes_FBR;	/* 0x2a */
+	__le16 MinMBytes;	/* 0x2b */
 	u8 RTSPhyHeader[D11_PHY_HDR_LEN];	/* 0x2c - 0x2e */
 	struct ieee80211_rts rts_frame;	/* 0x2f - 0x36 */
 	u16 PAD;		/* 0x37 */
@@ -1379,6 +1379,21 @@ struct shm_acparams {
  * RxTSFTime: RxTSFTime time of first MAC symbol + M_PHY_PLCPRX_DLY
  * RxChan: gain code, channel radio code, and phy type
  */
+struct d11rxhdr_le {
+	__le16 RxFrameSize;
+	u16 PAD;
+	__le16 PhyRxStatus_0;
+	__le16 PhyRxStatus_1;
+	__le16 PhyRxStatus_2;
+	__le16 PhyRxStatus_3;
+	__le16 PhyRxStatus_4;
+	__le16 PhyRxStatus_5;
+	__le16 RxStatus1;
+	__le16 RxStatus2;
+	__le16 RxTSFTime;
+	__le16 RxChan;
+} __packed;
+
 struct d11rxhdr {
 	u16 RxFrameSize;
 	u16 PAD;
@@ -1392,20 +1407,21 @@ struct d11rxhdr {
 	u16 RxStatus2;
 	u16 RxTSFTime;
 	u16 RxChan;
-} __packed;
+};
 
 /*
  * rxhdr: received frame header data
- * tsf_l: TSF_L reading
- * rssi: computed instanteneous rssi in BMAC
+ * rssi: rssi computed by PHY
  * rxpwr0: obsoleted, place holder for legacy ROM code. use rxpwr[]
  * rxpwr1: obsoleted, place holder for legacy ROM code. use rxpwr[]
  * do_rssi_ma: do per-pkt sampling for per-antenna ma in HIGH
  * rxpwr: rssi for supported antennas
  */
 struct brcms_d11rxhdr {
-	struct d11rxhdr rxhdr;
-	u32 tsf_l;
+	union {
+		struct d11rxhdr_le rxh_le;
+		struct d11rxhdr rxh_cpu;
+	};
 	s8 rssi;
 	s8 rxpwr0;
 	s8 rxpwr1;
diff --git a/drivers/staging/brcm80211/brcmsmac/dma.c b/drivers/staging/brcm80211/brcmsmac/dma.c
index 714c74c..ef856ce 100644
--- a/drivers/staging/brcm80211/brcmsmac/dma.c
+++ b/drivers/staging/brcm80211/brcmsmac/dma.c
@@ -206,10 +206,10 @@
  * Descriptors are only read by the hardware, never written back.
  */
 struct dma64desc {
-	u32 ctrl1;	/* misc control bits & bufcount */
-	u32 ctrl2;	/* buffer count and address extension */
-	u32 addrlow;	/* memory address of the date buffer, bits 31:0 */
-	u32 addrhigh;	/* memory address of the date buffer, bits 63:32 */
+	__le32 ctrl1;	/* misc control bits & bufcount */
+	__le32 ctrl2;	/* buffer count and address extension */
+	__le32 addrlow;	/* memory address of the date buffer, bits 31:0 */
+	__le32 addrhigh; /* memory address of the date buffer, bits 63:32 */
 };
 
 /* dma engine software state */
@@ -295,15 +295,18 @@ struct dma_info {
 static uint dma_msg_level;
 
 /* Check for odd number of 1's */
-static u32 parity32(u32 data)
+static u32 parity32(__le32 data)
 {
-	data ^= data >> 16;
-	data ^= data >> 8;
-	data ^= data >> 4;
-	data ^= data >> 2;
-	data ^= data >> 1;
+	/* no swap needed for counting 1's */
+	u32 par_data = *(u32 *)&data;
 
-	return data & 1;
+	par_data ^= par_data >> 16;
+	par_data ^= par_data >> 8;
+	par_data ^= par_data >> 4;
+	par_data ^= par_data >> 2;
+	par_data ^= par_data >> 1;
+
+	return par_data & 1;
 }
 
 static bool dma64_dd_parity(struct dma64desc *dd)
@@ -873,13 +876,13 @@ static struct sk_buff *dma64_getnextrxp(struct dma_info *di, bool forceall)
 	rxp = di->rxp[i];
 	di->rxp[i] = NULL;
 
-	pa = cpu_to_le32(di->rxd64[i].addrlow) - di->dataoffsetlow;
+	pa = le32_to_cpu(di->rxd64[i].addrlow) - di->dataoffsetlow;
 
 	/* clear this packet from the descriptor ring */
 	pci_unmap_single(di->pbus, pa, di->rxbufsize, PCI_DMA_FROMDEVICE);
 
-	di->rxd64[i].addrlow = 0xdeadbeef;
-	di->rxd64[i].addrhigh = 0xdeadbeef;
+	di->rxd64[i].addrlow = cpu_to_le32(0xdeadbeef);
+	di->rxd64[i].addrhigh = cpu_to_le32(0xdeadbeef);
 
 	di->rxin = nextrxd(di, i);
 
@@ -917,7 +920,7 @@ struct sk_buff *dma_rx(struct dma_pub *pub)
 	if (head == NULL)
 		return NULL;
 
-	len = le16_to_cpu(*(u16 *) (head->data));
+	len = le16_to_cpu(*(__le16 *) (head->data));
 	DMA_TRACE(("%s: dma_rx len %d\n", di->name, len));
 	dma_spin_for_len(len, head);
 
@@ -1367,14 +1370,14 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range)
 		dma_addr_t pa;
 		uint size;
 
-		pa = cpu_to_le32(di->txd64[i].addrlow) - di->dataoffsetlow;
+		pa = le32_to_cpu(di->txd64[i].addrlow) - di->dataoffsetlow;
 
 		size =
-		    (cpu_to_le32(di->txd64[i].ctrl2) &
+		    (le32_to_cpu(di->txd64[i].ctrl2) &
 		     D64_CTRL2_BC_MASK);
 
-		di->txd64[i].addrlow = 0xdeadbeef;
-		di->txd64[i].addrhigh = 0xdeadbeef;
+		di->txd64[i].addrlow = cpu_to_le32(0xdeadbeef);
+		di->txd64[i].addrhigh = cpu_to_le32(0xdeadbeef);
 
 		txp = di->txp[i];
 		di->txp[i] = NULL;
diff --git a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
index 9bd4b83..50ca1bc 100644
--- a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
@@ -88,9 +88,9 @@
 }
 
 struct firmware_hdr {
-	u32 offset;
-	u32 len;
-	u32 idx;
+	__le32 offset;
+	__le32 len;
+	__le32 idx;
 };
 
 static const char * const brcms_firmwares[MAX_FW_IMAGES] = {
@@ -242,7 +242,7 @@ static struct ieee80211_supported_band brcms_band_2GHz_nphy = {
 		   .mcs = {
 			   /* placeholders for now */
 			   .rx_mask = {0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0},
-			   .rx_highest = 500,
+			   .rx_highest = cpu_to_le16(500),
 			   .tx_params = IEEE80211_HT_MCS_TX_DEFINED}
 		   }
 };
@@ -264,7 +264,7 @@ static struct ieee80211_supported_band brcms_band_5GHz_nphy = {
 		   .mcs = {
 			   /* placeholders for now */
 			   .rx_mask = {0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0},
-			   .rx_highest = 500,
+			   .rx_highest = cpu_to_le16(500),
 			   .tx_params = IEEE80211_HT_MCS_TX_DEFINED}
 		   }
 };
@@ -1055,7 +1055,8 @@ static int ieee_hw_rate_init(struct ieee80211_hw *hw)
 		if (phy_type == PHY_TYPE_LCN) {
 			/* Single stream */
 			brcms_band_2GHz_nphy.ht_cap.mcs.rx_mask[1] = 0;
-			brcms_band_2GHz_nphy.ht_cap.mcs.rx_highest = 72;
+			brcms_band_2GHz_nphy.ht_cap.mcs.rx_highest =
+					cpu_to_le16(72);
 		}
 		hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &brcms_band_2GHz_nphy;
 	} else {
@@ -1692,7 +1693,7 @@ int brcms_ucode_init_uint(struct brcms_info *wl, u32 *data, u32 idx)
 						  "ERROR: fw hdr len\n");
 					return -ENOMSG;
 				}
-				*data = le32_to_cpu(*((u32 *) pdata));
+				*data = le32_to_cpu(*((__le32 *) pdata));
 				return 0;
 			}
 		}
diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 3ec952c..7af7618 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -343,9 +343,9 @@ static u16 frametype(u32 rspec, u8 mimoframe)
 #define XMTFIFOTBL_STARTREV	20
 
 struct d11init {
-	u16 addr;
-	u16 size;
-	u32 value;
+	__le16 addr;
+	__le16 size;
+	__le32 value;
 };
 
 /* currently the best mechanism for determining SIFS is the band in use */
@@ -673,7 +673,7 @@ static void brcms_c_write_inits(struct brcms_hardware *wlc_hw,
 
 	base = (u8 *)wlc_hw->regs;
 
-	for (i = 0; inits[i].addr != 0xffff; i++) {
+	for (i = 0; inits[i].addr != cpu_to_le16(0xffff); i++) {
 		size = le16_to_cpu(inits[i].size);
 		addr = base + le16_to_cpu(inits[i].addr);
 		value = le32_to_cpu(inits[i].value);
@@ -881,7 +881,7 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs)
 		brcms_c_print_txstatus(txs);
 	}
 
-	if (txs->frameid != cpu_to_le16(txh->TxFrameID))
+	if (txs->frameid != le16_to_cpu(txh->TxFrameID))
 		goto fatal;
 	tx_info = IEEE80211_SKB_CB(p);
 	h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN);
@@ -900,7 +900,7 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs)
 		       "%s: Pkt tx suppressed, possibly channel %d\n",
 		       __func__, CHSPEC_CHANNEL(wlc->default_bss->chanspec));
 
-	tx_rts = cpu_to_le16(txh->MacTxControlLow) & TXC_SENDRTS;
+	tx_rts = le16_to_cpu(txh->MacTxControlLow) & TXC_SENDRTS;
 	tx_frame_count =
 	    (txs->status & TX_STATUS_FRM_RTX_MASK) >> TX_STATUS_FRM_RTX_SHIFT;
 	tx_rts_count =
@@ -1669,6 +1669,8 @@ brcms_b_write_template_ram(struct brcms_hardware *wlc_hw, int offset, int len,
 {
 	struct d11regs *regs;
 	u32 word;
+	__le32 word_le;
+	__be32 word_be;
 	bool be_bit;
 	BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit);
 
@@ -1684,10 +1686,13 @@ brcms_b_write_template_ram(struct brcms_hardware *wlc_hw, int offset, int len,
 	while (len > 0) {
 		memcpy(&word, buf, sizeof(u32));
 
-		if (be_bit)
-			word = cpu_to_be32(word);
-		else
-			word = cpu_to_le32(word);
+		if (be_bit) {
+			word_be = cpu_to_be32(word);
+			word = *(u32 *)&word_be;
+		} else {
+			word_le = cpu_to_le32(word);
+			word = *(u32 *)&word_le;
+		}
 
 		W_REG(&regs->tplatewrdata, word);
 
@@ -2430,8 +2435,9 @@ static void brcms_c_gpio_init(struct brcms_c_info *wlc)
 	ai_gpiocontrol(wlc_hw->sih, gm, gc, GPIO_DRV_PRIORITY);
 }
 
-static void brcms_ucode_write(struct brcms_hardware *wlc_hw, const u32 ucode[],
-			      const uint nbytes) {
+static void brcms_ucode_write(struct brcms_hardware *wlc_hw,
+			      const __le32 ucode[], const size_t nbytes)
+{
 	struct d11regs *regs = wlc_hw->regs;
 	uint i;
 	uint count;
@@ -4259,7 +4265,7 @@ void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci,
 	do {
 		memset((char *)&acp_shm, 0, sizeof(struct shm_acparams));
 		/* fill in shm ac params struct */
-		acp_shm.txop = le16_to_cpu(params->txop);
+		acp_shm.txop = params->txop;
 		/* convert from units of 32us to us for ucode */
 		wlc->edcf_txop[aci & 0x3] = acp_shm.txop =
 		    EDCF_TXOP2USEC(acp_shm.txop);
@@ -4312,16 +4318,11 @@ void brcms_c_edcf_setparams(struct brcms_c_info *wlc, bool suspend)
 	u16 aci;
 	int i_ac;
 	struct ieee80211_tx_queue_params txq_pars;
-	struct ieee80211_tx_queue_params *params = &txq_pars;
 	static struct edcf_acparam default_edcf_acparams[] = {
-		 {EDCF_AC_BE_ACI_STA, EDCF_AC_BE_ECW_STA,
-		  cpu_to_le16(EDCF_AC_BE_TXOP_STA)},
-		 {EDCF_AC_BK_ACI_STA, EDCF_AC_BK_ECW_STA,
-		  cpu_to_le16(EDCF_AC_BK_TXOP_STA)},
-		 {EDCF_AC_VI_ACI_STA, EDCF_AC_VI_ECW_STA,
-		  cpu_to_le16(EDCF_AC_VI_TXOP_STA)},
-		 {EDCF_AC_VO_ACI_STA, EDCF_AC_VO_ECW_STA,
-		  cpu_to_le16(EDCF_AC_VO_TXOP_STA)}
+		 {EDCF_AC_BE_ACI_STA, EDCF_AC_BE_ECW_STA, EDCF_AC_BE_TXOP_STA},
+		 {EDCF_AC_BK_ACI_STA, EDCF_AC_BK_ECW_STA, EDCF_AC_BK_TXOP_STA},
+		 {EDCF_AC_VI_ACI_STA, EDCF_AC_VI_ECW_STA, EDCF_AC_VI_TXOP_STA},
+		 {EDCF_AC_VO_ACI_STA, EDCF_AC_VO_ECW_STA, EDCF_AC_VO_TXOP_STA}
 	}; /* ucode needs these parameters during its initialization */
 	struct edcf_acparam *edcf_acp = &default_edcf_acparams[0];
 
@@ -4330,15 +4331,15 @@ void brcms_c_edcf_setparams(struct brcms_c_info *wlc, bool suspend)
 		aci = (edcf_acp->ACI & EDCF_ACI_MASK) >> EDCF_ACI_SHIFT;
 
 		/* fill in shm ac params struct */
-		params->txop = edcf_acp->TXOP;
-		params->aifs = edcf_acp->ACI;
+		txq_pars.txop = edcf_acp->TXOP;
+		txq_pars.aifs = edcf_acp->ACI;
 
 		/* CWmin = 2^(ECWmin) - 1 */
-		params->cw_min = EDCF_ECW2CW(edcf_acp->ECW & EDCF_ECWMIN_MASK);
+		txq_pars.cw_min = EDCF_ECW2CW(edcf_acp->ECW & EDCF_ECWMIN_MASK);
 		/* CWmax = 2^(ECWmax) - 1 */
-		params->cw_max = EDCF_ECW2CW((edcf_acp->ECW & EDCF_ECWMAX_MASK)
+		txq_pars.cw_max = EDCF_ECW2CW((edcf_acp->ECW & EDCF_ECWMAX_MASK)
 					    >> EDCF_ECWMAX_SHIFT);
-		brcms_c_wme_setparams(wlc, aci, params, suspend);
+		brcms_c_wme_setparams(wlc, aci, &txq_pars, suspend);
 	}
 
 	if (suspend)
@@ -8139,7 +8140,7 @@ static u64 brcms_c_recover_tsf64(struct brcms_c_info *wlc,
 	brcms_b_read_tsf(wlc->hw, &tsf_l, &tsf_h);
 
 	rx_tsf_16_31 = (u16)(tsf_l >> 16);
-	rx_tsf_0_15 = rxh->rxhdr.RxTSFTime;
+	rx_tsf_0_15 = rxh->rxh_cpu.RxTSFTime;
 
 	/*
 	 * a greater tsf time indicates the low 16 bits of
@@ -8301,6 +8302,7 @@ brcms_c_recvctl(struct brcms_c_info *wlc, struct d11rxhdr *rxh,
  */
 void brcms_c_recv(struct brcms_c_info *wlc, struct sk_buff *p)
 {
+	struct d11rxhdr_le *rxh_le;
 	struct d11rxhdr *rxh;
 	struct ieee80211_hdr *h;
 	uint len;
@@ -8309,23 +8311,24 @@ void brcms_c_recv(struct brcms_c_info *wlc, struct sk_buff *p)
 	BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit);
 
 	/* frame starts with rxhdr */
+	rxh_le = (struct d11rxhdr_le *) (p->data);
 	rxh = (struct d11rxhdr *) (p->data);
 
 	/* strip off rxhdr */
 	skb_pull(p, BRCMS_HWRXOFF);
 
 	/* fixup rx header endianness */
-	rxh->RxFrameSize = le16_to_cpu(rxh->RxFrameSize);
-	rxh->PhyRxStatus_0 = le16_to_cpu(rxh->PhyRxStatus_0);
-	rxh->PhyRxStatus_1 = le16_to_cpu(rxh->PhyRxStatus_1);
-	rxh->PhyRxStatus_2 = le16_to_cpu(rxh->PhyRxStatus_2);
-	rxh->PhyRxStatus_3 = le16_to_cpu(rxh->PhyRxStatus_3);
-	rxh->PhyRxStatus_4 = le16_to_cpu(rxh->PhyRxStatus_4);
-	rxh->PhyRxStatus_5 = le16_to_cpu(rxh->PhyRxStatus_5);
-	rxh->RxStatus1 = le16_to_cpu(rxh->RxStatus1);
-	rxh->RxStatus2 = le16_to_cpu(rxh->RxStatus2);
-	rxh->RxTSFTime = le16_to_cpu(rxh->RxTSFTime);
-	rxh->RxChan = le16_to_cpu(rxh->RxChan);
+	rxh->RxFrameSize = le16_to_cpu(rxh_le->RxFrameSize);
+	rxh->PhyRxStatus_0 = le16_to_cpu(rxh_le->PhyRxStatus_0);
+	rxh->PhyRxStatus_1 = le16_to_cpu(rxh_le->PhyRxStatus_1);
+	rxh->PhyRxStatus_2 = le16_to_cpu(rxh_le->PhyRxStatus_2);
+	rxh->PhyRxStatus_3 = le16_to_cpu(rxh_le->PhyRxStatus_3);
+	rxh->PhyRxStatus_4 = le16_to_cpu(rxh_le->PhyRxStatus_4);
+	rxh->PhyRxStatus_5 = le16_to_cpu(rxh_le->PhyRxStatus_5);
+	rxh->RxStatus1 = le16_to_cpu(rxh_le->RxStatus1);
+	rxh->RxStatus2 = le16_to_cpu(rxh_le->RxStatus2);
+	rxh->RxTSFTime = le16_to_cpu(rxh_le->RxTSFTime);
+	rxh->RxChan = le16_to_cpu(rxh_le->RxChan);
 
 	/* MAC inserts 2 pad bytes for a4 headers or QoS or A-MSDU subframes */
 	if (rxh->RxStatus1 & RXS_PBPRES) {
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
index a26c682..3f6e4bc 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
@@ -2613,7 +2613,7 @@ void wlc_phy_compute_dB(u32 *cmplx_pwr, s8 *p_cmplx_pwr_dB, u8 core)
 void wlc_phy_rssi_compute(struct brcms_phy_pub *pih,
 			  struct brcms_d11rxhdr *wlc_rxhdr)
 {
-	struct d11rxhdr *rxh = &wlc_rxhdr->rxhdr;
+	struct d11rxhdr_le *rxh = &wlc_rxhdr->rxh_le;
 	int rssi = le16_to_cpu(rxh->PhyRxStatus_1) & PRXS1_JSSI_MASK;
 	uint radioid = pih->radioid;
 	struct brcms_phy *pi = (struct brcms_phy *) pih;
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c
index 58645d2..224ce06 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c
@@ -23111,7 +23111,7 @@ void wlc_phy_rssi_cal_nphy(struct brcms_phy *pi)
 int
 wlc_phy_rssi_compute_nphy(struct brcms_phy *pi, struct brcms_d11rxhdr *wlc_rxh)
 {
-	struct d11rxhdr *rxh = &wlc_rxh->rxhdr;
+	struct d11rxhdr_le *rxh = &wlc_rxh->rxh_le;
 	s16 rxpwr, rxpwr0, rxpwr1;
 	s16 phyRx0_l, phyRx2_l;
 
diff --git a/drivers/staging/brcm80211/brcmsmac/srom.c b/drivers/staging/brcm80211/brcmsmac/srom.c
index 5bf0732..b37faf4 100644
--- a/drivers/staging/brcm80211/brcmsmac/srom.c
+++ b/drivers/staging/brcm80211/brcmsmac/srom.c
@@ -820,14 +820,14 @@ static inline void ltoh16_buf(u16 *buf, unsigned int size)
 {
 	size /= 2;
 	while (size--)
-		*(buf + size) = le16_to_cpu(*(buf + size));
+		*(buf + size) = le16_to_cpu(*(__le16 *)(buf + size));
 }
 
 static inline void htol16_buf(u16 *buf, unsigned int size)
 {
 	size /= 2;
 	while (size--)
-		*(buf + size) = cpu_to_le16(*(buf + size));
+		*(__le16 *)(buf + size) = cpu_to_le16(*(buf + size));
 }
 
 /* Initialization of varbuf structure */
diff --git a/drivers/staging/brcm80211/brcmsmac/ucode_loader.h b/drivers/staging/brcm80211/brcmsmac/ucode_loader.h
index 438675a..49d5b7e 100644
--- a/drivers/staging/brcm80211/brcmsmac/ucode_loader.h
+++ b/drivers/staging/brcm80211/brcmsmac/ucode_loader.h
@@ -35,10 +35,10 @@ struct brcms_ucode {
 	struct d11init *d11n0absinitvals16;
 	struct d11init *d11n0bsinitvals16;
 	struct d11init *d11n0initvals16;
-	u32 *bcm43xx_16_mimo;
-	u32 bcm43xx_16_mimosz;
-	u32 *bcm43xx_24_lcn;
-	u32 bcm43xx_24_lcnsz;
+	__le32 *bcm43xx_16_mimo;
+	size_t bcm43xx_16_mimosz;
+	__le32 *bcm43xx_24_lcn;
+	size_t bcm43xx_24_lcnsz;
 	u32 *bcm43xx_bommajor;
 	u32 *bcm43xx_bomminor;
 };
-- 
1.7.1



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

* [PATCH 10/20] staging: brcm80211: remove ht_cap field from brcms_c_info structure
  2011-09-24  2:08 [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2 Franky Lin
                   ` (8 preceding siblings ...)
  2011-09-24  2:08 ` [PATCH 09/20] staging: brcm80211: use endian annotated structures in brcmsmac Franky Lin
@ 2011-09-24  2:08 ` Franky Lin
  2011-09-24  2:08 ` [PATCH 11/20] staging: brcm80211: use fragment number provided in transmit frame Franky Lin
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 35+ messages in thread
From: Franky Lin @ 2011-09-24  2:08 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

From: Arend van Spriel <arend@broadcom.com>

The field ht_cap was typed ieee80211_ht_cap from ieee80211.h. This
contained little endian annotated field cap_info resulting in sparse
endian warnings. It turned out the driver was setting the field, but
it was actually never used. Therefore it has been removed.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/main.c |   23 -----------------------
 drivers/staging/brcm80211/brcmsmac/main.h |    2 --
 drivers/staging/brcm80211/brcmsmac/stf.c  |    9 ---------
 3 files changed, 0 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 7af7618..35fc8b0 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -325,11 +325,6 @@ static u16 frametype(u32 rspec, u8 mimoframe)
  */
 #define SSID_FMT_BUF_LEN	((4 * IEEE80211_MAX_SSID_LEN) + 1)
 
-/* defaults for the HT (MIMO) bss */
-#define HT_CAP	(IEEE80211_HT_CAP_SM_PS |\
-	IEEE80211_HT_CAP_SUP_WIDTH_20_40 | IEEE80211_HT_CAP_GRN_FLD |\
-	IEEE80211_HT_CAP_MAX_AMSDU | IEEE80211_HT_CAP_DSSSCCK40)
-
 /*
  * The following table lists the buffer memory allocated to xmt fifos in HW.
  * the size is in units of 256bytes(one block), total size is HW dependent
@@ -4219,13 +4214,6 @@ void brcms_c_protection_upd(struct brcms_c_info *wlc, uint idx, int val)
 
 static void brcms_c_ht_update_sgi_rx(struct brcms_c_info *wlc, int val)
 {
-	wlc->ht_cap.cap_info &= ~(IEEE80211_HT_CAP_SGI_20 |
-					IEEE80211_HT_CAP_SGI_40);
-	wlc->ht_cap.cap_info |= (val & BRCMS_N_SGI_20) ?
-					IEEE80211_HT_CAP_SGI_20 : 0;
-	wlc->ht_cap.cap_info |= (val & BRCMS_N_SGI_40) ?
-					IEEE80211_HT_CAP_SGI_40 : 0;
-
 	if (wlc->pub->up) {
 		brcms_c_update_beacon(wlc);
 		brcms_c_update_probe_resp(wlc, true);
@@ -4236,10 +4224,6 @@ static void brcms_c_ht_update_ldpc(struct brcms_c_info *wlc, s8 val)
 {
 	wlc->stf->ldpc = val;
 
-	wlc->ht_cap.cap_info &= ~IEEE80211_HT_CAP_LDPC_CODING;
-	if (wlc->stf->ldpc != OFF)
-		wlc->ht_cap.cap_info |= IEEE80211_HT_CAP_LDPC_CODING;
-
 	if (wlc->pub->up) {
 		brcms_c_update_beacon(wlc);
 		brcms_c_update_probe_resp(wlc, true);
@@ -5377,8 +5361,6 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
 	wlc->bsscfg->wlc = wlc;
 
 	wlc->mimoft = FT_HT;
-	wlc->ht_cap.cap_info = HT_CAP;
-
 	wlc->mimo_40txbw = AUTO;
 	wlc->ofdm_40txbw = AUTO;
 	wlc->cck_40txbw = AUTO;
@@ -5404,15 +5386,10 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
 	if (n_disabled & WLFEATURE_DISABLE_11N_STBC_TX) {
 		wlc->bandstate[BAND_2G_INDEX]->band_stf_stbc_tx = OFF;
 		wlc->bandstate[BAND_5G_INDEX]->band_stf_stbc_tx = OFF;
-		wlc->ht_cap.cap_info &= ~IEEE80211_HT_CAP_TX_STBC;
 	}
 	if (n_disabled & WLFEATURE_DISABLE_11N_STBC_RX)
 		brcms_c_stf_stbc_rx_set(wlc, HT_CAP_RX_STBC_NO);
 
-	/* apply the GF override from nvram conf */
-	if (n_disabled & WLFEATURE_DISABLE_11N_GF)
-		wlc->ht_cap.cap_info &= ~IEEE80211_HT_CAP_GRN_FLD;
-
 	/* initialize radio_mpc_disable according to wlc->mpc */
 	brcms_c_radio_mpc_upd(wlc);
 	brcms_b_antsel_set(wlc->hw, wlc->asi->antsel_avail);
diff --git a/drivers/staging/brcm80211/brcmsmac/main.h b/drivers/staging/brcm80211/brcmsmac/main.h
index 717843a..8760d7e 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.h
+++ b/drivers/staging/brcm80211/brcmsmac/main.h
@@ -456,7 +456,6 @@ struct brcms_txq_info {
  * cck_40txbw: 11N, cck tx b/w override when in 40MHZ mode.
  * ofdm_40txbw: 11N, ofdm tx b/w override when in 40MHZ mode.
  * mimo_40txbw: 11N, mimo tx b/w override when in 40MHZ mode.
- * ht_cap: HT CAP IE being advertised by this node.
  * default_bss: configured BSS parameters.
  * mc_fid_counter: BC/MC FIFO frame ID counter.
  * country_default: saved country for leaving 802.11d auto-country mode.
@@ -570,7 +569,6 @@ struct brcms_c_info {
 	s8 cck_40txbw;
 	s8 ofdm_40txbw;
 	s8 mimo_40txbw;
-	struct ieee80211_ht_cap ht_cap;
 
 	struct brcms_bss_info *default_bss;
 
diff --git a/drivers/staging/brcm80211/brcmsmac/stf.c b/drivers/staging/brcm80211/brcmsmac/stf.c
index 91b53a5..c77bab2 100644
--- a/drivers/staging/brcm80211/brcmsmac/stf.c
+++ b/drivers/staging/brcm80211/brcmsmac/stf.c
@@ -53,9 +53,6 @@ static void brcms_c_stf_stbc_rx_ht_update(struct brcms_c_info *wlc, int val)
 			return;
 	}
 
-	wlc->ht_cap.cap_info &= ~IEEE80211_HT_CAP_RX_STBC;
-	wlc->ht_cap.cap_info |= (val << IEEE80211_HT_CAP_RX_STBC_SHIFT);
-
 	if (wlc->pub->up) {
 		brcms_c_update_beacon(wlc);
 		brcms_c_update_probe_resp(wlc, true);
@@ -140,12 +137,6 @@ static bool brcms_c_stf_stbc_tx_set(struct brcms_c_info *wlc, s32 int_val)
 	if ((int_val == ON) && (wlc->stf->txstreams == 1))
 		return false;
 
-	if ((int_val == OFF) || (wlc->stf->txstreams == 1)
-	    || !BRCMS_STBC_CAP_PHY(wlc))
-		wlc->ht_cap.cap_info &= ~IEEE80211_HT_CAP_TX_STBC;
-	else
-		wlc->ht_cap.cap_info |= IEEE80211_HT_CAP_TX_STBC;
-
 	wlc->bandstate[BAND_2G_INDEX]->band_stf_stbc_tx = (s8) int_val;
 	wlc->bandstate[BAND_5G_INDEX]->band_stf_stbc_tx = (s8) int_val;
 
-- 
1.7.1



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

* [PATCH 11/20] staging: brcm80211: use fragment number provided in transmit frame
  2011-09-24  2:08 [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2 Franky Lin
                   ` (9 preceding siblings ...)
  2011-09-24  2:08 ` [PATCH 10/20] staging: brcm80211: remove ht_cap field from brcms_c_info structure Franky Lin
@ 2011-09-24  2:08 ` Franky Lin
  2011-09-24  2:09 ` [PATCH 12/20] staging: brcm80211: remove unused function si_pmu_ilp_clock() Franky Lin
                   ` (8 subsequent siblings)
  19 siblings, 0 replies; 35+ messages in thread
From: Franky Lin @ 2011-09-24  2:08 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

From: Arend van Spriel <arend@broadcom.com>

In the transmit path the field seq_ctrl is filled in, but the fragment
number was not properly determined.

Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 35fc8b0..c023b8b 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -7101,7 +7101,7 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
 				scb->seqnum[p->priority]++;
 
 			/* extract fragment number from frame first */
-			seq = le16_to_cpu(seq) & FRAGNUM_MASK;
+			seq = le16_to_cpu(h->seq_ctrl) & FRAGNUM_MASK;
 			seq |= (scb->seqnum[p->priority] << SEQNUM_SHIFT);
 			h->seq_ctrl = cpu_to_le16(seq);
 
-- 
1.7.1



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

* [PATCH 12/20] staging: brcm80211: remove unused function si_pmu_ilp_clock()
  2011-09-24  2:08 [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2 Franky Lin
                   ` (10 preceding siblings ...)
  2011-09-24  2:08 ` [PATCH 11/20] staging: brcm80211: use fragment number provided in transmit frame Franky Lin
@ 2011-09-24  2:09 ` Franky Lin
  2011-09-24  2:09 ` [PATCH 13/20] staging: brcm80211: make device initializer table for wme constant Franky Lin
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 35+ messages in thread
From: Franky Lin @ 2011-09-24  2:09 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

From: Arend van Spriel <arend@broadcom.com>

The function is not used in the driver and has been removed.

Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/pmu.c |   22 ----------------------
 drivers/staging/brcm80211/brcmsmac/pmu.h |    1 -
 2 files changed, 0 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/pmu.c b/drivers/staging/brcm80211/brcmsmac/pmu.c
index 61ba373..6d4cd9f 100644
--- a/drivers/staging/brcm80211/brcmsmac/pmu.c
+++ b/drivers/staging/brcm80211/brcmsmac/pmu.c
@@ -202,28 +202,6 @@ si_pmu_spuravoid_pllupdate(struct si_pub *sih, struct chipcregs *cc,
 	W_REG(&cc->pmucontrol, tmp);
 }
 
-u32 si_pmu_ilp_clock(struct si_pub *sih)
-{
-	static u32 ilpcycles_per_sec;
-
-	if (!(sih->cccaps & CC_CAP_PMU))
-		return ILP_CLOCK;
-
-	if (ilpcycles_per_sec == 0) {
-		u32 start, end, delta;
-		u32 origidx = ai_coreidx(sih);
-		struct chipcregs *cc = ai_setcoreidx(sih, SI_CC_IDX);
-		start = R_REG(&cc->pmutimer);
-		mdelay(ILP_CALC_DUR);
-		end = R_REG(&cc->pmutimer);
-		delta = end - start;
-		ilpcycles_per_sec = delta * (1000 / ILP_CALC_DUR);
-		ai_setcoreidx(sih, origidx);
-	}
-
-	return ilpcycles_per_sec;
-}
-
 u16 si_pmu_fast_pwrup_delay(struct si_pub *sih)
 {
 	uint delay = PMU_MAX_TRANSITION_DLY;
diff --git a/drivers/staging/brcm80211/brcmsmac/pmu.h b/drivers/staging/brcm80211/brcmsmac/pmu.h
index 2917e6f..3a08c62 100644
--- a/drivers/staging/brcm80211/brcmsmac/pmu.h
+++ b/drivers/staging/brcm80211/brcmsmac/pmu.h
@@ -24,7 +24,6 @@ extern u16 si_pmu_fast_pwrup_delay(struct si_pub *sih);
 extern void si_pmu_sprom_enable(struct si_pub *sih, bool enable);
 extern u32 si_pmu_chipcontrol(struct si_pub *sih, uint reg, u32 mask, u32 val);
 extern u32 si_pmu_regcontrol(struct si_pub *sih, uint reg, u32 mask, u32 val);
-extern u32 si_pmu_ilp_clock(struct si_pub *sih);
 extern u32 si_pmu_alp_clock(struct si_pub *sih);
 extern void si_pmu_pllupd(struct si_pub *sih);
 extern void si_pmu_spuravoid(struct si_pub *sih, u8 spuravoid);
-- 
1.7.1



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

* [PATCH 13/20] staging: brcm80211: make device initializer table for wme constant
  2011-09-24  2:08 [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2 Franky Lin
                   ` (11 preceding siblings ...)
  2011-09-24  2:09 ` [PATCH 12/20] staging: brcm80211: remove unused function si_pmu_ilp_clock() Franky Lin
@ 2011-09-24  2:09 ` Franky Lin
  2011-09-24  2:09 ` [PATCH 14/20] staging: brcm80211: remove dongle firmware related debug code Franky Lin
                   ` (6 subsequent siblings)
  19 siblings, 0 replies; 35+ messages in thread
From: Franky Lin @ 2011-09-24  2:09 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

From: Arend van Spriel <arend@broadcom.com>

For chip initialisation of the wme parameters a table is used, but
it was not marked as constant.

Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/main.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index c023b8b..407e99e 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -4302,13 +4302,13 @@ void brcms_c_edcf_setparams(struct brcms_c_info *wlc, bool suspend)
 	u16 aci;
 	int i_ac;
 	struct ieee80211_tx_queue_params txq_pars;
-	static struct edcf_acparam default_edcf_acparams[] = {
+	static const struct edcf_acparam default_edcf_acparams[] = {
 		 {EDCF_AC_BE_ACI_STA, EDCF_AC_BE_ECW_STA, EDCF_AC_BE_TXOP_STA},
 		 {EDCF_AC_BK_ACI_STA, EDCF_AC_BK_ECW_STA, EDCF_AC_BK_TXOP_STA},
 		 {EDCF_AC_VI_ACI_STA, EDCF_AC_VI_ECW_STA, EDCF_AC_VI_TXOP_STA},
 		 {EDCF_AC_VO_ACI_STA, EDCF_AC_VO_ECW_STA, EDCF_AC_VO_TXOP_STA}
 	}; /* ucode needs these parameters during its initialization */
-	struct edcf_acparam *edcf_acp = &default_edcf_acparams[0];
+	const struct edcf_acparam *edcf_acp = &default_edcf_acparams[0];
 
 	for (i_ac = 0; i_ac < AC_COUNT; i_ac++, edcf_acp++) {
 		/* find out which ac this set of params applies to */
-- 
1.7.1



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

* [PATCH 14/20] staging: brcm80211: remove dongle firmware related debug code
  2011-09-24  2:08 [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2 Franky Lin
                   ` (12 preceding siblings ...)
  2011-09-24  2:09 ` [PATCH 13/20] staging: brcm80211: make device initializer table for wme constant Franky Lin
@ 2011-09-24  2:09 ` Franky Lin
  2011-09-24 10:39   ` Johannes Berg
  2011-09-24  2:09 ` [PATCH 15/20] staging: brcm80211: remove unnecessary mac80211 callbacks Franky Lin
                   ` (5 subsequent siblings)
  19 siblings, 1 reply; 35+ messages in thread
From: Franky Lin @ 2011-09-24  2:09 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

From: Arend van Spriel <arend@broadcom.com>

When the device dies the driver could extract cpu registers on
the device to analyze the trap handling on the dongle. As the
firmware with this driver is stable this code does not belong
in the brcmfmac driver.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c |  259 +------------------------
 1 files changed, 1 insertions(+), 258 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 9f8bcb3..4992d4d 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -37,29 +37,7 @@
 
 #ifdef BCMDBG
 
-/* ARM trap handling */
-struct brcmf_trap {
-	u32 type;
-	u32 epc;
-	u32 cpsr;
-	u32 spsr;
-	u32 r0;
-	u32 r1;
-	u32 r2;
-	u32 r3;
-	u32 r4;
-	u32 r5;
-	u32 r6;
-	u32 r7;
-	u32 r8;
-	u32 r9;
-	u32 r10;
-	u32 r11;
-	u32 r12;
-	u32 r13;
-	u32 r14;
-	u32 pc;
-};
+#define BRCMF_TRAP_INFO_SIZE	80
 
 #define CBUF_LEN	(128)
 
@@ -2890,231 +2868,6 @@ xfer_done:
 }
 
 #ifdef BCMDBG
-static int
-brcmf_sdbrcm_readshared(struct brcmf_bus *bus, struct sdpcm_shared *sh)
-{
-	u32 addr;
-	__le32 addr_le;
-	int rv;
-	struct sdpcm_shared_le sh_le;
-
-	/* Read last word in memory to determine address of
-			 sdpcm_shared structure */
-	rv = brcmf_sdbrcm_membytes(bus, false, bus->ramsize - 4, (u8 *)&addr_le,
-				   4);
-	if (rv < 0)
-		return rv;
-
-	addr = le32_to_cpu(addr_le);
-
-	brcmf_dbg(INFO, "sdpcm_shared address 0x%08X\n", addr);
-
-	/*
-	 * Check if addr is valid.
-	 * NVRAM length at the end of memory should have been overwritten.
-	 */
-	if (addr == 0 || ((~addr >> 16) & 0xffff) == (addr & 0xffff)) {
-		brcmf_dbg(ERROR, "address (0x%08x) of sdpcm_shared invalid\n",
-			  addr);
-		return -EBADE;
-	}
-
-	/* Read rte_shared structure */
-	rv = brcmf_sdbrcm_membytes(bus, false, addr, (u8 *) &sh_le,
-			      sizeof(struct sdpcm_shared_le));
-	if (rv < 0)
-		return rv;
-
-	/* Endianness */
-	sh->flags = le32_to_cpu(sh_le.flags);
-	sh->trap_addr = le32_to_cpu(sh_le.trap_addr);
-	sh->assert_exp_addr = le32_to_cpu(sh_le.assert_exp_addr);
-	sh->assert_file_addr = le32_to_cpu(sh_le.assert_file_addr);
-	sh->assert_line = le32_to_cpu(sh_le.assert_line);
-	sh->console_addr = le32_to_cpu(sh_le.console_addr);
-	sh->msgtrace_addr = le32_to_cpu(sh_le.msgtrace_addr);
-	memcpy(sh->tag, sh_le.tag, sizeof(sh->tag));
-
-	if ((sh->flags & SDPCM_SHARED_VERSION_MASK) != SDPCM_SHARED_VERSION) {
-		brcmf_dbg(ERROR, "sdpcm_shared version %d in brcmf is different than sdpcm_shared version %d in dongle\n",
-			  SDPCM_SHARED_VERSION,
-			  sh->flags & SDPCM_SHARED_VERSION_MASK);
-		return -EBADE;
-	}
-
-	return 0;
-}
-
-static int brcmf_sdbrcm_mem_dump(struct brcmf_bus *bus)
-{
-	int ret = 0;
-	int size;		/* Full mem size */
-	int start = 0;		/* Start address */
-	int read_size = 0;	/* Read size of each iteration */
-	u8 *buf = NULL, *databuf = NULL;
-
-	/* Get full mem size */
-	size = bus->ramsize;
-	buf = kmalloc(size, GFP_ATOMIC);
-	if (!buf)
-		return -1;
-
-	/* Read mem content */
-	printk(KERN_DEBUG "Dump dongle memory");
-	databuf = buf;
-	while (size) {
-		read_size = min(MEMBLOCK, size);
-		ret = brcmf_sdbrcm_membytes(bus, false, start, databuf,
-					  read_size);
-		if (ret) {
-			brcmf_dbg(ERROR, "Error membytes %d\n", ret);
-			kfree(buf);
-			return -1;
-		}
-		printk(".");
-
-		/* Decrement size and increment start address */
-		size -= read_size;
-		start += read_size;
-		databuf += read_size;
-	}
-	printk(KERN_DEBUG "Done\n");
-
-	/* free buf before return !!! */
-	if (brcmf_write_to_file(bus->drvr, buf, bus->ramsize)) {
-		brcmf_dbg(ERROR, "Error writing to files\n");
-		return -1;
-	}
-
-	/* buf free handled in brcmf_write_to_file, not here */
-	return 0;
-}
-
-static int brcmf_sdbrcm_checkdied(struct brcmf_bus *bus, u8 *data, uint size)
-{
-	int bcmerror = 0;
-	uint msize = 512;
-	char *mbuffer = NULL;
-	uint maxstrlen = 256;
-	char *str = NULL;
-	struct brcmf_trap tr;
-	struct sdpcm_shared sdpcm_shared;
-	struct brcmu_strbuf strbuf;
-
-	brcmf_dbg(TRACE, "Enter\n");
-
-	if (data == NULL) {
-		/*
-		 * Called after a rx ctrl timeout. "data" is NULL.
-		 * allocate memory to trace the trap or assert.
-		 */
-		size = msize;
-		mbuffer = data = kmalloc(msize, GFP_ATOMIC);
-		if (mbuffer == NULL) {
-			bcmerror = -ENOMEM;
-			goto done;
-		}
-	}
-
-	str = kmalloc(maxstrlen, GFP_ATOMIC);
-	if (str == NULL) {
-		bcmerror = -ENOMEM;
-		goto done;
-	}
-
-	bcmerror = brcmf_sdbrcm_readshared(bus, &sdpcm_shared);
-	if (bcmerror < 0)
-		goto done;
-
-	brcmu_binit(&strbuf, data, size);
-
-	brcmu_bprintf(&strbuf,
-		    "msgtrace address : 0x%08X\nconsole address  : 0x%08X\n",
-		    sdpcm_shared.msgtrace_addr, sdpcm_shared.console_addr);
-
-	if ((sdpcm_shared.flags & SDPCM_SHARED_ASSERT_BUILT) == 0)
-		/* NOTE: Misspelled assert is intentional - DO NOT FIX.
-		 * (Avoids conflict with real asserts for programmatic
-		 * parsing of output.)
-		 */
-		brcmu_bprintf(&strbuf, "Assrt not built in dongle\n");
-
-	if ((sdpcm_shared.flags & (SDPCM_SHARED_ASSERT | SDPCM_SHARED_TRAP)) ==
-	    0) {
-		/* NOTE: Misspelled assert is intentional - DO NOT FIX.
-		 * (Avoids conflict with real asserts for programmatic
-		 * parsing of output.)
-		 */
-		brcmu_bprintf(&strbuf, "No trap%s in dongle",
-			    (sdpcm_shared.flags & SDPCM_SHARED_ASSERT_BUILT)
-			    ? "/assrt" : "");
-	} else {
-		if (sdpcm_shared.flags & SDPCM_SHARED_ASSERT) {
-			/* Download assert */
-			brcmu_bprintf(&strbuf, "Dongle assert");
-			if (sdpcm_shared.assert_exp_addr != 0) {
-				str[0] = '\0';
-				bcmerror = brcmf_sdbrcm_membytes(bus, false,
-						sdpcm_shared.assert_exp_addr,
-						(u8 *) str, maxstrlen);
-				if (bcmerror < 0)
-					goto done;
-
-				str[maxstrlen - 1] = '\0';
-				brcmu_bprintf(&strbuf, " expr \"%s\"", str);
-			}
-
-			if (sdpcm_shared.assert_file_addr != 0) {
-				str[0] = '\0';
-				bcmerror = brcmf_sdbrcm_membytes(bus, false,
-						sdpcm_shared.assert_file_addr,
-						(u8 *) str, maxstrlen);
-				if (bcmerror < 0)
-					goto done;
-
-				str[maxstrlen - 1] = '\0';
-				brcmu_bprintf(&strbuf, " file \"%s\"", str);
-			}
-
-			brcmu_bprintf(&strbuf, " line %d ",
-				    sdpcm_shared.assert_line);
-		}
-
-		if (sdpcm_shared.flags & SDPCM_SHARED_TRAP) {
-			bcmerror = brcmf_sdbrcm_membytes(bus, false,
-					sdpcm_shared.trap_addr, (u8 *)&tr,
-					sizeof(struct brcmf_trap));
-			if (bcmerror < 0)
-				goto done;
-
-			brcmu_bprintf(&strbuf,
-				    "Dongle trap type 0x%x @ epc 0x%x, cpsr 0x%x, spsr 0x%x, sp 0x%x,"
-				    "lp 0x%x, rpc 0x%x Trap offset 0x%x, "
-				    "r0 0x%x, r1 0x%x, r2 0x%x, r3 0x%x, r4 0x%x, r5 0x%x, r6 0x%x, r7 0x%x\n",
-				    tr.type, tr.epc, tr.cpsr, tr.spsr, tr.r13,
-				    tr.r14, tr.pc, sdpcm_shared.trap_addr,
-				    tr.r0, tr.r1, tr.r2, tr.r3, tr.r4, tr.r5,
-				    tr.r6, tr.r7);
-		}
-	}
-
-	if (sdpcm_shared.flags & (SDPCM_SHARED_ASSERT | SDPCM_SHARED_TRAP))
-		brcmf_dbg(ERROR, "%s\n", strbuf.origbuf);
-
-#ifdef BCMDBG
-	if (sdpcm_shared.flags & SDPCM_SHARED_TRAP)
-		/* Mem dump to a file on device */
-		brcmf_sdbrcm_mem_dump(bus);
-
-#endif				/* BCMDBG */
-
-done:
-	kfree(mbuffer);
-	kfree(str);
-
-	return bcmerror;
-}
-
 #define CONSOLE_LINE_MAX	192
 
 static int brcmf_sdbrcm_readconsole(struct brcmf_bus *bus)
@@ -3377,21 +3130,11 @@ brcmf_sdbrcm_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
 			  rxlen, msglen);
 	} else if (timeleft == 0) {
 		brcmf_dbg(ERROR, "resumed on timeout\n");
-#ifdef BCMDBG
-		brcmf_sdbrcm_sdlock(bus);
-		brcmf_sdbrcm_checkdied(bus, NULL, 0);
-		brcmf_sdbrcm_sdunlock(bus);
-#endif				/* BCMDBG */
 	} else if (pending == true) {
 		brcmf_dbg(CTL, "cancelled\n");
 		return -ERESTARTSYS;
 	} else {
 		brcmf_dbg(CTL, "resumed for unknown reason?\n");
-#ifdef BCMDBG
-		brcmf_sdbrcm_sdlock(bus);
-		brcmf_sdbrcm_checkdied(bus, NULL, 0);
-		brcmf_sdbrcm_sdunlock(bus);
-#endif				/* BCMDBG */
 	}
 
 	if (rxlen)
-- 
1.7.1



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

* [PATCH 15/20] staging: brcm80211: remove unnecessary mac80211 callbacks
  2011-09-24  2:08 [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2 Franky Lin
                   ` (13 preceding siblings ...)
  2011-09-24  2:09 ` [PATCH 14/20] staging: brcm80211: remove dongle firmware related debug code Franky Lin
@ 2011-09-24  2:09 ` Franky Lin
  2011-09-24  2:09 ` [PATCH 16/20] staging: brcm80211: declared global vars in softmac phy as const Franky Lin
                   ` (4 subsequent siblings)
  19 siblings, 0 replies; 35+ messages in thread
From: Franky Lin @ 2011-09-24  2:09 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

From: Arend van Spriel <arend@broadcom.com>

Several callback were implemented without executing any further
function calls into the driver. Review feedback indicated that
these could be removed.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c |   61 ----------------------
 1 files changed, 0 insertions(+), 61 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
index 50ca1bc..0bfab68 100644
--- a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
@@ -580,12 +580,6 @@ brcms_ops_configure_filter(struct ieee80211_hw *hw,
 	return;
 }
 
-static int
-brcms_ops_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, bool set)
-{
-	return 0;
-}
-
 static void brcms_ops_sw_scan_start(struct ieee80211_hw *hw)
 {
 	struct brcms_info *wl = hw->priv;
@@ -604,42 +598,6 @@ static void brcms_ops_sw_scan_complete(struct ieee80211_hw *hw)
 	return;
 }
 
-static void brcms_ops_set_tsf(struct ieee80211_hw *hw, u64 tsf)
-{
-	wiphy_err(hw->wiphy, "%s: Enter\n", __func__);
-	return;
-}
-
-static int
-brcms_ops_get_stats(struct ieee80211_hw *hw,
-		 struct ieee80211_low_level_stats *stats)
-{
-	struct brcms_info *wl = hw->priv;
-	struct wl_cnt *cnt;
-
-	LOCK(wl);
-	cnt = wl->pub->_cnt;
-	stats->dot11ACKFailureCount = 0;
-	stats->dot11RTSFailureCount = 0;
-	stats->dot11FCSErrorCount = 0;
-	stats->dot11RTSSuccessCount = 0;
-	UNLOCK(wl);
-	return 0;
-}
-
-static void
-brcms_ops_sta_notify(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-		  enum sta_notify_cmd cmd, struct ieee80211_sta *sta)
-{
-	switch (cmd) {
-	default:
-		wiphy_err(hw->wiphy, "%s: Unknown cmd = %d\n", __func__,
-			  cmd);
-		break;
-	}
-	return;
-}
-
 static int
 brcms_ops_conf_tx(struct ieee80211_hw *hw, u16 queue,
 	       const struct ieee80211_tx_queue_params *params)
@@ -653,12 +611,6 @@ brcms_ops_conf_tx(struct ieee80211_hw *hw, u16 queue,
 	return 0;
 }
 
-static u64 brcms_ops_get_tsf(struct ieee80211_hw *hw)
-{
-	wiphy_err(hw->wiphy, "%s: Enter\n", __func__);
-	return 0;
-}
-
 static int
 brcms_ops_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 	       struct ieee80211_sta *sta)
@@ -698,13 +650,6 @@ brcms_ops_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 }
 
 static int
-brcms_ops_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-		  struct ieee80211_sta *sta)
-{
-	return 0;
-}
-
-static int
 brcms_ops_ampdu_action(struct ieee80211_hw *hw,
 		    struct ieee80211_vif *vif,
 		    enum ieee80211_ampdu_mlme_action action,
@@ -800,16 +745,10 @@ static const struct ieee80211_ops brcms_ops = {
 	.config = brcms_ops_config,
 	.bss_info_changed = brcms_ops_bss_info_changed,
 	.configure_filter = brcms_ops_configure_filter,
-	.set_tim = brcms_ops_set_tim,
 	.sw_scan_start = brcms_ops_sw_scan_start,
 	.sw_scan_complete = brcms_ops_sw_scan_complete,
-	.set_tsf = brcms_ops_set_tsf,
-	.get_stats = brcms_ops_get_stats,
-	.sta_notify = brcms_ops_sta_notify,
 	.conf_tx = brcms_ops_conf_tx,
-	.get_tsf = brcms_ops_get_tsf,
 	.sta_add = brcms_ops_sta_add,
-	.sta_remove = brcms_ops_sta_remove,
 	.ampdu_action = brcms_ops_ampdu_action,
 	.rfkill_poll = brcms_ops_rfkill_poll,
 	.flush = brcms_ops_flush,
-- 
1.7.1



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

* [PATCH 16/20] staging: brcm80211: declared global vars in softmac phy as const
  2011-09-24  2:08 [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2 Franky Lin
                   ` (14 preceding siblings ...)
  2011-09-24  2:09 ` [PATCH 15/20] staging: brcm80211: remove unnecessary mac80211 callbacks Franky Lin
@ 2011-09-24  2:09 ` Franky Lin
  2011-09-24  9:52   ` Julian Andres Klode
  2011-09-24  2:09 ` [PATCH 17/20] staging: brcm80211: removed band related global vars from softmac Franky Lin
                   ` (3 subsequent siblings)
  19 siblings, 1 reply; 35+ messages in thread
From: Franky Lin @ 2011-09-24  2:09 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

From: Roland Vossen <rvossen@broadcom.com>

Global variables are undesirable unless they are read only.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c   |   16 +-----
 drivers/staging/brcm80211/brcmsmac/phy/phy_int.h   |   23 --------
 drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c   |    6 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_n.c     |   60 ++++++++++----------
 .../staging/brcm80211/brcmsmac/phy/phytbl_lcn.c    |    2 +-
 5 files changed, 36 insertions(+), 71 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
index 3f6e4bc..ab1db2d 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
@@ -52,7 +52,7 @@ struct chan_info_basic {
 	u16 freq;
 };
 
-static struct chan_info_basic chan_info_all[] = {
+static const struct chan_info_basic chan_info_all[] = {
 	{1, 2412},
 	{2, 2417},
 	{3, 2422},
@@ -111,20 +111,6 @@ static struct chan_info_basic chan_info_all[] = {
 	{216, 50800}
 };
 
-u16 ltrn_list[PHY_LTRN_LIST_LEN] = {
-	0x18f9, 0x0d01, 0x00e4, 0xdef4, 0x06f1, 0x0ffc,
-	0xfa27, 0x1dff, 0x10f0, 0x0918, 0xf20a, 0xe010,
-	0x1417, 0x1104, 0xf114, 0xf2fa, 0xf7db, 0xe2fc,
-	0xe1fb, 0x13ee, 0xff0d, 0xe91c, 0x171a, 0x0318,
-	0xda00, 0x03e8, 0x17e6, 0xe9e4, 0xfff3, 0x1312,
-	0xe105, 0xe204, 0xf725, 0xf206, 0xf1ec, 0x11fc,
-	0x14e9, 0xe0f0, 0xf2f6, 0x09e8, 0x1010, 0x1d01,
-	0xfad9, 0x0f04, 0x060f, 0xde0c, 0x001c, 0x0dff,
-	0x1807, 0xf61a, 0xe40e, 0x0f16, 0x05f9, 0x18ec,
-	0x0a1b, 0xff1e, 0x2600, 0xffe2, 0x0ae5, 0x1814,
-	0x0507, 0x0fea, 0xe4f2, 0xf6e6
-};
-
 const u8 ofdm_rate_lookup[] = {
 
 	BRCM_RATE_48M,
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h b/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h
index b94117b..f67e2be 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h
@@ -247,9 +247,6 @@ enum phy_cal_mode {
 #define PUB_NOT_ASSOC(pi) \
 	(mboolisset(pi->measure_hold, PHY_HOLD_FOR_NOT_ASSOC))
 
-#define PHY_LTRN_LIST_LEN	64
-extern u16 ltrn_list[PHY_LTRN_LIST_LEN];
-
 struct phy_table_info {
 	uint table;
 	int q;
@@ -922,26 +919,6 @@ struct lcnphy_radio_regs {
 	u8 do_init_g;
 };
 
-extern struct lcnphy_radio_regs lcnphy_radio_regs_2064[];
-extern struct lcnphy_radio_regs lcnphy_radio_regs_2066[];
-
-extern struct radio_regs regs_2055[], regs_SYN_2056[], regs_TX_2056[],
-			 regs_RX_2056[];
-extern struct radio_regs regs_SYN_2056_A1[], regs_TX_2056_A1[],
-			 regs_RX_2056_A1[];
-extern struct radio_regs regs_SYN_2056_rev5[], regs_TX_2056_rev5[],
-			 regs_RX_2056_rev5[];
-extern struct radio_regs regs_SYN_2056_rev6[], regs_TX_2056_rev6[],
-			 regs_RX_2056_rev6[];
-extern struct radio_regs regs_SYN_2056_rev7[], regs_TX_2056_rev7[],
-			 regs_RX_2056_rev7[];
-extern struct radio_regs regs_SYN_2056_rev8[], regs_TX_2056_rev8[],
-			 regs_RX_2056_rev8[];
-
-extern struct radio_20xx_regs regs_2057_rev4[], regs_2057_rev5[],
-			      regs_2057_rev5v1[];
-extern struct radio_20xx_regs regs_2057_rev7[], regs_2057_rev8[];
-
 extern char *phy_getvar(struct brcms_phy *pi, const char *name);
 extern int phy_getintvar(struct brcms_phy *pi, const char *name);
 
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c
index fdcea56..a87e392 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c
@@ -558,7 +558,7 @@ struct chan_info_2064_lcnphy {
 	u8 rxrf_rxrf_spare1;
 };
 
-static struct chan_info_2064_lcnphy chan_info_2064_lcnphy[] = {
+static const struct chan_info_2064_lcnphy chan_info_2064_lcnphy[] = {
 	{1, 2412, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80},
 	{2, 2417, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80},
 	{3, 2422, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80},
@@ -575,7 +575,7 @@ static struct chan_info_2064_lcnphy chan_info_2064_lcnphy[] = {
 	{14, 2484, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80},
 };
 
-struct lcnphy_radio_regs lcnphy_radio_regs_2064[] = {
+static const struct lcnphy_radio_regs lcnphy_radio_regs_2064[] = {
 	{0x00, 0, 0, 0, 0},
 	{0x01, 0x64, 0x64, 0, 0},
 	{0x02, 0x20, 0x20, 0, 0},
@@ -4489,7 +4489,7 @@ static void wlc_lcnphy_rc_cal(struct brcms_phy *pi)
 static void wlc_radio_2064_init(struct brcms_phy *pi)
 {
 	u32 i;
-	struct lcnphy_radio_regs *lcnphyregs = NULL;
+	const struct lcnphy_radio_regs *lcnphyregs = NULL;
 
 	lcnphyregs = lcnphy_radio_regs_2064;
 
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c
index 224ce06..e080b3a 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c
@@ -443,7 +443,7 @@ struct nphy_sfo_cfg {
 	u16 PHY_BW6;
 };
 
-static struct chan_info_nphy_2055 chan_info_nphy_2055[] = {
+static const struct chan_info_nphy_2055 chan_info_nphy_2055[] = {
 	{
 	 184, 4920, 3280, 0x71, 0x01, 0xEC, 0x0F, 0xFF, 0x01, 0x04, 0x0A,
 	 0x00, 0x8F, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x0F, 0x8F, 0xFF, 0x00, 0x0F,
@@ -942,7 +942,7 @@ static struct chan_info_nphy_2055 chan_info_nphy_2055[] = {
 	 0x01, 0x80, 0x3E6, 0x3E2, 0x3DE, 0x41B, 0x41F, 0x424}
 };
 
-static struct chan_info_nphy_radio205x chan_info_nphyrev3_2056[] = {
+static const struct chan_info_nphy_radio205x chan_info_nphyrev3_2056[] = {
 	{
 	 184, 4920, 0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, 0x0c, 0x01,
 	 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x08, 0x00, 0x7f,
@@ -1565,7 +1565,7 @@ static struct chan_info_nphy_radio205x chan_info_nphyrev3_2056[] = {
 	 0x0f, 0x00, 0x0d, 0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424}
 };
 
-static struct chan_info_nphy_radio205x chan_info_nphyrev4_2056_A1[] = {
+static const struct chan_info_nphy_radio205x chan_info_nphyrev4_2056_A1[] = {
 	{
 	 184, 4920, 0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, 0x0c, 0x01,
 	 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0e, 0x00, 0x7f,
@@ -2188,7 +2188,7 @@ static struct chan_info_nphy_radio205x chan_info_nphyrev4_2056_A1[] = {
 	 0x0f, 0x00, 0x0e, 0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424}
 };
 
-static struct chan_info_nphy_radio205x chan_info_nphyrev5_2056v5[] = {
+static const struct chan_info_nphy_radio205x chan_info_nphyrev5_2056v5[] = {
 	{
 	 184, 4920, 0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, 0x0c, 0x01,
 	 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0b, 0x00, 0x70,
@@ -2811,7 +2811,7 @@ static struct chan_info_nphy_radio205x chan_info_nphyrev5_2056v5[] = {
 	 0x0d, 0x00, 0x08, 0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424}
 };
 
-static struct chan_info_nphy_radio205x chan_info_nphyrev6_2056v6[] = {
+static const struct chan_info_nphy_radio205x chan_info_nphyrev6_2056v6[] = {
 	{
 	 184, 4920, 0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, 0x0c, 0x01,
 	 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77,
@@ -3434,7 +3434,7 @@ static struct chan_info_nphy_radio205x chan_info_nphyrev6_2056v6[] = {
 	 0x09, 0x00, 0x09, 0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424}
 };
 
-static struct chan_info_nphy_radio205x chan_info_nphyrev5n6_2056v7[] = {
+static const struct chan_info_nphy_radio205x chan_info_nphyrev5n6_2056v7[] = {
 	{
 	 184, 4920, 0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, 0x0c, 0x01,
 	 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0b, 0x00, 0x70,
@@ -4057,7 +4057,7 @@ static struct chan_info_nphy_radio205x chan_info_nphyrev5n6_2056v7[] = {
 	 0x0d, 0x00, 0x08, 0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424}
 };
 
-static struct chan_info_nphy_radio205x chan_info_nphyrev6_2056v8[] = {
+static const struct chan_info_nphy_radio205x chan_info_nphyrev6_2056v8[] = {
 	{
 	 184, 4920, 0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, 0x0c, 0x01,
 	 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77,
@@ -4680,7 +4680,7 @@ static struct chan_info_nphy_radio205x chan_info_nphyrev6_2056v8[] = {
 	 0x09, 0x00, 0x09, 0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424}
 };
 
-static struct chan_info_nphy_radio205x chan_info_nphyrev6_2056v11[] = {
+static const struct chan_info_nphy_radio205x chan_info_nphyrev6_2056v11[] = {
 	{
 	 184, 4920, 0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x02, 0x0c, 0x01,
 	 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77,
@@ -5303,7 +5303,7 @@ static struct chan_info_nphy_radio205x chan_info_nphyrev6_2056v11[] = {
 	 0x09, 0x00, 0x09, 0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424}
 };
 
-static struct chan_info_nphy_radio2057 chan_info_nphyrev7_2057_rev4[] = {
+static const struct chan_info_nphy_radio2057 chan_info_nphyrev7_2057_rev4[] = {
 	{
 	 184, 4920, 0x68, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xec, 0x01, 0x0f,
 	 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x00,
@@ -6166,7 +6166,8 @@ static struct chan_info_nphy_radio2057 chan_info_nphyrev7_2057_rev4[] = {
 	 0x0424}
 };
 
-static struct chan_info_nphy_radio2057_rev5 chan_info_nphyrev8_2057_rev5[] = {
+static const struct chan_info_nphy_radio2057_rev5
+chan_info_nphyrev8_2057_rev5[] = {
 	{
 	 1, 2412, 0x48, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x6c, 0x09, 0x0d,
 	 0x08, 0x0e, 0x61, 0x03, 0xff, 0x61, 0x03, 0xff, 0x03c9, 0x03c5, 0x03c1,
@@ -6225,7 +6226,8 @@ static struct chan_info_nphy_radio2057_rev5 chan_info_nphyrev8_2057_rev5[] = {
 	 0x041b, 0x041f, 0x0424}
 };
 
-static struct chan_info_nphy_radio2057_rev5 chan_info_nphyrev9_2057_rev5v1[] = {
+static const struct chan_info_nphy_radio2057_rev5
+chan_info_nphyrev9_2057_rev5v1[] = {
 	{
 	 1, 2412, 0x48, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x6c, 0x09, 0x0d,
 	 0x08, 0x0e, 0x61, 0x03, 0xff, 0x61, 0x03, 0xff, 0x03c9, 0x03c5, 0x03c1,
@@ -6284,7 +6286,7 @@ static struct chan_info_nphy_radio2057_rev5 chan_info_nphyrev9_2057_rev5v1[] = {
 	 0x041b, 0x041f, 0x0424}
 };
 
-static struct chan_info_nphy_radio2057 chan_info_nphyrev8_2057_rev7[] = {
+static const struct chan_info_nphy_radio2057 chan_info_nphyrev8_2057_rev7[] = {
 	{
 	 184, 4920, 0x68, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xec, 0x01, 0x0f,
 	 0x00, 0x0f, 0x00, 0xff, 0x00, 0xd3, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x00,
@@ -7025,7 +7027,7 @@ static struct chan_info_nphy_radio2057 chan_info_nphyrev8_2057_rev7[] = {
 	 0x0424}
 };
 
-static struct chan_info_nphy_radio2057 chan_info_nphyrev8_2057_rev8[] = {
+static const struct chan_info_nphy_radio2057 chan_info_nphyrev8_2057_rev8[] = {
 	{
 	 186, 4930, 0x6b, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xed, 0x01, 0x0f,
 	 0x00, 0x0f, 0x00, 0xff, 0x00, 0xd3, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x00,
@@ -20387,15 +20389,15 @@ void wlc_phy_switch_radio_nphy(struct brcms_phy *pi, bool on)
 
 static bool
 wlc_phy_chan2freq_nphy(struct brcms_phy *pi, uint channel, int *f,
-		       struct chan_info_nphy_radio2057 **t0,
-		       struct chan_info_nphy_radio205x **t1,
-		       struct chan_info_nphy_radio2057_rev5 **t2,
-		       struct chan_info_nphy_2055 **t3)
+		       const struct chan_info_nphy_radio2057 **t0,
+		       const struct chan_info_nphy_radio205x **t1,
+		       const struct chan_info_nphy_radio2057_rev5 **t2,
+		       const struct chan_info_nphy_2055 **t3)
 {
 	uint i;
-	struct chan_info_nphy_radio2057 *chan_info_tbl_p_0 = NULL;
-	struct chan_info_nphy_radio205x *chan_info_tbl_p_1 = NULL;
-	struct chan_info_nphy_radio2057_rev5 *chan_info_tbl_p_2 = NULL;
+	const struct chan_info_nphy_radio2057 *chan_info_tbl_p_0 = NULL;
+	const struct chan_info_nphy_radio205x *chan_info_tbl_p_1 = NULL;
+	const struct chan_info_nphy_radio2057_rev5 *chan_info_tbl_p_2 = NULL;
 	u32 tbl_len = 0;
 
 	int freq = 0;
@@ -20550,10 +20552,10 @@ fail:
 u8 wlc_phy_get_chan_freq_range_nphy(struct brcms_phy *pi, uint channel)
 {
 	int freq;
-	struct chan_info_nphy_radio2057 *t0 = NULL;
-	struct chan_info_nphy_radio205x *t1 = NULL;
-	struct chan_info_nphy_radio2057_rev5 *t2 = NULL;
-	struct chan_info_nphy_2055 *t3 = NULL;
+	const struct chan_info_nphy_radio2057 *t0 = NULL;
+	const struct chan_info_nphy_radio205x *t1 = NULL;
+	const struct chan_info_nphy_radio2057_rev5 *t2 = NULL;
+	const struct chan_info_nphy_2055 *t3 = NULL;
 
 	if (channel == 0)
 		channel = CHSPEC_CHANNEL(pi->radio_chanspec);
@@ -20573,7 +20575,7 @@ u8 wlc_phy_get_chan_freq_range_nphy(struct brcms_phy *pi, uint channel)
 
 static void
 wlc_phy_chanspec_radio2055_setup(struct brcms_phy *pi,
-				 struct chan_info_nphy_2055 *ci)
+				 const struct chan_info_nphy_2055 *ci)
 {
 
 	write_radio_reg(pi, RADIO_2055_PLL_REF, ci->RF_pll_ref);
@@ -21294,10 +21296,10 @@ wlc_phy_chanspec_nphy_setup(struct brcms_phy *pi, u16 chanspec,
 void wlc_phy_chanspec_set_nphy(struct brcms_phy *pi, u16 chanspec)
 {
 	int freq;
-	struct chan_info_nphy_radio2057 *t0 = NULL;
-	struct chan_info_nphy_radio205x *t1 = NULL;
-	struct chan_info_nphy_radio2057_rev5 *t2 = NULL;
-	struct chan_info_nphy_2055 *t3 = NULL;
+	const struct chan_info_nphy_radio2057 *t0 = NULL;
+	const struct chan_info_nphy_radio205x *t1 = NULL;
+	const struct chan_info_nphy_radio2057_rev5 *t2 = NULL;
+	const struct chan_info_nphy_2055 *t3 = NULL;
 
 	if (!wlc_phy_chan2freq_nphy
 		    (pi, CHSPEC_CHANNEL(chanspec), &freq, &t0, &t1, &t2, &t3))
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phytbl_lcn.c b/drivers/staging/brcm80211/brcmsmac/phy/phytbl_lcn.c
index 15c5ffc..1b11b2f 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phytbl_lcn.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phytbl_lcn.c
@@ -1611,7 +1611,7 @@ const u32 dot11lcnphytbl_rx_gain_info_sz_rev0 =
 	sizeof(dot11lcnphytbl_rx_gain_info_rev0) /
 	sizeof(dot11lcnphytbl_rx_gain_info_rev0[0]);
 
-static const u32 dot11lcnphytbl_rx_gain_info_sz_rev1 =
+const u32 dot11lcnphytbl_rx_gain_info_sz_rev1 =
 	sizeof(dot11lcnphytbl_rx_gain_info_rev1) /
 	sizeof(dot11lcnphytbl_rx_gain_info_rev1[0]);
 
-- 
1.7.1



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

* [PATCH 17/20] staging: brcm80211: removed band related global vars from softmac
  2011-09-24  2:08 [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2 Franky Lin
                   ` (15 preceding siblings ...)
  2011-09-24  2:09 ` [PATCH 16/20] staging: brcm80211: declared global vars in softmac phy as const Franky Lin
@ 2011-09-24  2:09 ` Franky Lin
  2011-09-24  2:09 ` [PATCH 18/20] staging: brcm80211: removed global var global_scb " Franky Lin
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 35+ messages in thread
From: Franky Lin @ 2011-09-24  2:09 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

From: Roland Vossen <rvossen@broadcom.com>

Global variables are undesirable unless they are read only. Variables are
now maintained in a device specific structure.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c |   30 ++++++++++++---------
 drivers/staging/brcm80211/brcmsmac/main.h        |    1 +
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
index 0bfab68..938bbe6 100644
--- a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
@@ -31,6 +31,7 @@
 #include "pub.h"
 #include "ucode_loader.h"
 #include "mac80211_if.h"
+#include "main.h"
 
 #define N_TX_QUEUES	4 /* #tx queues on mac80211<->driver interface */
 
@@ -225,7 +226,7 @@ static struct ieee80211_rate legacy_ratetable[] = {
 	RATE(540, 0),
 };
 
-static struct ieee80211_supported_band brcms_band_2GHz_nphy = {
+static const struct ieee80211_supported_band brcms_band_2GHz_nphy_template = {
 	.band = IEEE80211_BAND_2GHZ,
 	.channels = brcms_2ghz_chantable,
 	.n_channels = ARRAY_SIZE(brcms_2ghz_chantable),
@@ -247,7 +248,7 @@ static struct ieee80211_supported_band brcms_band_2GHz_nphy = {
 		   }
 };
 
-static struct ieee80211_supported_band brcms_band_5GHz_nphy = {
+static const struct ieee80211_supported_band brcms_band_5GHz_nphy_template = {
 	.band = IEEE80211_BAND_5GHZ,
 	.channels = brcms_5ghz_nphy_chantable,
 	.n_channels = ARRAY_SIZE(brcms_5ghz_nphy_chantable),
@@ -981,23 +982,24 @@ static irqreturn_t brcms_isr(int irq, void *dev_id)
 static int ieee_hw_rate_init(struct ieee80211_hw *hw)
 {
 	struct brcms_info *wl = hw->priv;
-	int has_5g;
+	struct brcms_c_info *wlc = wl->wlc;
+	struct ieee80211_supported_band *band;
+	int has_5g = 0;
 	u16 phy_type;
 
-	has_5g = 0;
-
 	hw->wiphy->bands[IEEE80211_BAND_2GHZ] = NULL;
 	hw->wiphy->bands[IEEE80211_BAND_5GHZ] = NULL;
 
 	phy_type = brcms_c_get_phy_type(wl->wlc, 0);
 	if (phy_type == PHY_TYPE_N || phy_type == PHY_TYPE_LCN) {
+		band = &wlc->bandstate[BAND_2G_INDEX]->band;
+		*band = brcms_band_2GHz_nphy_template;
 		if (phy_type == PHY_TYPE_LCN) {
 			/* Single stream */
-			brcms_band_2GHz_nphy.ht_cap.mcs.rx_mask[1] = 0;
-			brcms_band_2GHz_nphy.ht_cap.mcs.rx_highest =
-					cpu_to_le16(72);
+			band->ht_cap.mcs.rx_mask[1] = 0;
+			band->ht_cap.mcs.rx_highest = cpu_to_le16(72);
 		}
-		hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &brcms_band_2GHz_nphy;
+		hw->wiphy->bands[IEEE80211_BAND_2GHZ] = band;
 	} else {
 		return -EPERM;
 	}
@@ -1005,11 +1007,13 @@ static int ieee_hw_rate_init(struct ieee80211_hw *hw)
 	/* Assume all bands use the same phy.  True for 11n devices. */
 	if (wl->pub->_nbands > 1) {
 		has_5g++;
-		if (phy_type == PHY_TYPE_N || phy_type == PHY_TYPE_LCN)
-			hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
-			    &brcms_band_5GHz_nphy;
-		else
+		if (phy_type == PHY_TYPE_N || phy_type == PHY_TYPE_LCN) {
+			band = &wlc->bandstate[BAND_5G_INDEX]->band;
+			*band = brcms_band_5GHz_nphy_template;
+			hw->wiphy->bands[IEEE80211_BAND_5GHZ] = band;
+		} else {
 			return -EPERM;
+		}
 	}
 	return 0;
 }
diff --git a/drivers/staging/brcm80211/brcmsmac/main.h b/drivers/staging/brcm80211/brcmsmac/main.h
index 8760d7e..9e12a14 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.h
+++ b/drivers/staging/brcm80211/brcmsmac/main.h
@@ -281,6 +281,7 @@ struct brcms_band {
 
 	u16 CWmin; /* minimum size of contention window, in unit of aSlotTime */
 	u16 CWmax; /* maximum size of contention window, in unit of aSlotTime */
+	struct ieee80211_supported_band band;
 };
 
 /* module control blocks */
-- 
1.7.1



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

* [PATCH 18/20] staging: brcm80211: removed global var global_scb from softmac
  2011-09-24  2:08 [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2 Franky Lin
                   ` (16 preceding siblings ...)
  2011-09-24  2:09 ` [PATCH 17/20] staging: brcm80211: removed band related global vars from softmac Franky Lin
@ 2011-09-24  2:09 ` Franky Lin
  2011-09-24  2:09 ` [PATCH 19/20] staging: brcm80211: various global var related changes in softmac Franky Lin
  2011-09-24  2:09 ` [PATCH 20/20] staging: brcm80211: removed global variable in softmac otp Franky Lin
  19 siblings, 0 replies; 35+ messages in thread
From: Franky Lin @ 2011-09-24  2:09 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

From: Roland Vossen <rvossen@broadcom.com>

Global variables are undesirable unless they are read only. Removed by
instead using an already defined Station Control Block variable in a
per-device structure.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/ampdu.c       |    6 +++---
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c |   19 ++++---------------
 drivers/staging/brcm80211/brcmsmac/main.c        |   21 +++++++++++++--------
 drivers/staging/brcm80211/brcmsmac/main.h        |    4 ++++
 drivers/staging/brcm80211/brcmsmac/pub.h         |    1 -
 5 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/ampdu.c b/drivers/staging/brcm80211/brcmsmac/ampdu.c
index b94d60c..e29c62e 100644
--- a/drivers/staging/brcm80211/brcmsmac/ampdu.c
+++ b/drivers/staging/brcm80211/brcmsmac/ampdu.c
@@ -314,7 +314,7 @@ static void brcms_c_scb_ampdu_update_config(struct ampdu_info *ampdu,
 
 static void brcms_c_scb_ampdu_update_config_all(struct ampdu_info *ampdu)
 {
-	brcms_c_scb_ampdu_update_config(ampdu, ampdu->wlc->pub->global_scb);
+	brcms_c_scb_ampdu_update_config(ampdu, &ampdu->wlc->pri_scb);
 }
 
 static void brcms_c_ffpld_calc_mcs2ampdu_table(struct ampdu_info *ampdu, int f)
@@ -482,7 +482,7 @@ brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid,
 	struct scb_ampdu *scb_ampdu;
 	struct scb_ampdu_tid_ini *ini;
 	struct ampdu_info *ampdu = wlc->ampdu;
-	struct scb *scb = wlc->pub->global_scb;
+	struct scb *scb = &wlc->pri_scb;
 	scb_ampdu = &scb->scb_ampdu;
 
 	if (!ampdu->ini_enable[tid]) {
@@ -542,7 +542,7 @@ brcms_c_sendampdu(struct ampdu_info *ampdu, struct brcms_txq_info *qi,
 
 	f = ampdu->fifo_tb + prio2fifo[tid];
 
-	scb = wlc->pub->global_scb;
+	scb = &wlc->pri_scb;
 	scb_ampdu = &scb->scb_ampdu;
 	ini = &scb_ampdu->ini[tid];
 
diff --git a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
index 938bbe6..d22903e 100644
--- a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
@@ -616,25 +616,14 @@ static int
 brcms_ops_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 	       struct ieee80211_sta *sta)
 {
-	struct scb *scb;
-
-	int i;
 	struct brcms_info *wl = hw->priv;
+	struct scb *scb = &wl->wlc->pri_scb;
 
-	/* Init the scb */
-	scb = (struct scb *)sta->drv_priv;
-	memset(scb, 0, sizeof(struct scb));
-	for (i = 0; i < NUMPRIO; i++)
-		scb->seqctl[i] = 0xFFFF;
-	scb->seqctl_nonqos = 0xFFFF;
-	scb->magic = SCB_MAGIC;
+	brcms_c_init_scb(scb);
 
-	wl->pub->global_scb = scb;
 	wl->pub->global_ampdu = &(scb->scb_ampdu);
 	wl->pub->global_ampdu->scb = scb;
 	wl->pub->global_ampdu->max_pdu = 16;
-	brcmu_pktq_init(&scb->scb_ampdu.txq, AMPDU_MAX_SCB_TID,
-		  AMPDU_MAX_SCB_TID * PKTQ_LEN_DEFAULT);
 
 	sta->ht_cap.ht_supported = true;
 	sta->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
@@ -657,8 +646,8 @@ brcms_ops_ampdu_action(struct ieee80211_hw *hw,
 		    struct ieee80211_sta *sta, u16 tid, u16 *ssn,
 		    u8 buf_size)
 {
-	struct scb *scb = (struct scb *)sta->drv_priv;
 	struct brcms_info *wl = hw->priv;
+	struct scb *scb = &wl->wlc->pri_scb;
 	int status;
 
 	if (WARN_ON(scb->magic != SCB_MAGIC))
@@ -1038,7 +1027,7 @@ static int ieee_hw_init(struct ieee80211_hw *hw)
 
 	hw->rate_control_algorithm = "minstrel_ht";
 
-	hw->sta_data_size = sizeof(struct scb);
+	hw->sta_data_size = 0;
 	return ieee_hw_rate_init(hw);
 }
 
diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 407e99e..5edf8b8 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -882,7 +882,7 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs)
 	h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN);
 
 	if (tx_info->control.sta)
-		scb = (struct scb *)tx_info->control.sta->drv_priv;
+		scb = &wlc->pri_scb;
 
 	if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
 		brcms_c_ampdu_dotxstatus(wlc->ampdu, scb, p, txs);
@@ -3337,14 +3337,21 @@ static u16 brcms_c_init_chanspec(struct brcms_c_info *wlc)
 	return chanspec;
 }
 
-static struct scb global_scb;
-
-static void brcms_c_init_scb(struct brcms_c_info *wlc, struct scb *scb)
+void brcms_c_init_scb(struct scb *scb)
 {
 	int i;
+
+	memset(scb, 0, sizeof(struct scb));
 	scb->flags = SCB_WMECAP | SCB_HTCAP;
-	for (i = 0; i < NUMPRIO; i++)
+	for (i = 0; i < NUMPRIO; i++) {
 		scb->seqnum[i] = 0;
+		scb->seqctl[i] = 0xFFFF;
+	}
+
+	scb->seqctl_nonqos = 0xFFFF;
+	scb->magic = SCB_MAGIC;
+	brcmu_pktq_init(&scb->scb_ampdu.txq, AMPDU_MAX_SCB_TID,
+		  AMPDU_MAX_SCB_TID * PKTQ_LEN_DEFAULT);
 }
 
 /* d11 core init
@@ -3805,8 +3812,6 @@ void brcms_c_init(struct brcms_c_info *wlc)
 
 	brcms_c_bandinit_ordered(wlc, chanspec);
 
-	brcms_c_init_scb(wlc, &global_scb);
-
 	/* init probe response timeout */
 	brcms_c_write_shm(wlc, M_PRS_MAXTIME, wlc->prb_resp_timeout);
 
@@ -7685,7 +7690,7 @@ void brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu,
 {
 	u8 prio;
 	uint fifo;
-	struct scb *scb = &global_scb;
+	struct scb *scb = &wlc->pri_scb;
 	struct ieee80211_hdr *d11_header = (struct ieee80211_hdr *)(sdu->data);
 
 	/*
diff --git a/drivers/staging/brcm80211/brcmsmac/main.h b/drivers/staging/brcm80211/brcmsmac/main.h
index 9e12a14..47665da 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.h
+++ b/drivers/staging/brcm80211/brcmsmac/main.h
@@ -22,6 +22,7 @@
 #include <brcmu_utils.h>
 #include "types.h"
 #include "d11.h"
+#include "scb.h"
 
 #define	INVCHANNEL		255	/* invalid channel */
 
@@ -483,6 +484,7 @@ struct brcms_txq_info {
  * tx_duty_cycle_cck: maximum allowed duty cycle for CCK.
  * pkt_queue: txq for transmit packets.
  * wiphy:
+ * pri_scb: primary Station Control Block
  */
 struct brcms_c_info {
 	struct brcms_pub *pub;
@@ -610,6 +612,7 @@ struct brcms_c_info {
 
 	struct brcms_txq_info *pkt_queue;
 	struct wiphy *wiphy;
+	struct scb pri_scb;
 };
 
 /* antsel module specific state */
@@ -864,5 +867,6 @@ extern void brcms_b_core_phypll_ctl(struct brcms_hardware *wlc_hw, bool on);
 extern void brcms_b_txant_set(struct brcms_hardware *wlc_hw, u16 phytxant);
 extern void brcms_b_band_stf_ss_set(struct brcms_hardware *wlc_hw,
 				    u8 stf_mode);
+extern void brcms_c_init_scb(struct scb *scb);
 
 #endif				/* _BRCM_MAIN_H_ */
diff --git a/drivers/staging/brcm80211/brcmsmac/pub.h b/drivers/staging/brcm80211/brcmsmac/pub.h
index 9670309..b69833e 100644
--- a/drivers/staging/brcm80211/brcmsmac/pub.h
+++ b/drivers/staging/brcm80211/brcmsmac/pub.h
@@ -144,7 +144,6 @@ struct brcms_bss_info {
 struct brcms_pub {
 	struct brcms_c_info *wlc;
 	struct ieee80211_hw *ieee_hw;
-	struct scb *global_scb;
 	struct scb_ampdu *global_ampdu;
 	uint mac80211_state;
 	uint unit;		/* device instance number */
-- 
1.7.1



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

* [PATCH 19/20] staging: brcm80211: various global var related changes in softmac
  2011-09-24  2:08 [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2 Franky Lin
                   ` (17 preceding siblings ...)
  2011-09-24  2:09 ` [PATCH 18/20] staging: brcm80211: removed global var global_scb " Franky Lin
@ 2011-09-24  2:09 ` Franky Lin
  2011-09-24  2:09 ` [PATCH 20/20] staging: brcm80211: removed global variable in softmac otp Franky Lin
  19 siblings, 0 replies; 35+ messages in thread
From: Franky Lin @ 2011-09-24  2:09 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

From: Roland Vossen <rvossen@broadcom.com>

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/main.c |   11 +----------
 drivers/staging/brcm80211/brcmsmac/main.h |    2 +-
 drivers/staging/brcm80211/brcmsmac/otp.c  |    4 ++--
 drivers/staging/brcm80211/brcmsmac/rate.h |    1 -
 drivers/staging/brcm80211/brcmsmac/srom.c |   15 +++++++++------
 5 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 5edf8b8..ee11286 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -428,8 +428,6 @@ const u8 wme_fifo2ac[] = { AC_BK, AC_BE, AC_VI, AC_VO, AC_BE, AC_BE };
 /* WME/802.1E Access Category to TX FIFO number */
 static const u8 wme_ac2fifo[] = { 1, 0, 2, 3 };
 
-static bool in_send_q;
-
 /* 802.1D Priority to precedence queue mapping */
 const u8 wlc_prio2prec_map[] = {
 	_BRCMS_PREC_BE,		/* 0 BE - Best-effort */
@@ -442,7 +440,7 @@ const u8 wlc_prio2prec_map[] = {
 	_BRCMS_PREC_NC,		/* 7 NC - Network Control */
 };
 
-static u16 xmtfifo_sz[][NFIFO] = {
+static const u16 xmtfifo_sz[][NFIFO] = {
 	/* corerev 20: 5120, 49152, 49152, 5376, 4352, 1280 */
 	{20, 192, 192, 21, 17, 5},
 	/* corerev 21: 2304, 14848, 5632, 3584, 3584, 1280 */
@@ -7717,11 +7715,6 @@ void brcms_c_send_q(struct brcms_c_info *wlc)
 	struct pktq *q = &qi->q;
 	struct ieee80211_tx_info *tx_info;
 
-	if (in_send_q)
-		return;
-	else
-		in_send_q = true;
-
 	prec_map = wlc->tx_prec_map;
 
 	/* Send all the enq'd pkts that we can.
@@ -7753,8 +7746,6 @@ void brcms_c_send_q(struct brcms_c_info *wlc)
 			prec_map = wlc->tx_prec_map;
 		}
 	}
-
-	in_send_q = false;
 }
 
 void
diff --git a/drivers/staging/brcm80211/brcmsmac/main.h b/drivers/staging/brcm80211/brcmsmac/main.h
index 47665da..c938add 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.h
+++ b/drivers/staging/brcm80211/brcmsmac/main.h
@@ -359,7 +359,7 @@ struct brcms_hardware {
 	u16 chanspec;	/* bmac chanspec shadow */
 
 	uint *txavail[NFIFO];	/* # tx descriptors available */
-	u16 *xmtfifo_sz;	/* fifo size in 256B for each xmt fifo */
+	const u16 *xmtfifo_sz;	/* fifo size in 256B for each xmt fifo */
 
 	u32 pllreq;		/* pll requests to keep PLL on */
 
diff --git a/drivers/staging/brcm80211/brcmsmac/otp.c b/drivers/staging/brcm80211/brcmsmac/otp.c
index 05c78c7..06cb575 100644
--- a/drivers/staging/brcm80211/brcmsmac/otp.c
+++ b/drivers/staging/brcm80211/brcmsmac/otp.c
@@ -80,7 +80,7 @@ struct otp_fn_s {
 
 struct otpinfo {
 	uint ccrev;		/* chipc revision */
-	struct otp_fn_s *fn;		/* OTP functions */
+	const struct otp_fn_s *fn;	/* OTP functions */
 	struct si_pub *sih;		/* Saved sb handle */
 
 	/* IPX OTP section */
@@ -442,7 +442,7 @@ static int ipxotp_nvread(struct otpinfo *oi, char *data, uint *len)
 	return -ENOTSUPP;
 }
 
-static struct otp_fn_s ipxotp_fn = {
+static const struct otp_fn_s ipxotp_fn = {
 	(int (*)(struct otpinfo *)) ipxotp_size,
 	(u16 (*)(struct otpinfo *, struct chipcregs *, uint)) ipxotp_read_bit,
 
diff --git a/drivers/staging/brcm80211/brcmsmac/rate.h b/drivers/staging/brcm80211/brcmsmac/rate.h
index 2cc66e0..e7b9dc2 100644
--- a/drivers/staging/brcm80211/brcmsmac/rate.h
+++ b/drivers/staging/brcm80211/brcmsmac/rate.h
@@ -27,7 +27,6 @@ extern const struct brcms_c_rateset cck_ofdm_rates;
 extern const struct brcms_c_rateset ofdm_rates;
 extern const struct brcms_c_rateset cck_rates;
 extern const struct brcms_c_rateset gphy_legacy_rates;
-extern const struct brcms_c_rateset wlc_lrs_rates;
 extern const struct brcms_c_rateset rate_limit_1_2;
 
 struct brcms_mcs_info {
diff --git a/drivers/staging/brcm80211/brcmsmac/srom.c b/drivers/staging/brcm80211/brcmsmac/srom.c
index b37faf4..0105306 100644
--- a/drivers/staging/brcm80211/brcmsmac/srom.c
+++ b/drivers/staging/brcm80211/brcmsmac/srom.c
@@ -778,7 +778,9 @@ static const struct brcms_sromvar perpath_pci_sromvars[] = {
 	{NULL, 0, 0, 0, 0}
 };
 
-static u8 srom_crc8_table[CRC8_TABLE_SIZE];
+/* crc table has the same contents for every device instance, so it can be
+ * shared between devices. */
+static u8 brcms_srom_crc8_table[CRC8_TABLE_SIZE];
 
 static u16 *srom_window_address(struct si_pub *sih, u8 *curmap)
 {
@@ -1052,8 +1054,9 @@ sprom_read_pci(struct si_pub *sih, u16 *sprom, uint wordoff,
 
 		/* fixup the endianness so crc8 will pass */
 		htol16_buf(buf, nwords * 2);
-		if (crc8(srom_crc8_table, (u8 *) buf, nwords * 2,
-			 CRC8_INIT_VALUE) != CRC8_GOOD_VALUE(srom_crc8_table))
+		if (crc8(brcms_srom_crc8_table, (u8 *) buf, nwords * 2,
+			 CRC8_INIT_VALUE) !=
+			 CRC8_GOOD_VALUE(brcms_srom_crc8_table))
 			/* DBG only pci always read srom4 first, then srom8/9 */
 			err = -EIO;
 
@@ -1089,8 +1092,8 @@ static int otp_read_pci(struct si_pub *sih, u16 *buf, uint bufsz)
 
 	/* fixup the endianness so crc8 will pass */
 	htol16_buf(buf, bufsz);
-	if (crc8(srom_crc8_table, (u8 *) buf, SROM4_WORDS * 2,
-		 CRC8_INIT_VALUE) != CRC8_GOOD_VALUE(srom_crc8_table))
+	if (crc8(brcms_srom_crc8_table, (u8 *) buf, SROM4_WORDS * 2,
+		 CRC8_INIT_VALUE) != CRC8_GOOD_VALUE(brcms_srom_crc8_table))
 		err = -EIO;
 
 	/* now correct the endianness of the byte array */
@@ -1147,7 +1150,7 @@ static int initvars_srom_pci(struct si_pub *sih, void *curmap, char **vars,
 
 	sromwindow = srom_window_address(sih, curmap);
 
-	crc8_populate_lsb(srom_crc8_table, SROM_CRC8_POLY);
+	crc8_populate_lsb(brcms_srom_crc8_table, SROM_CRC8_POLY);
 	if (ai_is_sprom_available(sih)) {
 		err = sprom_read_pci(sih, sromwindow, 0, srom, SROM_WORDS,
 				     true);
-- 
1.7.1



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

* [PATCH 20/20] staging: brcm80211: removed global variable in softmac otp
  2011-09-24  2:08 [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2 Franky Lin
                   ` (18 preceding siblings ...)
  2011-09-24  2:09 ` [PATCH 19/20] staging: brcm80211: various global var related changes in softmac Franky Lin
@ 2011-09-24  2:09 ` Franky Lin
  19 siblings, 0 replies; 35+ messages in thread
From: Franky Lin @ 2011-09-24  2:09 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

From: Roland Vossen <rvossen@broadcom.com>

Placed variable on the stack instead and deleted unused functions.
Softmac was tested to function properly with multiple adapters in one
system.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/otp.c |  143 ++++--------------------------
 drivers/staging/brcm80211/brcmsmac/otp.h |    8 --
 2 files changed, 18 insertions(+), 133 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/otp.c b/drivers/staging/brcm80211/brcmsmac/otp.c
index 06cb575..f15e8be 100644
--- a/drivers/staging/brcm80211/brcmsmac/otp.c
+++ b/drivers/staging/brcm80211/brcmsmac/otp.c
@@ -67,15 +67,13 @@
 /* Fixed size subregions sizes in words */
 #define OTPGU_CI_SZ		2
 
+struct otpinfo;
+
 /* OTP function struct */
 struct otp_fn_s {
-	int (*size)(struct otpinfo *oi);
-	u16 (*read_bit)(struct otpinfo *oi, struct chipcregs *cc, uint off);
-	struct otpinfo *(*init)(struct si_pub *sih);
+	int (*init)(struct si_pub *sih, struct otpinfo *oi);
 	int (*read_region)(struct otpinfo *oi, int region, u16 *data,
 			   uint *wlen);
-	int (*nvread)(struct otpinfo *oi, char *data, uint *len);
-	int (*status)(struct otpinfo *oi);
 };
 
 struct otpinfo {
@@ -99,21 +97,6 @@ struct otpinfo {
 	int otpgu_base;		/* offset to General Use Region */
 };
 
-static struct otpinfo otpinfo;
-
-/*
- * IPX OTP Code
- *
- *   Exported functions:
- *	ipxotp_status()
- *	ipxotp_size()
- *	ipxotp_init()
- *	ipxotp_read_bit()
- *	ipxotp_read_region()
- *	ipxotp_nvread()
- *
- */
-
 /* OTP layout */
 /* CC revs 21, 24 and 27 OTP General Use Region word offset */
 #define REVA4_OTPGU_BASE	12
@@ -149,51 +132,11 @@ static struct otpinfo otpinfo;
 #define OTP4315_SWREG_SZ	178	/* 178 bytes */
 #define OTP_SZ_FU_144		(144/8)	/* 144 bits */
 
-static int ipxotp_status(struct otpinfo *oi)
-{
-	return (int)(oi->status);
-}
-
-/* Return size in bytes */
-static int ipxotp_size(struct otpinfo *oi)
-{
-	return (int)oi->wsize * 2;
-}
-
 static u16 ipxotp_otpr(struct otpinfo *oi, struct chipcregs *cc, uint wn)
 {
 	return R_REG(&cc->sromotp[wn]);
 }
 
-static u16 ipxotp_read_bit(struct otpinfo *oi, struct chipcregs *cc, uint off)
-{
-	uint k, row, col;
-	u32 otpp, st;
-
-	row = off / oi->cols;
-	col = off % oi->cols;
-
-	otpp = OTPP_START_BUSY |
-	    ((OTPPOC_READ << OTPP_OC_SHIFT) & OTPP_OC_MASK) |
-	    ((row << OTPP_ROW_SHIFT) & OTPP_ROW_MASK) |
-	    ((col << OTPP_COL_SHIFT) & OTPP_COL_MASK);
-	W_REG(&cc->otpprog, otpp);
-
-	for (k = 0;
-	     ((st = R_REG(&cc->otpprog)) & OTPP_START_BUSY)
-	     && (k < OTPP_TRIES); k++)
-		;
-	if (k >= OTPP_TRIES)
-		return 0xffff;
-
-	if (st & OTPP_READERR)
-		return 0xffff;
-
-	st = (st & OTPP_VALUE_MASK) >> OTPP_VALUE_SHIFT;
-
-	return (int)st;
-}
-
 /*
  * Calculate max HW/SW region byte size by subtracting fuse region
  * and checksum size, osizew is oi->wsize (OTP size - GU size) in words
@@ -294,28 +237,24 @@ static void _ipxotp_init(struct otpinfo *oi, struct chipcregs *cc)
 	oi->flim = oi->wsize;
 }
 
-static struct otpinfo *ipxotp_init(struct si_pub *sih)
+static int ipxotp_init(struct si_pub *sih, struct otpinfo *oi)
 {
 	uint idx;
 	struct chipcregs *cc;
-	struct otpinfo *oi;
 
 	/* Make sure we're running IPX OTP */
 	if (!OTPTYPE_IPX(sih->ccrev))
-		return NULL;
+		return -EBADE;
 
 	/* Make sure OTP is not disabled */
 	if (ai_is_otp_disabled(sih))
-		return NULL;
-
-	/* OTP is always powered */
-	oi = &otpinfo;
+		return -EBADE;
 
 	/* Check for otp size */
 	switch ((sih->cccaps & CC_CAP_OTPSIZE) >> CC_CAP_OTPSIZE_SHIFT) {
 	case 0:
 		/* Nothing there */
-		return NULL;
+		return -EBADE;
 	case 1:		/* 32x64 */
 		oi->rows = 32;
 		oi->cols = 64;
@@ -338,7 +277,7 @@ static struct otpinfo *ipxotp_init(struct si_pub *sih)
 		break;
 	default:
 		/* Don't know the geometry */
-		return NULL;
+		return -EBADE;
 	}
 
 	/* Retrieve OTP region info */
@@ -349,7 +288,7 @@ static struct otpinfo *ipxotp_init(struct si_pub *sih)
 
 	ai_setcoreidx(sih, idx);
 
-	return oi;
+	return 0;
 }
 
 static int
@@ -437,56 +376,16 @@ ipxotp_read_region(struct otpinfo *oi, int region, u16 *data, uint *wlen)
 	return 0;
 }
 
-static int ipxotp_nvread(struct otpinfo *oi, char *data, uint *len)
-{
-	return -ENOTSUPP;
-}
-
 static const struct otp_fn_s ipxotp_fn = {
-	(int (*)(struct otpinfo *)) ipxotp_size,
-	(u16 (*)(struct otpinfo *, struct chipcregs *, uint)) ipxotp_read_bit,
-
-	(struct otpinfo *(*)(struct si_pub *)) ipxotp_init,
+	(int (*)(struct si_pub *, struct otpinfo *)) ipxotp_init,
 	(int (*)(struct otpinfo *, int, u16 *, uint *)) ipxotp_read_region,
-	(int (*)(struct otpinfo *, char *, uint *)) ipxotp_nvread,
-
-	(int (*)(struct otpinfo *)) ipxotp_status
 };
 
-/*
- *	otp_status()
- *	otp_size()
- *	otp_read_bit()
- *	otp_init()
- *	otp_read_region()
- *	otp_nvread()
- */
-
-int otp_status(struct otpinfo *oi)
+static int otp_init(struct si_pub *sih, struct otpinfo *oi)
 {
-	return oi->fn->status(oi);
-}
-
-int otp_size(struct otpinfo *oi)
-{
-	return oi->fn->size(oi);
-}
 
-u16 otp_read_bit(struct otpinfo *oi, uint offset)
-{
-	uint idx = ai_coreidx(oi->sih);
-	struct chipcregs *cc = ai_setcoreidx(oi->sih, SI_CC_IDX);
-	u16 readBit = (u16) oi->fn->read_bit(oi, cc, offset);
-	ai_setcoreidx(oi->sih, idx);
-	return readBit;
-}
+	int ret;
 
-struct otpinfo *otp_init(struct si_pub *sih)
-{
-	struct otpinfo *oi;
-	struct otpinfo *ret = NULL;
-
-	oi = &otpinfo;
 	memset(oi, 0, sizeof(struct otpinfo));
 
 	oi->ccrev = sih->ccrev;
@@ -495,18 +394,19 @@ struct otpinfo *otp_init(struct si_pub *sih)
 		oi->fn = &ipxotp_fn;
 
 	if (oi->fn == NULL)
-		return NULL;
+		return -EBADE;
 
 	oi->sih = sih;
 
-	ret = (oi->fn->init) (sih);
+	ret = (oi->fn->init) (sih, oi);
 
 	return ret;
 }
 
 int
 otp_read_region(struct si_pub *sih, int region, u16 *data, uint *wlen) {
-	struct otpinfo *oi;
+	struct otpinfo otpinfo;
+	struct otpinfo *oi = &otpinfo;
 	int err = 0;
 
 	if (ai_is_otp_disabled(sih)) {
@@ -514,19 +414,12 @@ otp_read_region(struct si_pub *sih, int region, u16 *data, uint *wlen) {
 		goto out;
 	}
 
-	oi = otp_init(sih);
-	if (oi == NULL) {
-		err = -EBADE;
+	err = otp_init(sih, oi);
+	if (err)
 		goto out;
-	}
 
 	err = ((oi)->fn->read_region)(oi, region, data, wlen);
 
  out:
 	return err;
 }
-
-int otp_nvread(struct otpinfo *oi, char *data, uint *len)
-{
-	return oi->fn->nvread(oi, data, len);
-}
diff --git a/drivers/staging/brcm80211/brcmsmac/otp.h b/drivers/staging/brcm80211/brcmsmac/otp.h
index bf2f76f..6b6d31c 100644
--- a/drivers/staging/brcm80211/brcmsmac/otp.h
+++ b/drivers/staging/brcm80211/brcmsmac/otp.h
@@ -30,15 +30,7 @@
 /* OTP Size */
 #define OTP_SZ_MAX		(6144/8)	/* maximum bytes in one CIS */
 
-struct otpinfo;
-
-/* Exported functions */
-extern int otp_status(struct otpinfo *oi);
-extern int otp_size(struct otpinfo *oi);
-extern u16 otp_read_bit(struct otpinfo *oi, uint offset);
-extern struct otpinfo *otp_init(struct si_pub *sih);
 extern int otp_read_region(struct si_pub *sih, int region, u16 *data,
 			   uint *wlen);
-extern int otp_nvread(struct otpinfo *oi, char *data, uint *len);
 
 #endif				/* _BRCM_OTP_H_ */
-- 
1.7.1



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

* Re: [PATCH 16/20] staging: brcm80211: declared global vars in softmac phy as const
  2011-09-24  2:09 ` [PATCH 16/20] staging: brcm80211: declared global vars in softmac phy as const Franky Lin
@ 2011-09-24  9:52   ` Julian Andres Klode
       [not found]     ` <4E80B37C.4060106@broadcom.com>
  0 siblings, 1 reply; 35+ messages in thread
From: Julian Andres Klode @ 2011-09-24  9:52 UTC (permalink / raw)
  To: Franky Lin; +Cc: gregkh, devel, linux-wireless

On Fri, Sep 23, 2011 at 07:09:04PM -0700, Franky Lin wrote:
> From: Roland Vossen <rvossen@broadcom.com>
> 
> Global variables are undesirable unless they are read only.
> 
> Reported-by: Johannes Berg <johannes@sipsolutions.net>
> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
> Reviewed-by: Arend van Spriel <arend@broadcom.com>
> Signed-off-by: Franky Lin <frankyl@broadcom.com>
> ---
> diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phytbl_lcn.c b/drivers/staging/brcm80211/brcmsmac/phy/phytbl_lcn.c
> index 15c5ffc..1b11b2f 100644
> --- a/drivers/staging/brcm80211/brcmsmac/phy/phytbl_lcn.c
> +++ b/drivers/staging/brcm80211/brcmsmac/phy/phytbl_lcn.c
> @@ -1611,7 +1611,7 @@ const u32 dot11lcnphytbl_rx_gain_info_sz_rev0 =
>  	sizeof(dot11lcnphytbl_rx_gain_info_rev0) /
>  	sizeof(dot11lcnphytbl_rx_gain_info_rev0[0]);
>  
> -static const u32 dot11lcnphytbl_rx_gain_info_sz_rev1 =
> +const u32 dot11lcnphytbl_rx_gain_info_sz_rev1 =
>  	sizeof(dot11lcnphytbl_rx_gain_info_rev1) /
>  	sizeof(dot11lcnphytbl_rx_gain_info_rev1[0]);

That seems like an anomaly. In a commit that is supposed
to declare variables as const, the linkage of a variable
changed. Likewise, the removal of extern global variable
declarations in phy_int.h also does not seem to belong
here.

-- 
Julian Andres Klode  - Debian Developer, Ubuntu Member

See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.

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

* Re: [PATCH 09/20] staging: brcm80211: use endian annotated structures in brcmsmac
  2011-09-24  2:08 ` [PATCH 09/20] staging: brcm80211: use endian annotated structures in brcmsmac Franky Lin
@ 2011-09-24 10:38   ` Johannes Berg
  2011-09-24 12:34     ` Arend van Spriel
  2011-09-26 21:06   ` Rafał Miłecki
  1 sibling, 1 reply; 35+ messages in thread
From: Johannes Berg @ 2011-09-24 10:38 UTC (permalink / raw)
  To: Franky Lin; +Cc: gregkh, devel, linux-wireless

On Fri, 2011-09-23 at 19:08 -0700, Franky Lin wrote:

>   * RxTSFTime: RxTSFTime time of first MAC symbol + M_PHY_PLCPRX_DLY
>   * RxChan: gain code, channel radio code, and phy type
>   */
> +struct d11rxhdr_le {
> +	__le16 RxFrameSize;
> +	u16 PAD;
> +	__le16 PhyRxStatus_0;
> +	__le16 PhyRxStatus_1;
> +	__le16 PhyRxStatus_2;
> +	__le16 PhyRxStatus_3;
> +	__le16 PhyRxStatus_4;
> +	__le16 PhyRxStatus_5;
> +	__le16 RxStatus1;
> +	__le16 RxStatus2;
> +	__le16 RxTSFTime;
> +	__le16 RxChan;
> +} __packed;
> +
>  struct d11rxhdr {
>  	u16 RxFrameSize;
>  	u16 PAD;

> +	union {
> +		struct d11rxhdr_le rxh_le;
> +		struct d11rxhdr rxh_cpu;
> +	};

This seems a little strange. Why would it be both in LE and CPU byte
order?

johannes


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

* Re: [PATCH 14/20] staging: brcm80211: remove dongle firmware related debug code
  2011-09-24  2:09 ` [PATCH 14/20] staging: brcm80211: remove dongle firmware related debug code Franky Lin
@ 2011-09-24 10:39   ` Johannes Berg
  2011-09-24 14:49     ` Arend van Spriel
  0 siblings, 1 reply; 35+ messages in thread
From: Johannes Berg @ 2011-09-24 10:39 UTC (permalink / raw)
  To: Franky Lin; +Cc: gregkh, devel, linux-wireless

On Fri, 2011-09-23 at 19:09 -0700, Franky Lin wrote:
> From: Arend van Spriel <arend@broadcom.com>
> 
> When the device dies the driver could extract cpu registers on
> the device to analyze the trap handling on the dongle. As the
> firmware with this driver is stable this code does not belong
> in the brcmfmac driver.
> 
> Reported-by: Johannes Berg <johannes@sipsolutions.net>

FWIW, when I said this looked strange I might have thought that it was
actually accessing the *host* registers. I don't remember exactly what I
said. If this is debug code for the dongle, then maybe it makes sense to
keep it, maybe optionally. I don't think you'll want to support a
separate driver just for debug. You could even use nl80211 testmode to
export it to userspace for your tools.

johannes


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

* Re: [PATCH 09/20] staging: brcm80211: use endian annotated structures in brcmsmac
  2011-09-24 10:38   ` Johannes Berg
@ 2011-09-24 12:34     ` Arend van Spriel
  2011-09-26  9:37       ` Johannes Berg
  0 siblings, 1 reply; 35+ messages in thread
From: Arend van Spriel @ 2011-09-24 12:34 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Franky (Zhenhui) Lin, gregkh, devel, linux-wireless

On 09/24/2011 12:38 PM, Johannes Berg wrote:
> On Fri, 2011-09-23 at 19:08 -0700, Franky Lin wrote:
>>   struct d11rxhdr {
>>   	u16 RxFrameSize;
>>   	u16 PAD;
>> +	union {
>> +		struct d11rxhdr_le rxh_le;
>> +		struct d11rxhdr rxh_cpu;
>> +	};
> This seems a little strange. Why would it be both in LE and CPU byte
> order?

Indeed. When we receive it from the device it is in LE and we convert it 
to CPU order for further processing using rxh_cpu.

> johannes

Gr. AvS



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

* Re: [PATCH 14/20] staging: brcm80211: remove dongle firmware related debug code
  2011-09-24 10:39   ` Johannes Berg
@ 2011-09-24 14:49     ` Arend van Spriel
  0 siblings, 0 replies; 35+ messages in thread
From: Arend van Spriel @ 2011-09-24 14:49 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Franky (Zhenhui) Lin, devel, gregkh, linux-wireless

On 09/24/2011 12:39 PM, Johannes Berg wrote:
> On Fri, 2011-09-23 at 19:09 -0700, Franky Lin wrote:
>> From: Arend van Spriel<arend@broadcom.com>
>>
>> When the device dies the driver could extract cpu registers on
>> the device to analyze the trap handling on the dongle. As the
>> firmware with this driver is stable this code does not belong
>> in the brcmfmac driver.
>>
>> Reported-by: Johannes Berg<johannes@sipsolutions.net>
> FWIW, when I said this looked strange I might have thought that it was
> actually accessing the *host* registers. I don't remember exactly what I
> said. If this is debug code for the dongle, then maybe it makes sense to
> keep it, maybe optionally. I don't think you'll want to support a
> separate driver just for debug. You could even use nl80211 testmode to
> export it to userspace for your tools.

Thanks, Johannes

Your comment was understood and merely a trigger for us to reconsider 
whether we would need it in this driver. As the mechanism has also not 
been tested in the brcmfmac driver and we consider the firmware stable, 
we decided to remove it.

Gr. AvS


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

* Re: [PATCH 09/20] staging: brcm80211: use endian annotated structures in brcmsmac
  2011-09-24 12:34     ` Arend van Spriel
@ 2011-09-26  9:37       ` Johannes Berg
  2011-09-26 18:26         ` Arend van Spriel
  0 siblings, 1 reply; 35+ messages in thread
From: Johannes Berg @ 2011-09-26  9:37 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: Franky (Zhenhui) Lin, gregkh, devel, linux-wireless

On Sat, 2011-09-24 at 14:34 +0200, Arend van Spriel wrote:
> On 09/24/2011 12:38 PM, Johannes Berg wrote:
> > On Fri, 2011-09-23 at 19:08 -0700, Franky Lin wrote:
> >>   struct d11rxhdr {
> >>   	u16 RxFrameSize;
> >>   	u16 PAD;
> >> +	union {
> >> +		struct d11rxhdr_le rxh_le;
> >> +		struct d11rxhdr rxh_cpu;
> >> +	};
> > This seems a little strange. Why would it be both in LE and CPU byte
> > order?
> 
> Indeed. When we receive it from the device it is in LE and we convert it 
> to CPU order for further processing using rxh_cpu.

That seems a confusing and error-prone -- you'll have to remember
whether you're before or after conversion. Would it be possible to have
two versions of the outer structure and change the pointer type at that
point?

johannes


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

* Re: [PATCH 09/20] staging: brcm80211: use endian annotated structures in brcmsmac
  2011-09-26  9:37       ` Johannes Berg
@ 2011-09-26 18:26         ` Arend van Spriel
  2011-09-26 19:17           ` Franky Lin
  0 siblings, 1 reply; 35+ messages in thread
From: Arend van Spriel @ 2011-09-26 18:26 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Franky (Zhenhui) Lin, gregkh, devel, linux-wireless

On 09/26/2011 11:37 AM, Johannes Berg wrote:
> On Sat, 2011-09-24 at 14:34 +0200, Arend van Spriel wrote:
>> On 09/24/2011 12:38 PM, Johannes Berg wrote:
>>> On Fri, 2011-09-23 at 19:08 -0700, Franky Lin wrote:
>>>>    struct d11rxhdr {
>>>>    	u16 RxFrameSize;
>>>>    	u16 PAD;
>>>> +	union {
>>>> +		struct d11rxhdr_le rxh_le;
>>>> +		struct d11rxhdr rxh_cpu;
>>>> +	};
>>> This seems a little strange. Why would it be both in LE and CPU byte
>>> order?
>> Indeed. When we receive it from the device it is in LE and we convert it
>> to CPU order for further processing using rxh_cpu.
> That seems a confusing and error-prone -- you'll have to remember
> whether you're before or after conversion. Would it be possible to have
> two versions of the outer structure and change the pointer type at that
> point?
>
> johannes

For me knowing the driver design (a little ;-) it is not difficult to 
remember. Your feedback has valid arguments so I will reconsider. Franky 
is looking whether dropping it will affect the other patches submitted 
to Greg.

Gr. AvS


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

* Re: [PATCH 08/20] staging: brcm80211: cleanup structure fields used for scanning
  2011-09-24  2:08 ` [PATCH 08/20] staging: brcm80211: cleanup structure fields used for scanning Franky Lin
@ 2011-09-26 19:07   ` Franky Lin
  0 siblings, 0 replies; 35+ messages in thread
From: Franky Lin @ 2011-09-26 19:07 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless

On 09/23/2011 07:08 PM, Franky Lin wrote:
> From: Arend van Spriel<arend@broadcom.com>
>
> In the structure brcmf_cfg80211_priv two fields were defined
> in which one was allocated and a second was referenced back to
> the first for no obvious reasons. Also the name was misleading
> giving the impression that the driver was maintaining a list of
> BSS entries like cfg80211 does.
>
> Reported-by: Johannes Berg<johannes@sipsolutions.net>
> Reviewed-by: Franky (Zhenhui) Lin<frankyl@broadcom.com>
> Reviewed-by: Roland Vossen<rvossen@broadcom.com>
> Reviewed-by: Pieter-Paul Giesberts<pieterpg@broadcom.com>
> Signed-off-by: Franky Lin<frankyl@broadcom.com>

Hi Greg,

Please drop this one. The rest of this series should still be fine 
without this one. We found out this patch introduced a bug to fullmac. 
Will fix it and resend in the future.

Thanks,
Franky


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

* Re: [PATCH 09/20] staging: brcm80211: use endian annotated structures in brcmsmac
  2011-09-26 18:26         ` Arend van Spriel
@ 2011-09-26 19:17           ` Franky Lin
  2011-09-26 23:50             ` Greg KH
  0 siblings, 1 reply; 35+ messages in thread
From: Franky Lin @ 2011-09-26 19:17 UTC (permalink / raw)
  To: Arend van Spriel, Johannes Berg; +Cc: gregkh, devel, linux-wireless

On 09/26/2011 11:26 AM, Arend van Spriel wrote:
> On 09/26/2011 11:37 AM, Johannes Berg wrote:
>> On Sat, 2011-09-24 at 14:34 +0200, Arend van Spriel wrote:
>>> On 09/24/2011 12:38 PM, Johannes Berg wrote:
>>>> On Fri, 2011-09-23 at 19:08 -0700, Franky Lin wrote:
>>>>>     struct d11rxhdr {
>>>>>     	u16 RxFrameSize;
>>>>>     	u16 PAD;
>>>>> +	union {
>>>>> +		struct d11rxhdr_le rxh_le;
>>>>> +		struct d11rxhdr rxh_cpu;
>>>>> +	};
>>>> This seems a little strange. Why would it be both in LE and CPU byte
>>>> order?
>>> Indeed. When we receive it from the device it is in LE and we convert it
>>> to CPU order for further processing using rxh_cpu.
>> That seems a confusing and error-prone -- you'll have to remember
>> whether you're before or after conversion. Would it be possible to have
>> two versions of the outer structure and change the pointer type at that
>> point?
>>
>> johannes
>
> For me knowing the driver design (a little ;-) it is not difficult to
> remember. Your feedback has valid arguments so I will reconsider. Franky
> is looking whether dropping it will affect the other patches submitted
> to Greg.
>
> Gr. AvS

Dropping this one will affect some following patches in the series. 
Since it's not a bug, shall we keep this one and change it as Johannes 
suggested in future commit?

Franky


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

* Re: [PATCH 09/20] staging: brcm80211: use endian annotated structures in brcmsmac
  2011-09-24  2:08 ` [PATCH 09/20] staging: brcm80211: use endian annotated structures in brcmsmac Franky Lin
  2011-09-24 10:38   ` Johannes Berg
@ 2011-09-26 21:06   ` Rafał Miłecki
  2011-09-27  9:54     ` Arend van Spriel
  1 sibling, 1 reply; 35+ messages in thread
From: Rafał Miłecki @ 2011-09-26 21:06 UTC (permalink / raw)
  To: Franky Lin; +Cc: gregkh, devel, linux-wireless

2011/9/24 Franky Lin <frankyl@broadcom.com>:
> @@ -1392,20 +1407,21 @@ struct d11rxhdr {
>        u16 RxStatus2;
>        u16 RxTSFTime;
>        u16 RxChan;
> -} __packed;
> +};

Is this on purpose? Is this safe?

-- 
Rafał

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

* Re: [PATCH 09/20] staging: brcm80211: use endian annotated structures in brcmsmac
  2011-09-26 19:17           ` Franky Lin
@ 2011-09-26 23:50             ` Greg KH
  2011-09-27  0:08               ` Franky Lin
  0 siblings, 1 reply; 35+ messages in thread
From: Greg KH @ 2011-09-26 23:50 UTC (permalink / raw)
  To: Franky Lin; +Cc: Arend van Spriel, Johannes Berg, devel, gregkh, linux-wireless

On Mon, Sep 26, 2011 at 12:17:53PM -0700, Franky Lin wrote:
> On 09/26/2011 11:26 AM, Arend van Spriel wrote:
> >On 09/26/2011 11:37 AM, Johannes Berg wrote:
> >>On Sat, 2011-09-24 at 14:34 +0200, Arend van Spriel wrote:
> >>>On 09/24/2011 12:38 PM, Johannes Berg wrote:
> >>>>On Fri, 2011-09-23 at 19:08 -0700, Franky Lin wrote:
> >>>>>    struct d11rxhdr {
> >>>>>    	u16 RxFrameSize;
> >>>>>    	u16 PAD;
> >>>>>+	union {
> >>>>>+		struct d11rxhdr_le rxh_le;
> >>>>>+		struct d11rxhdr rxh_cpu;
> >>>>>+	};
> >>>>This seems a little strange. Why would it be both in LE and CPU byte
> >>>>order?
> >>>Indeed. When we receive it from the device it is in LE and we convert it
> >>>to CPU order for further processing using rxh_cpu.
> >>That seems a confusing and error-prone -- you'll have to remember
> >>whether you're before or after conversion. Would it be possible to have
> >>two versions of the outer structure and change the pointer type at that
> >>point?
> >>
> >>johannes
> >
> >For me knowing the driver design (a little ;-) it is not difficult to
> >remember. Your feedback has valid arguments so I will reconsider. Franky
> >is looking whether dropping it will affect the other patches submitted
> >to Greg.
> >
> >Gr. AvS
> 
> Dropping this one will affect some following patches in the series.
> Since it's not a bug, shall we keep this one and change it as
> Johannes suggested in future commit?

How about just resend the whole series, that way I don't accidentally
apply it, or the other one you wanted dropped?

I've dropped this whole series from my to-apply queue now.

thanks,

greg k-h

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

* Re: [PATCH 09/20] staging: brcm80211: use endian annotated structures in brcmsmac
  2011-09-26 23:50             ` Greg KH
@ 2011-09-27  0:08               ` Franky Lin
  0 siblings, 0 replies; 35+ messages in thread
From: Franky Lin @ 2011-09-27  0:08 UTC (permalink / raw)
  To: Greg KH; +Cc: Arend Van Spriel, Johannes Berg, devel, gregkh, linux-wireless

On 09/26/2011 04:50 PM, Greg KH wrote:
> How about just resend the whole series, that way I don't accidentally
> apply it, or the other one you wanted dropped?
>
> I've dropped this whole series from my to-apply queue now.

Sure. Will resend after all issues are addressed.

Thanks,
Franky





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

* Re: Fwd: [PATCH 16/20] staging: brcm80211: declared global vars in softmac phy as const
       [not found]     ` <4E80B37C.4060106@broadcom.com>
@ 2011-09-27  7:52       ` Roland Vossen
  0 siblings, 0 replies; 35+ messages in thread
From: Roland Vossen @ 2011-09-27  7:52 UTC (permalink / raw)
  To: jak; +Cc: Franky (Zhenhui) Lin, gregkh, devel, linux-wireless

Hello Julian,

>> diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phytbl_lcn.c b/drivers/staging/brcm80211/brcmsmac/phy/phytbl_lcn.c
>> index 15c5ffc..1b11b2f 100644
>> --- a/drivers/staging/brcm80211/brcmsmac/phy/phytbl_lcn.c
>> +++ b/drivers/staging/brcm80211/brcmsmac/phy/phytbl_lcn.c
>> @@ -1611,7 +1611,7 @@ const u32 dot11lcnphytbl_rx_gain_info_sz_rev0 =
>>   	sizeof(dot11lcnphytbl_rx_gain_info_rev0) /
>>   	sizeof(dot11lcnphytbl_rx_gain_info_rev0[0]);
>>
>> -static const u32 dot11lcnphytbl_rx_gain_info_sz_rev1 =
>> +const u32 dot11lcnphytbl_rx_gain_info_sz_rev1 =
>>   	sizeof(dot11lcnphytbl_rx_gain_info_rev1) /
>>   	sizeof(dot11lcnphytbl_rx_gain_info_rev1[0]);
>
> That seems like an anomaly. In a commit that is supposed
> to declare variables as const, the linkage of a variable
> changed.

The name of this commit could have been better. It should have been 
'fixed sparse warnings on variable usage in softmac phy'. For what it is 
worth: this variable is deleted in a later commit.

> Likewise, the removal of extern global variable
> declarations in phy_int.h also does not seem to belong
> here.

Agree.

The whole patch series will be resent anyway, let me split this commit 
up in two to address your feedback.

Thanks, Roland.


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

* Re: [PATCH 09/20] staging: brcm80211: use endian annotated structures in brcmsmac
  2011-09-26 21:06   ` Rafał Miłecki
@ 2011-09-27  9:54     ` Arend van Spriel
  0 siblings, 0 replies; 35+ messages in thread
From: Arend van Spriel @ 2011-09-27  9:54 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Franky (Zhenhui) Lin, devel, gregkh, linux-wireless

On 09/26/2011 11:06 PM, Rafał Miłecki wrote:
> 2011/9/24 Franky Lin<frankyl@broadcom.com>:
>> @@ -1392,20 +1407,21 @@ struct d11rxhdr {
>>         u16 RxStatus2;
>>         u16 RxTSFTime;
>>         u16 RxChan;
>> -} __packed;
>> +};
> Is this on purpose? Is this safe?

Hi Rafał,

This is indeed on purpose as this structure is aligned (no gaps) 
properly because the members are all u16 and not going over the host 
bus. However, it is used in a union with the little-endian version which 
is packed. Based on feedback regarding that union this patch needs some 
rework so it will be resend.

Gr. AvS


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

end of thread, other threads:[~2011-09-27  9:54 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-24  2:08 [PATCH 00/20] staging: brcm80211: 8th reaction for mainline patch #2 Franky Lin
2011-09-24  2:08 ` [PATCH 01/20] staging: brcm80211: remove uncoditional code blocks from brcmsmac Franky Lin
2011-09-24  2:08 ` [PATCH 02/20] staging: brcm80211: removed unused argument from softmac functions Franky Lin
2011-09-24  2:08 ` [PATCH 03/20] staging: brcm80211: deleted unused array of bss configurations in softmac Franky Lin
2011-09-24  2:08 ` [PATCH 04/20] staging: brcm80211: removed redundant wlc->cfg struct member Franky Lin
2011-09-24  2:08 ` [PATCH 05/20] staging: brcm80211: removed global var from aiutils.c Franky Lin
2011-09-24  2:08 ` [PATCH 06/20] staging: brcm80211: removed global vars in softmac ucode handling Franky Lin
2011-09-24  2:08 ` [PATCH 07/20] staging: brcm80211: removed unused softmac workaround Franky Lin
2011-09-24  2:08 ` [PATCH 08/20] staging: brcm80211: cleanup structure fields used for scanning Franky Lin
2011-09-26 19:07   ` Franky Lin
2011-09-24  2:08 ` [PATCH 09/20] staging: brcm80211: use endian annotated structures in brcmsmac Franky Lin
2011-09-24 10:38   ` Johannes Berg
2011-09-24 12:34     ` Arend van Spriel
2011-09-26  9:37       ` Johannes Berg
2011-09-26 18:26         ` Arend van Spriel
2011-09-26 19:17           ` Franky Lin
2011-09-26 23:50             ` Greg KH
2011-09-27  0:08               ` Franky Lin
2011-09-26 21:06   ` Rafał Miłecki
2011-09-27  9:54     ` Arend van Spriel
2011-09-24  2:08 ` [PATCH 10/20] staging: brcm80211: remove ht_cap field from brcms_c_info structure Franky Lin
2011-09-24  2:08 ` [PATCH 11/20] staging: brcm80211: use fragment number provided in transmit frame Franky Lin
2011-09-24  2:09 ` [PATCH 12/20] staging: brcm80211: remove unused function si_pmu_ilp_clock() Franky Lin
2011-09-24  2:09 ` [PATCH 13/20] staging: brcm80211: make device initializer table for wme constant Franky Lin
2011-09-24  2:09 ` [PATCH 14/20] staging: brcm80211: remove dongle firmware related debug code Franky Lin
2011-09-24 10:39   ` Johannes Berg
2011-09-24 14:49     ` Arend van Spriel
2011-09-24  2:09 ` [PATCH 15/20] staging: brcm80211: remove unnecessary mac80211 callbacks Franky Lin
2011-09-24  2:09 ` [PATCH 16/20] staging: brcm80211: declared global vars in softmac phy as const Franky Lin
2011-09-24  9:52   ` Julian Andres Klode
     [not found]     ` <4E80B37C.4060106@broadcom.com>
2011-09-27  7:52       ` Fwd: " Roland Vossen
2011-09-24  2:09 ` [PATCH 17/20] staging: brcm80211: removed band related global vars from softmac Franky Lin
2011-09-24  2:09 ` [PATCH 18/20] staging: brcm80211: removed global var global_scb " Franky Lin
2011-09-24  2:09 ` [PATCH 19/20] staging: brcm80211: various global var related changes in softmac Franky Lin
2011-09-24  2:09 ` [PATCH 20/20] staging: brcm80211: removed global variable in softmac otp Franky Lin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.