Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH 05/15] staging: brcm80211: change parameter in driver variable lookup
From: Arend van Spriel @ 2011-10-05 13:20 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel
In-Reply-To: <1317820814-7083-1-git-send-email-arend@broadcom.com>

The functions getvar() and getintvar() had to pass the buffer
containing the driver variables. Now they pass the structure
containing this buffer hiding what type of buffer/container
is used for storing the driver variables.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Alwin Beukers <alwin@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/aiutils.c     |   18 +-
 drivers/staging/brcm80211/brcmsmac/antsel.c      |   15 +-
 drivers/staging/brcm80211/brcmsmac/channel.c     |    2 +-
 drivers/staging/brcm80211/brcmsmac/main.c        |   29 ++--
 drivers/staging/brcm80211/brcmsmac/nicpci.c      |    4 +-
 drivers/staging/brcm80211/brcmsmac/nicpci.h      |    2 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c |   62 +++----
 drivers/staging/brcm80211/brcmsmac/phy/phy_n.c   |  223 +++++++++++-----------
 drivers/staging/brcm80211/brcmsmac/phy_shim.c    |    8 +-
 drivers/staging/brcm80211/brcmsmac/phy_shim.h    |    4 +-
 drivers/staging/brcm80211/brcmsmac/pub.h         |    4 +-
 drivers/staging/brcm80211/brcmsmac/srom.c        |   11 +-
 drivers/staging/brcm80211/brcmsmac/stf.c         |    4 +-
 13 files changed, 190 insertions(+), 196 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/aiutils.c b/drivers/staging/brcm80211/brcmsmac/aiutils.c
index 8d4024e..d44f619 100644
--- a/drivers/staging/brcm80211/brcmsmac/aiutils.c
+++ b/drivers/staging/brcm80211/brcmsmac/aiutils.c
@@ -1012,7 +1012,7 @@ ai_buscore_setup(struct si_info *sii, u32 savewin, uint *origidx)
 /*
  * get boardtype and boardrev
  */
-static __used void ai_nvram_process(struct si_info *sii, char *pvars)
+static __used void ai_nvram_process(struct si_info *sii)
 {
 	uint w = 0;
 
@@ -1021,7 +1021,7 @@ static __used void ai_nvram_process(struct si_info *sii, char *pvars)
 
 	sii->pub.boardvendor = w & 0xffff;
 	sii->pub.boardtype = (w >> 16) & 0xffff;
-	sii->pub.boardflags = getintvar(pvars, "boardflags");
+	sii->pub.boardflags = getintvar(&sii->pub, "boardflags");
 }
 
 static struct si_info *ai_doattach(struct si_info *sii,
@@ -1031,7 +1031,6 @@ static struct si_info *ai_doattach(struct si_info *sii,
 	struct si_pub *sih = &sii->pub;
 	u32 w, savewin;
 	struct chipcregs __iomem *cc;
-	char *pvars = NULL;
 	uint socitype;
 	uint origidx;
 
@@ -1095,8 +1094,9 @@ static struct si_info *ai_doattach(struct si_info *sii,
 	if (srom_var_init(&sii->pub, cc, vars, varsz))
 		goto exit;
 
-	pvars = vars ? *vars : NULL;
-	ai_nvram_process(sii, pvars);
+	sii->vars = vars ? *vars : NULL;
+	sii->varsz = varsz ? *varsz : 0;
+	ai_nvram_process(sii);
 
 	/* === NVRAM, clock is ready === */
 	cc = (struct chipcregs __iomem *) ai_setcore(sih, CC_CORE_ID, 0);
@@ -1109,7 +1109,7 @@ static struct si_info *ai_doattach(struct si_info *sii,
 		u32 xtalfreq;
 		si_pmu_init(sih);
 		si_pmu_chip_init(sih);
-		xtalfreq = getintvar(pvars, "xtalfreq");
+		xtalfreq = getintvar(sih, "xtalfreq");
 		/* If xtalfreq var not available, try to measure it */
 		if (xtalfreq == 0)
 			xtalfreq = si_pmu_measure_alpclk(sih);
@@ -1119,14 +1119,14 @@ static struct si_info *ai_doattach(struct si_info *sii,
 	}
 
 	/* setup the GPIO based LED powersave register */
-	w = getintvar(pvars, "leddc");
+	w = getintvar(sih, "leddc");
 	if (w == 0)
 		w = DEFAULT_GPIOTIMERVAL;
 	ai_corereg(sih, SI_CC_IDX, offsetof(struct chipcregs, gpiotimerval),
 		   ~0, w);
 
 	if (PCIE(sii))
-		pcicore_attach(sii->pch, pvars, SI_DOATTACH);
+		pcicore_attach(sii->pch, SI_DOATTACH);
 
 	if (sih->chip == BCM43224_CHIP_ID) {
 		/*
@@ -1191,8 +1191,6 @@ ai_attach(void __iomem *regs, struct pci_dev *sdh, char **vars, uint *varsz)
 		kfree(sii);
 		return NULL;
 	}
-	sii->vars = vars ? *vars : NULL;
-	sii->varsz = varsz ? *varsz : 0;
 
 	return (struct si_pub *) sii;
 }
diff --git a/drivers/staging/brcm80211/brcmsmac/antsel.c b/drivers/staging/brcm80211/brcmsmac/antsel.c
index c2aa47b..eedcdb6 100644
--- a/drivers/staging/brcm80211/brcmsmac/antsel.c
+++ b/drivers/staging/brcm80211/brcmsmac/antsel.c
@@ -108,6 +108,7 @@ brcms_c_antsel_init_cfg(struct antsel_info *asi, struct brcms_antselcfg *antsel,
 struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc)
 {
 	struct antsel_info *asi;
+	struct si_pub *sih = wlc->hw->sih;
 
 	asi = kzalloc(sizeof(struct antsel_info), GFP_ATOMIC);
 	if (!asi)
@@ -117,7 +118,7 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc)
 	asi->pub = wlc->pub;
 	asi->antsel_type = ANTSEL_NA;
 	asi->antsel_avail = false;
-	asi->antsel_antswitch = (u8) getintvar(asi->pub->vars, "antswitch");
+	asi->antsel_antswitch = (u8) getintvar(sih, "antswitch");
 
 	if ((asi->pub->sromrev >= 4) && (asi->antsel_antswitch != 0)) {
 		switch (asi->antsel_antswitch) {
@@ -127,12 +128,12 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc)
 			/* 4321/2 board with 2x3 switch logic */
 			asi->antsel_type = ANTSEL_2x3;
 			/* Antenna selection availability */
-			if (((u16) getintvar(asi->pub->vars, "aa2g") == 7) ||
-			    ((u16) getintvar(asi->pub->vars, "aa5g") == 7)) {
+			if (((u16) getintvar(sih, "aa2g") == 7) ||
+			    ((u16) getintvar(sih, "aa5g") == 7)) {
 				asi->antsel_avail = true;
 			} else if (
-				(u16) getintvar(asi->pub->vars, "aa2g") == 3 ||
-				(u16) getintvar(asi->pub->vars, "aa5g") == 3) {
+				(u16) getintvar(sih, "aa2g") == 3 ||
+				(u16) getintvar(sih, "aa5g") == 3) {
 				asi->antsel_avail = false;
 			} else {
 				asi->antsel_avail = false;
@@ -145,8 +146,8 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc)
 			break;
 		}
 	} else if ((asi->pub->sromrev == 4) &&
-		   ((u16) getintvar(asi->pub->vars, "aa2g") == 7) &&
-		   ((u16) getintvar(asi->pub->vars, "aa5g") == 0)) {
+		   ((u16) getintvar(sih, "aa2g") == 7) &&
+		   ((u16) getintvar(sih, "aa5g") == 0)) {
 		/* hack to match old 4321CB2 cards with 2of3 antenna switch */
 		asi->antsel_type = ANTSEL_2x3;
 		asi->antsel_avail = true;
diff --git a/drivers/staging/brcm80211/brcmsmac/channel.c b/drivers/staging/brcm80211/brcmsmac/channel.c
index 2127c27..53066fb 100644
--- a/drivers/staging/brcm80211/brcmsmac/channel.c
+++ b/drivers/staging/brcm80211/brcmsmac/channel.c
@@ -1088,7 +1088,7 @@ struct brcms_cm_info *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc)
 	wlc->cmi = wlc_cm;
 
 	/* store the country code for passing up as a regulatory hint */
-	ccode = getvar(wlc->pub->vars, "ccode");
+	ccode = getvar(wlc->hw->sih, "ccode");
 	if (ccode)
 		strncpy(wlc->pub->srom_ccode, ccode, BRCM_CNTRY_BUF_SZ - 1);
 
diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 100e6ec..f2339a5 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -1990,7 +1990,7 @@ static char *brcms_c_get_macaddr(struct brcms_hardware *wlc_hw)
 	char *macaddr;
 
 	/* If macaddr exists, use it (Sromrev4, CIS, ...). */
-	macaddr = getvar(wlc_hw->vars, varname);
+	macaddr = getvar(wlc_hw->sih, varname);
 	if (macaddr != NULL)
 		return macaddr;
 
@@ -1999,7 +1999,7 @@ static char *brcms_c_get_macaddr(struct brcms_hardware *wlc_hw)
 	else
 		varname = "il0macaddr";
 
-	macaddr = getvar(wlc_hw->vars, varname);
+	macaddr = getvar(wlc_hw->sih, varname);
 	if (macaddr == NULL)
 		wiphy_err(wlc_hw->wlc->wiphy, "wl%d: wlc_get_macaddr: macaddr "
 			  "getvar(%s) not found\n", wlc_hw->unit, varname);
@@ -4593,13 +4593,13 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,
 	 * than those the BIOS recognizes for devices on PCMCIA_BUS,
 	 * SDIO_BUS, and SROMless devices on PCI_BUS.
 	 */
-	var = getvar(vars, "vendid");
+	var = getvar(wlc_hw->sih, "vendid");
 	if (var && !kstrtoul(var, 0, &res)) {
 		vendor = (u16)res;
 		wiphy_err(wiphy, "Overriding vendor id = 0x%x\n",
 			  vendor);
 	}
-	var = getvar(vars, "devid");
+	var = getvar(wlc_hw->sih, "devid");
 	if (var && !kstrtoul(var, 0, &res)) {
 		u16 devid = (u16)res;
 		if (devid != 0xffff) {
@@ -4656,7 +4656,7 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,
 	}
 
 	/* get the board rev, used just below */
-	j = getintvar(vars, "boardrev");
+	j = getintvar(wlc_hw->sih, "boardrev");
 	/* promote srom boardrev of 0xFF to 1 */
 	if (j == BOARDREV_PROMOTABLE)
 		j = BOARDREV_PROMOTED;
@@ -4668,9 +4668,9 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,
 		err = 15;
 		goto fail;
 	}
-	wlc_hw->sromrev = (u8) getintvar(vars, "sromrev");
-	wlc_hw->boardflags = (u32) getintvar(vars, "boardflags");
-	wlc_hw->boardflags2 = (u32) getintvar(vars, "boardflags2");
+	wlc_hw->sromrev = (u8) getintvar(wlc_hw->sih, "sromrev");
+	wlc_hw->boardflags = (u32) getintvar(wlc_hw->sih, "boardflags");
+	wlc_hw->boardflags2 = (u32) getintvar(wlc_hw->sih, "boardflags2");
 
 	if (wlc_hw->boardflags & BFL_NOPLLDOWN)
 		brcms_b_pllreq(wlc_hw, true, BRCMS_PLLREQ_SHARED);
@@ -4920,15 +4920,16 @@ static bool brcms_c_attach_stf_ant_init(struct brcms_c_info *wlc)
 	uint unit;
 	char *vars;
 	int bandtype;
+	struct si_pub *sih = wlc->hw->sih;
 
 	unit = wlc->pub->unit;
 	vars = wlc->pub->vars;
 	bandtype = wlc->band->bandtype;
 
 	/* get antennas available */
-	aa = (s8) getintvar(vars, bandtype == BRCM_BAND_5G ? "aa5g" : "aa2g");
+	aa = (s8) getintvar(sih, bandtype == BRCM_BAND_5G ? "aa5g" : "aa2g");
 	if (aa == 0)
-		aa = (s8) getintvar(vars,
+		aa = (s8) getintvar(sih,
 				    bandtype == BRCM_BAND_5G ? "aa1" : "aa0");
 	if ((aa < 1) || (aa > 15)) {
 		wiphy_err(wlc->wiphy, "wl%d: %s: Invalid antennas available in"
@@ -4947,8 +4948,8 @@ static bool brcms_c_attach_stf_ant_init(struct brcms_c_info *wlc)
 	}
 
 	/* Compute Antenna Gain */
-	wlc->band->antgain =
-	    (s8) getintvar(vars, bandtype == BRCM_BAND_5G ? "ag1" : "ag0");
+	wlc->band->antgain = (s8) getintvar(sih, bandtype == BRCM_BAND_5G ?
+					    "ag1" : "ag0");
 	brcms_c_attach_antgain_init(wlc);
 
 	return true;
@@ -5114,9 +5115,9 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
 
 	/* set maximum allowed duty cycle */
 	wlc->tx_duty_cycle_ofdm =
-	    (u16) getintvar(pub->vars, "tx_duty_cycle_ofdm");
+	    (u16) getintvar(wlc->hw->sih, "tx_duty_cycle_ofdm");
 	wlc->tx_duty_cycle_cck =
-	    (u16) getintvar(pub->vars, "tx_duty_cycle_cck");
+	    (u16) getintvar(wlc->hw->sih, "tx_duty_cycle_cck");
 
 	brcms_c_stf_phy_chain_calc(wlc);
 
diff --git a/drivers/staging/brcm80211/brcmsmac/nicpci.c b/drivers/staging/brcm80211/brcmsmac/nicpci.c
index 460b105..57721a0 100644
--- a/drivers/staging/brcm80211/brcmsmac/nicpci.c
+++ b/drivers/staging/brcm80211/brcmsmac/nicpci.c
@@ -719,13 +719,13 @@ static void pcie_war_pci_setup(struct pcicore_info *pi)
 }
 
 /* ***** Functions called during driver state changes ***** */
-void pcicore_attach(struct pcicore_info *pi, char *pvars, int state)
+void pcicore_attach(struct pcicore_info *pi, int state)
 {
 	struct si_pub *sih = pi->sih;
 
 	/* Determine if this board needs override */
 	if (PCIE_ASPM(sih)) {
-		if ((u32)getintvar(pvars, "boardflags2") & BFL2_PCIEWAR_OVR)
+		if ((u32)getintvar(sih, "boardflags2") & BFL2_PCIEWAR_OVR)
 			pi->pcie_war_aspm_ovr = PCIE_ASPM_DISAB;
 		else
 			pi->pcie_war_aspm_ovr = PCIE_ASPM_ENAB;
diff --git a/drivers/staging/brcm80211/brcmsmac/nicpci.h b/drivers/staging/brcm80211/brcmsmac/nicpci.h
index 2d41aab..58aa80d 100644
--- a/drivers/staging/brcm80211/brcmsmac/nicpci.h
+++ b/drivers/staging/brcm80211/brcmsmac/nicpci.h
@@ -65,7 +65,7 @@ extern struct pcicore_info *pcicore_init(struct si_pub *sih,
 					 struct pci_dev *pdev,
 					 void __iomem *regs);
 extern void pcicore_deinit(struct pcicore_info *pch);
-extern void pcicore_attach(struct pcicore_info *pch, char *pvars, int state);
+extern void pcicore_attach(struct pcicore_info *pch, int state);
 extern void pcicore_hwup(struct pcicore_info *pch);
 extern void pcicore_up(struct pcicore_info *pch, int state);
 extern void pcicore_sleep(struct pcicore_info *pch);
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c
index dbeeeba..d84e1cf 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c
@@ -4817,27 +4817,25 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
 	s8 txpwr = 0;
 	int i;
 	struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy;
+	struct phy_shim_info *shim = pi->sh->physhim;
 
 	if (CHSPEC_IS2G(pi->radio_chanspec)) {
 		u16 cckpo = 0;
 		u32 offset_ofdm, offset_mcs;
 
 		pi_lcn->lcnphy_tr_isolation_mid =
-			(u8) wlapi_getintvar(pi->vars, "triso2g");
+			(u8)wlapi_getintvar(shim, "triso2g");
 
 		pi_lcn->lcnphy_rx_power_offset =
-			(u8) wlapi_getintvar(pi->vars, "rxpo2g");
+			(u8)wlapi_getintvar(shim, "rxpo2g");
 
-		pi->txpa_2g[0] = (s16) wlapi_getintvar(pi->vars, "pa0b0");
-		pi->txpa_2g[1] = (s16) wlapi_getintvar(pi->vars, "pa0b1");
-		pi->txpa_2g[2] = (s16) wlapi_getintvar(pi->vars, "pa0b2");
+		pi->txpa_2g[0] = (s16)wlapi_getintvar(shim, "pa0b0");
+		pi->txpa_2g[1] = (s16)wlapi_getintvar(shim, "pa0b1");
+		pi->txpa_2g[2] = (s16)wlapi_getintvar(shim, "pa0b2");
 
-		pi_lcn->lcnphy_rssi_vf =
-				(u8) wlapi_getintvar(pi->vars, "rssismf2g");
-		pi_lcn->lcnphy_rssi_vc =
-				(u8) wlapi_getintvar(pi->vars, "rssismc2g");
-		pi_lcn->lcnphy_rssi_gs =
-				(u8) wlapi_getintvar(pi->vars, "rssisav2g");
+		pi_lcn->lcnphy_rssi_vf = (u8)wlapi_getintvar(shim, "rssismf2g");
+		pi_lcn->lcnphy_rssi_vc = (u8)wlapi_getintvar(shim, "rssismc2g");
+		pi_lcn->lcnphy_rssi_gs = (u8)wlapi_getintvar(shim, "rssisav2g");
 
 		pi_lcn->lcnphy_rssi_vf_lowtemp = pi_lcn->lcnphy_rssi_vf;
 		pi_lcn->lcnphy_rssi_vc_lowtemp = pi_lcn->lcnphy_rssi_vc;
@@ -4847,7 +4845,7 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
 		pi_lcn->lcnphy_rssi_vc_hightemp = pi_lcn->lcnphy_rssi_vc;
 		pi_lcn->lcnphy_rssi_gs_hightemp = pi_lcn->lcnphy_rssi_gs;
 
-		txpwr = (s8) wlapi_getintvar(pi->vars, "maxp2ga0");
+		txpwr = (s8)wlapi_getintvar(shim, "maxp2ga0");
 		pi->tx_srom_max_2g = txpwr;
 
 		for (i = 0; i < PWRTBL_NUM_COEFF; i++) {
@@ -4855,7 +4853,7 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
 			pi->txpa_2g_high_temp[i] = pi->txpa_2g[i];
 		}
 
-		cckpo = (u16) wlapi_getintvar(pi->vars, "cck2gpo");
+		cckpo = (u16)wlapi_getintvar(shim, "cck2gpo");
 		if (cckpo) {
 			uint max_pwr_chan = txpwr;
 
@@ -4865,8 +4863,7 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
 				cckpo >>= 4;
 			}
 
-			offset_ofdm =
-				(u32) wlapi_getintvar(pi->vars, "ofdm2gpo");
+			offset_ofdm = (u32)wlapi_getintvar(shim, "ofdm2gpo");
 			for (i = TXP_FIRST_OFDM; i <= TXP_LAST_OFDM; i++) {
 				pi->tx_srom_max_rate_2g[i] =
 					max_pwr_chan -
@@ -4876,13 +4873,12 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
 		} else {
 			u8 opo = 0;
 
-			opo = (u8) wlapi_getintvar(pi->vars, "opo");
+			opo = (u8)wlapi_getintvar(shim, "opo");
 
 			for (i = TXP_FIRST_CCK; i <= TXP_LAST_CCK; i++)
 				pi->tx_srom_max_rate_2g[i] = txpwr;
 
-			offset_ofdm =
-				(u32) wlapi_getintvar(pi->vars, "ofdm2gpo");
+			offset_ofdm = (u32)wlapi_getintvar(shim, "ofdm2gpo");
 
 			for (i = TXP_FIRST_OFDM; i <= TXP_LAST_OFDM; i++) {
 				pi->tx_srom_max_rate_2g[i] = txpwr -
@@ -4890,9 +4886,9 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
 				offset_ofdm >>= 4;
 			}
 			offset_mcs =
-				wlapi_getintvar(pi->vars, "mcs2gpo1") << 16;
+				wlapi_getintvar(shim, "mcs2gpo1") << 16;
 			offset_mcs |=
-				(u16) wlapi_getintvar(pi->vars, "mcs2gpo0");
+				(u16) wlapi_getintvar(shim, "mcs2gpo0");
 			pi_lcn->lcnphy_mcs20_po = offset_mcs;
 			for (i = TXP_FIRST_SISO_MCS_20;
 			     i <= TXP_LAST_SISO_MCS_20; i++) {
@@ -4903,30 +4899,30 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
 		}
 
 		pi_lcn->lcnphy_rawtempsense =
-			(u16) wlapi_getintvar(pi->vars, "rawtempsense");
+			(u16)wlapi_getintvar(shim, "rawtempsense");
 		pi_lcn->lcnphy_measPower =
-			(u8) wlapi_getintvar(pi->vars, "measpower");
+			(u8)wlapi_getintvar(shim, "measpower");
 		pi_lcn->lcnphy_tempsense_slope =
-			(u8) wlapi_getintvar(pi->vars, "tempsense_slope");
+			(u8)wlapi_getintvar(shim, "tempsense_slope");
 		pi_lcn->lcnphy_hw_iqcal_en =
-			(bool) wlapi_getintvar(pi->vars, "hw_iqcal_en");
+			(bool)wlapi_getintvar(shim, "hw_iqcal_en");
 		pi_lcn->lcnphy_iqcal_swp_dis =
-			(bool) wlapi_getintvar(pi->vars, "iqcal_swp_dis");
+			(bool)wlapi_getintvar(shim, "iqcal_swp_dis");
 		pi_lcn->lcnphy_tempcorrx =
-			(u8) wlapi_getintvar(pi->vars, "tempcorrx");
+			(u8)wlapi_getintvar(shim, "tempcorrx");
 		pi_lcn->lcnphy_tempsense_option =
-			(u8) wlapi_getintvar(pi->vars, "tempsense_option");
+			(u8)wlapi_getintvar(shim, "tempsense_option");
 		pi_lcn->lcnphy_freqoffset_corr =
-			(u8) wlapi_getintvar(pi->vars, "freqoffset_corr");
-		if ((u8) getintvar(pi->vars, "aa2g") > 1)
+			(u8)wlapi_getintvar(shim, "freqoffset_corr");
+		if ((u8)wlapi_getintvar(shim, "aa2g") > 1)
 			wlc_phy_ant_rxdiv_set((struct brcms_phy_pub *) pi,
-					      (u8) getintvar(pi->vars,
-							     "aa2g"));
+					      (u8) wlapi_getintvar(shim,
+								   "aa2g"));
 	}
 	pi_lcn->lcnphy_cck_dig_filt_type = -1;
-	if (wlapi_getvar(pi->vars, "cckdigfilttype")) {
+	if (wlapi_getvar(shim, "cckdigfilttype")) {
 		s16 temp;
-		temp = (s16) wlapi_getintvar(pi->vars, "cckdigfilttype");
+		temp = (s16)wlapi_getintvar(shim, "cckdigfilttype");
 		if (temp >= 0)
 			pi_lcn->lcnphy_cck_dig_filt_type = temp;
 	}
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c
index c410bf0..a4417e9 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c
@@ -14383,29 +14383,30 @@ static void wlc_phy_txpwr_srom_read_ppr_nphy(struct brcms_phy *pi)
 {
 	u16 bw40po, cddpo, stbcpo, bwduppo;
 	uint band_num;
+	struct phy_shim_info *shim = pi->sh->physhim;
 
 	if (pi->sh->sromrev >= 9)
 		return;
 
-	bw40po = (u16) wlapi_getintvar(pi->vars, "bw40po");
+	bw40po = (u16) wlapi_getintvar(shim, "bw40po");
 	pi->bw402gpo = bw40po & 0xf;
 	pi->bw405gpo = (bw40po & 0xf0) >> 4;
 	pi->bw405glpo = (bw40po & 0xf00) >> 8;
 	pi->bw405ghpo = (bw40po & 0xf000) >> 12;
 
-	cddpo = (u16) wlapi_getintvar(pi->vars, "cddpo");
+	cddpo = (u16) wlapi_getintvar(shim, "cddpo");
 	pi->cdd2gpo = cddpo & 0xf;
 	pi->cdd5gpo = (cddpo & 0xf0) >> 4;
 	pi->cdd5glpo = (cddpo & 0xf00) >> 8;
 	pi->cdd5ghpo = (cddpo & 0xf000) >> 12;
 
-	stbcpo = (u16) wlapi_getintvar(pi->vars, "stbcpo");
+	stbcpo = (u16) wlapi_getintvar(shim, "stbcpo");
 	pi->stbc2gpo = stbcpo & 0xf;
 	pi->stbc5gpo = (stbcpo & 0xf0) >> 4;
 	pi->stbc5glpo = (stbcpo & 0xf00) >> 8;
 	pi->stbc5ghpo = (stbcpo & 0xf000) >> 12;
 
-	bwduppo = (u16) wlapi_getintvar(pi->vars, "bwduppo");
+	bwduppo = (u16) wlapi_getintvar(shim, "bwduppo");
 	pi->bwdup2gpo = bwduppo & 0xf;
 	pi->bwdup5gpo = (bwduppo & 0xf0) >> 4;
 	pi->bwdup5glpo = (bwduppo & 0xf00) >> 8;
@@ -14417,188 +14418,186 @@ static void wlc_phy_txpwr_srom_read_ppr_nphy(struct brcms_phy *pi)
 		case 0:
 
 			pi->nphy_txpid2g[PHY_CORE_0] =
-				(u8) wlapi_getintvar(pi->vars, "txpid2ga0");
+				(u8) wlapi_getintvar(shim, "txpid2ga0");
 			pi->nphy_txpid2g[PHY_CORE_1] =
-				(u8) wlapi_getintvar(pi->vars, "txpid2ga1");
+				(u8) wlapi_getintvar(shim, "txpid2ga1");
 			pi->nphy_pwrctrl_info[PHY_CORE_0].max_pwr_2g =
-				(s8) wlapi_getintvar(pi->vars, "maxp2ga0");
+				(s8) wlapi_getintvar(shim, "maxp2ga0");
 			pi->nphy_pwrctrl_info[PHY_CORE_1].max_pwr_2g =
-				(s8) wlapi_getintvar(pi->vars, "maxp2ga1");
+				(s8) wlapi_getintvar(shim, "maxp2ga1");
 			pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_2g_a1 =
-				(s16) wlapi_getintvar(pi->vars, "pa2gw0a0");
+				(s16) wlapi_getintvar(shim, "pa2gw0a0");
 			pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_2g_a1 =
-				(s16) wlapi_getintvar(pi->vars, "pa2gw0a1");
+				(s16) wlapi_getintvar(shim, "pa2gw0a1");
 			pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_2g_b0 =
-				(s16) wlapi_getintvar(pi->vars, "pa2gw1a0");
+				(s16) wlapi_getintvar(shim, "pa2gw1a0");
 			pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_2g_b0 =
-				(s16) wlapi_getintvar(pi->vars, "pa2gw1a1");
+				(s16) wlapi_getintvar(shim, "pa2gw1a1");
 			pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_2g_b1 =
-				(s16) wlapi_getintvar(pi->vars, "pa2gw2a0");
+				(s16) wlapi_getintvar(shim, "pa2gw2a0");
 			pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_2g_b1 =
-				(s16) wlapi_getintvar(pi->vars, "pa2gw2a1");
+				(s16) wlapi_getintvar(shim, "pa2gw2a1");
 			pi->nphy_pwrctrl_info[PHY_CORE_0].idle_targ_2g =
-				(s8) wlapi_getintvar(pi->vars, "itt2ga0");
+				(s8) wlapi_getintvar(shim, "itt2ga0");
 			pi->nphy_pwrctrl_info[PHY_CORE_1].idle_targ_2g =
-				(s8) wlapi_getintvar(pi->vars, "itt2ga1");
+				(s8) wlapi_getintvar(shim, "itt2ga1");
 
-			pi->cck2gpo =
-				(u16) wlapi_getintvar(pi->vars, "cck2gpo");
-			pi->ofdm2gpo =
-				(u32) wlapi_getintvar(pi->vars, "ofdm2gpo");
+			pi->cck2gpo = (u16) wlapi_getintvar(shim, "cck2gpo");
+
+			pi->ofdm2gpo = (u32) wlapi_getintvar(shim, "ofdm2gpo");
 
 			pi->mcs2gpo[0] =
-				(u16) wlapi_getintvar(pi->vars, "mcs2gpo0");
+				(u16) wlapi_getintvar(shim, "mcs2gpo0");
 			pi->mcs2gpo[1] =
-				(u16) wlapi_getintvar(pi->vars, "mcs2gpo1");
+				(u16) wlapi_getintvar(shim, "mcs2gpo1");
 			pi->mcs2gpo[2] =
-				(u16) wlapi_getintvar(pi->vars, "mcs2gpo2");
+				(u16) wlapi_getintvar(shim, "mcs2gpo2");
 			pi->mcs2gpo[3] =
-				(u16) wlapi_getintvar(pi->vars, "mcs2gpo3");
+				(u16) wlapi_getintvar(shim, "mcs2gpo3");
 			pi->mcs2gpo[4] =
-				(u16) wlapi_getintvar(pi->vars, "mcs2gpo4");
+				(u16) wlapi_getintvar(shim, "mcs2gpo4");
 			pi->mcs2gpo[5] =
-				(u16) wlapi_getintvar(pi->vars, "mcs2gpo5");
+				(u16) wlapi_getintvar(shim, "mcs2gpo5");
 			pi->mcs2gpo[6] =
-				(u16) wlapi_getintvar(pi->vars, "mcs2gpo6");
+				(u16) wlapi_getintvar(shim, "mcs2gpo6");
 			pi->mcs2gpo[7] =
-				(u16) wlapi_getintvar(pi->vars, "mcs2gpo7");
+				(u16) wlapi_getintvar(shim, "mcs2gpo7");
 			break;
 		case 1:
 
 			pi->nphy_txpid5g[PHY_CORE_0] =
-				(u8) wlapi_getintvar(pi->vars, "txpid5ga0");
+				(u8) wlapi_getintvar(shim, "txpid5ga0");
 			pi->nphy_txpid5g[PHY_CORE_1] =
-				(u8) wlapi_getintvar(pi->vars, "txpid5ga1");
+				(u8) wlapi_getintvar(shim, "txpid5ga1");
 			pi->nphy_pwrctrl_info[PHY_CORE_0].max_pwr_5gm =
-				(s8) wlapi_getintvar(pi->vars, "maxp5ga0");
+				(s8) wlapi_getintvar(shim, "maxp5ga0");
 			pi->nphy_pwrctrl_info[PHY_CORE_1].max_pwr_5gm =
-				(s8) wlapi_getintvar(pi->vars, "maxp5ga1");
+				(s8) wlapi_getintvar(shim, "maxp5ga1");
 			pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_5gm_a1 =
-				(s16) wlapi_getintvar(pi->vars, "pa5gw0a0");
+				(s16) wlapi_getintvar(shim, "pa5gw0a0");
 			pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_5gm_a1 =
-				(s16) wlapi_getintvar(pi->vars, "pa5gw0a1");
+				(s16) wlapi_getintvar(shim, "pa5gw0a1");
 			pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_5gm_b0 =
-				(s16) wlapi_getintvar(pi->vars, "pa5gw1a0");
+				(s16) wlapi_getintvar(shim, "pa5gw1a0");
 			pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_5gm_b0 =
-				(s16) wlapi_getintvar(pi->vars, "pa5gw1a1");
+				(s16) wlapi_getintvar(shim, "pa5gw1a1");
 			pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_5gm_b1 =
-				(s16) wlapi_getintvar(pi->vars, "pa5gw2a0");
+				(s16) wlapi_getintvar(shim, "pa5gw2a0");
 			pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_5gm_b1 =
-				(s16) wlapi_getintvar(pi->vars, "pa5gw2a1");
+				(s16) wlapi_getintvar(shim, "pa5gw2a1");
 			pi->nphy_pwrctrl_info[PHY_CORE_0].idle_targ_5gm =
-				(s8) wlapi_getintvar(pi->vars, "itt5ga0");
+				(s8) wlapi_getintvar(shim, "itt5ga0");
 			pi->nphy_pwrctrl_info[PHY_CORE_1].idle_targ_5gm =
-				(s8) wlapi_getintvar(pi->vars, "itt5ga1");
+				(s8) wlapi_getintvar(shim, "itt5ga1");
 
-			pi->ofdm5gpo =
-				(u32) wlapi_getintvar(pi->vars, "ofdm5gpo");
+			pi->ofdm5gpo = (u32) wlapi_getintvar(shim, "ofdm5gpo");
 
 			pi->mcs5gpo[0] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5gpo0");
+				(u16) wlapi_getintvar(shim, "mcs5gpo0");
 			pi->mcs5gpo[1] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5gpo1");
+				(u16) wlapi_getintvar(shim, "mcs5gpo1");
 			pi->mcs5gpo[2] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5gpo2");
+				(u16) wlapi_getintvar(shim, "mcs5gpo2");
 			pi->mcs5gpo[3] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5gpo3");
+				(u16) wlapi_getintvar(shim, "mcs5gpo3");
 			pi->mcs5gpo[4] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5gpo4");
+				(u16) wlapi_getintvar(shim, "mcs5gpo4");
 			pi->mcs5gpo[5] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5gpo5");
+				(u16) wlapi_getintvar(shim, "mcs5gpo5");
 			pi->mcs5gpo[6] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5gpo6");
+				(u16) wlapi_getintvar(shim, "mcs5gpo6");
 			pi->mcs5gpo[7] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5gpo7");
+				(u16) wlapi_getintvar(shim, "mcs5gpo7");
 			break;
 		case 2:
 
 			pi->nphy_txpid5gl[0] =
-				(u8) wlapi_getintvar(pi->vars, "txpid5gla0");
+				(u8) wlapi_getintvar(shim, "txpid5gla0");
 			pi->nphy_txpid5gl[1] =
-				(u8) wlapi_getintvar(pi->vars, "txpid5gla1");
+				(u8) wlapi_getintvar(shim, "txpid5gla1");
 			pi->nphy_pwrctrl_info[0].max_pwr_5gl =
-				(s8) wlapi_getintvar(pi->vars, "maxp5gla0");
+				(s8) wlapi_getintvar(shim, "maxp5gla0");
 			pi->nphy_pwrctrl_info[1].max_pwr_5gl =
-				(s8) wlapi_getintvar(pi->vars, "maxp5gla1");
+				(s8) wlapi_getintvar(shim, "maxp5gla1");
 			pi->nphy_pwrctrl_info[0].pwrdet_5gl_a1 =
-				(s16) wlapi_getintvar(pi->vars, "pa5glw0a0");
+				(s16) wlapi_getintvar(shim, "pa5glw0a0");
 			pi->nphy_pwrctrl_info[1].pwrdet_5gl_a1 =
-				(s16) wlapi_getintvar(pi->vars, "pa5glw0a1");
+				(s16) wlapi_getintvar(shim, "pa5glw0a1");
 			pi->nphy_pwrctrl_info[0].pwrdet_5gl_b0 =
-				(s16) wlapi_getintvar(pi->vars, "pa5glw1a0");
+				(s16) wlapi_getintvar(shim, "pa5glw1a0");
 			pi->nphy_pwrctrl_info[1].pwrdet_5gl_b0 =
-				(s16) wlapi_getintvar(pi->vars, "pa5glw1a1");
+				(s16) wlapi_getintvar(shim, "pa5glw1a1");
 			pi->nphy_pwrctrl_info[0].pwrdet_5gl_b1 =
-				(s16) wlapi_getintvar(pi->vars, "pa5glw2a0");
+				(s16) wlapi_getintvar(shim, "pa5glw2a0");
 			pi->nphy_pwrctrl_info[1].pwrdet_5gl_b1 =
-				(s16) wlapi_getintvar(pi->vars, "pa5glw2a1");
+				(s16) wlapi_getintvar(shim, "pa5glw2a1");
 			pi->nphy_pwrctrl_info[0].idle_targ_5gl = 0;
 			pi->nphy_pwrctrl_info[1].idle_targ_5gl = 0;
 
 			pi->ofdm5glpo =
-				(u32) wlapi_getintvar(pi->vars, "ofdm5glpo");
+				(u32) wlapi_getintvar(shim, "ofdm5glpo");
 
 			pi->mcs5glpo[0] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5glpo0");
+				(u16) wlapi_getintvar(shim, "mcs5glpo0");
 			pi->mcs5glpo[1] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5glpo1");
+				(u16) wlapi_getintvar(shim, "mcs5glpo1");
 			pi->mcs5glpo[2] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5glpo2");
+				(u16) wlapi_getintvar(shim, "mcs5glpo2");
 			pi->mcs5glpo[3] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5glpo3");
+				(u16) wlapi_getintvar(shim, "mcs5glpo3");
 			pi->mcs5glpo[4] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5glpo4");
+				(u16) wlapi_getintvar(shim, "mcs5glpo4");
 			pi->mcs5glpo[5] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5glpo5");
+				(u16) wlapi_getintvar(shim, "mcs5glpo5");
 			pi->mcs5glpo[6] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5glpo6");
+				(u16) wlapi_getintvar(shim, "mcs5glpo6");
 			pi->mcs5glpo[7] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5glpo7");
+				(u16) wlapi_getintvar(shim, "mcs5glpo7");
 			break;
 		case 3:
 
 			pi->nphy_txpid5gh[0] =
-				(u8) wlapi_getintvar(pi->vars, "txpid5gha0");
+				(u8) wlapi_getintvar(shim, "txpid5gha0");
 			pi->nphy_txpid5gh[1] =
-				(u8) wlapi_getintvar(pi->vars, "txpid5gha1");
+				(u8) wlapi_getintvar(shim, "txpid5gha1");
 			pi->nphy_pwrctrl_info[0].max_pwr_5gh =
-				(s8) wlapi_getintvar(pi->vars, "maxp5gha0");
+				(s8) wlapi_getintvar(shim, "maxp5gha0");
 			pi->nphy_pwrctrl_info[1].max_pwr_5gh =
-				(s8) wlapi_getintvar(pi->vars, "maxp5gha1");
+				(s8) wlapi_getintvar(shim, "maxp5gha1");
 			pi->nphy_pwrctrl_info[0].pwrdet_5gh_a1 =
-				(s16) wlapi_getintvar(pi->vars, "pa5ghw0a0");
+				(s16) wlapi_getintvar(shim, "pa5ghw0a0");
 			pi->nphy_pwrctrl_info[1].pwrdet_5gh_a1 =
-				(s16) wlapi_getintvar(pi->vars, "pa5ghw0a1");
+				(s16) wlapi_getintvar(shim, "pa5ghw0a1");
 			pi->nphy_pwrctrl_info[0].pwrdet_5gh_b0 =
-				(s16) wlapi_getintvar(pi->vars, "pa5ghw1a0");
+				(s16) wlapi_getintvar(shim, "pa5ghw1a0");
 			pi->nphy_pwrctrl_info[1].pwrdet_5gh_b0 =
-				(s16) wlapi_getintvar(pi->vars, "pa5ghw1a1");
+				(s16) wlapi_getintvar(shim, "pa5ghw1a1");
 			pi->nphy_pwrctrl_info[0].pwrdet_5gh_b1 =
-				(s16) wlapi_getintvar(pi->vars, "pa5ghw2a0");
+				(s16) wlapi_getintvar(shim, "pa5ghw2a0");
 			pi->nphy_pwrctrl_info[1].pwrdet_5gh_b1 =
-				(s16) wlapi_getintvar(pi->vars, "pa5ghw2a1");
+				(s16) wlapi_getintvar(shim, "pa5ghw2a1");
 			pi->nphy_pwrctrl_info[0].idle_targ_5gh = 0;
 			pi->nphy_pwrctrl_info[1].idle_targ_5gh = 0;
 
 			pi->ofdm5ghpo =
-				(u32) wlapi_getintvar(pi->vars, "ofdm5ghpo");
+				(u32) wlapi_getintvar(shim, "ofdm5ghpo");
 
 			pi->mcs5ghpo[0] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5ghpo0");
+				(u16) wlapi_getintvar(shim, "mcs5ghpo0");
 			pi->mcs5ghpo[1] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5ghpo1");
+				(u16) wlapi_getintvar(shim, "mcs5ghpo1");
 			pi->mcs5ghpo[2] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5ghpo2");
+				(u16) wlapi_getintvar(shim, "mcs5ghpo2");
 			pi->mcs5ghpo[3] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5ghpo3");
+				(u16) wlapi_getintvar(shim, "mcs5ghpo3");
 			pi->mcs5ghpo[4] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5ghpo4");
+				(u16) wlapi_getintvar(shim, "mcs5ghpo4");
 			pi->mcs5ghpo[5] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5ghpo5");
+				(u16) wlapi_getintvar(shim, "mcs5ghpo5");
 			pi->mcs5ghpo[6] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5ghpo6");
+				(u16) wlapi_getintvar(shim, "mcs5ghpo6");
 			pi->mcs5ghpo[7] =
-				(u16) wlapi_getintvar(pi->vars, "mcs5ghpo7");
+				(u16) wlapi_getintvar(shim, "mcs5ghpo7");
 			break;
 		}
 	}
@@ -14608,41 +14607,37 @@ static void wlc_phy_txpwr_srom_read_ppr_nphy(struct brcms_phy *pi)
 
 static bool wlc_phy_txpwr_srom_read_nphy(struct brcms_phy *pi)
 {
-
-	pi->antswitch = (u8) wlapi_getintvar(pi->vars, "antswitch");
-	pi->aa2g = (u8) wlapi_getintvar(pi->vars, "aa2g");
-	pi->aa5g = (u8) wlapi_getintvar(pi->vars, "aa5g");
-
-	pi->srom_fem2g.tssipos = (u8) wlapi_getintvar(pi->vars, "tssipos2g");
-	pi->srom_fem2g.extpagain =
-			(u8) wlapi_getintvar(pi->vars, "extpagain2g");
-	pi->srom_fem2g.pdetrange =
-			(u8) wlapi_getintvar(pi->vars, "pdetrange2g");
-	pi->srom_fem2g.triso = (u8) wlapi_getintvar(pi->vars, "triso2g");
-	pi->srom_fem2g.antswctrllut =
-			(u8) wlapi_getintvar(pi->vars, "antswctl2g");
-
-	pi->srom_fem5g.tssipos = (u8) wlapi_getintvar(pi->vars, "tssipos5g");
-	pi->srom_fem5g.extpagain =
-			(u8) wlapi_getintvar(pi->vars, "extpagain5g");
-	pi->srom_fem5g.pdetrange =
-			(u8) wlapi_getintvar(pi->vars, "pdetrange5g");
-	pi->srom_fem5g.triso = (u8) wlapi_getintvar(pi->vars, "triso5g");
-	if (wlapi_getvar(pi->vars, "antswctl5g"))
+	struct phy_shim_info *shim = pi->sh->physhim;
+
+	pi->antswitch = (u8) wlapi_getintvar(shim, "antswitch");
+	pi->aa2g = (u8) wlapi_getintvar(shim, "aa2g");
+	pi->aa5g = (u8) wlapi_getintvar(shim, "aa5g");
+
+	pi->srom_fem2g.tssipos = (u8) wlapi_getintvar(shim, "tssipos2g");
+	pi->srom_fem2g.extpagain = (u8) wlapi_getintvar(shim, "extpagain2g");
+	pi->srom_fem2g.pdetrange = (u8) wlapi_getintvar(shim, "pdetrange2g");
+	pi->srom_fem2g.triso = (u8) wlapi_getintvar(shim, "triso2g");
+	pi->srom_fem2g.antswctrllut = (u8) wlapi_getintvar(shim, "antswctl2g");
+
+	pi->srom_fem5g.tssipos = (u8) wlapi_getintvar(shim, "tssipos5g");
+	pi->srom_fem5g.extpagain = (u8) wlapi_getintvar(shim, "extpagain5g");
+	pi->srom_fem5g.pdetrange = (u8) wlapi_getintvar(shim, "pdetrange5g");
+	pi->srom_fem5g.triso = (u8) wlapi_getintvar(shim, "triso5g");
+	if (wlapi_getvar(shim, "antswctl5g"))
 		pi->srom_fem5g.antswctrllut =
-			(u8) wlapi_getintvar(pi->vars, "antswctl5g");
+			(u8) wlapi_getintvar(shim, "antswctl5g");
 	else
 		pi->srom_fem5g.antswctrllut =
-			(u8) wlapi_getintvar(pi->vars, "antswctl2g");
+			(u8) wlapi_getintvar(shim, "antswctl2g");
 
 	wlc_phy_txpower_ipa_upd(pi);
 
 	pi->phy_txcore_disable_temp =
-			(s16) wlapi_getintvar(pi->vars, "tempthresh");
+			(s16) wlapi_getintvar(shim, "tempthresh");
 	if (pi->phy_txcore_disable_temp == 0)
 		pi->phy_txcore_disable_temp = PHY_CHAIN_TX_DISABLE_TEMP;
 
-	pi->phy_tempsense_offset = (s8) wlapi_getintvar(pi->vars, "tempoffset");
+	pi->phy_tempsense_offset = (s8) wlapi_getintvar(shim, "tempoffset");
 	if (pi->phy_tempsense_offset != 0) {
 		if (pi->phy_tempsense_offset >
 		    (NPHY_SROM_TEMPSHIFT + NPHY_SROM_MAXTEMPOFFSET))
@@ -14658,7 +14653,7 @@ static bool wlc_phy_txpwr_srom_read_nphy(struct brcms_phy *pi)
 		pi->phy_txcore_disable_temp - PHY_HYSTERESIS_DELTATEMP;
 
 	pi->phycal_tempdelta =
-			(u8) wlapi_getintvar(pi->vars, "phycal_tempdelta");
+			(u8) wlapi_getintvar(shim, "phycal_tempdelta");
 	if (pi->phycal_tempdelta > NPHY_CAL_MAXTEMPDELTA)
 		pi->phycal_tempdelta = 0;
 
diff --git a/drivers/staging/brcm80211/brcmsmac/phy_shim.c b/drivers/staging/brcm80211/brcmsmac/phy_shim.c
index 0be07ed..57122fc 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy_shim.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy_shim.c
@@ -216,11 +216,11 @@ wlapi_copyto_objmem(struct phy_shim_info *physhim, uint offset, const void *buf,
 	brcms_b_copyto_objmem(physhim->wlc_hw, offset, buf, l, sel);
 }
 
-char *wlapi_getvar(char *vars, const char *name)
+char *wlapi_getvar(struct phy_shim_info *physhim, const char *name)
 {
-	return getvar(vars, name);
+	return getvar(physhim->wlc_hw->sih, name);
 }
-int wlapi_getintvar(char *vars, const char *name)
+int wlapi_getintvar(struct phy_shim_info *physhim, const char *name)
 {
-	return getintvar(vars, name);
+	return getintvar(physhim->wlc_hw->sih, name);
 }
diff --git a/drivers/staging/brcm80211/brcmsmac/phy_shim.h b/drivers/staging/brcm80211/brcmsmac/phy_shim.h
index 35fe993..ca76153 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy_shim.h
+++ b/drivers/staging/brcm80211/brcmsmac/phy_shim.h
@@ -178,7 +178,7 @@ extern void wlapi_copyto_objmem(struct phy_shim_info *physhim, uint,
 extern void wlapi_high_update_phy_mode(struct phy_shim_info *physhim,
 				       u32 phy_mode);
 extern u16 wlapi_bmac_get_txant(struct phy_shim_info *physhim);
-extern char *wlapi_getvar(char *vars, const char *name);
-extern int wlapi_getintvar(char *vars, const char *name);
+extern char *wlapi_getvar(struct phy_shim_info *physhim, const char *name);
+extern int wlapi_getintvar(struct phy_shim_info *physhim, const char *name);
 
 #endif				/* _BRCM_PHY_SHIM_H_ */
diff --git a/drivers/staging/brcm80211/brcmsmac/pub.h b/drivers/staging/brcm80211/brcmsmac/pub.h
index b69833e..d1639b4 100644
--- a/drivers/staging/brcm80211/brcmsmac/pub.h
+++ b/drivers/staging/brcm80211/brcmsmac/pub.h
@@ -356,8 +356,8 @@ extern void brcms_c_ampdu_flush(struct brcms_c_info *wlc,
 			    struct ieee80211_sta *sta, u16 tid);
 extern void brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid,
 					 u8 ba_wsize, uint max_rx_ampdu_bytes);
-extern char *getvar(char *vars, const char *name);
-extern int getintvar(char *vars, const char *name);
+extern char *getvar(struct si_pub *sih, const char *name);
+extern int getintvar(struct si_pub *sih, const char *name);
 
 /* wlc_phy.c helper functions */
 extern void brcms_c_set_ps_ctrl(struct brcms_c_info *wlc);
diff --git a/drivers/staging/brcm80211/brcmsmac/srom.c b/drivers/staging/brcm80211/brcmsmac/srom.c
index 02dbd98..524f1cc 100644
--- a/drivers/staging/brcm80211/brcmsmac/srom.c
+++ b/drivers/staging/brcm80211/brcmsmac/srom.c
@@ -1247,10 +1247,13 @@ int srom_var_init(struct si_pub *sih, void __iomem *curmap, char **vars,
  * Search the name=value vars for a specific one and return its value.
  * Returns NULL if not found.
  */
-char *getvar(char *vars, const char *name)
+char *getvar(struct si_pub *sih, const char *name)
 {
 	char *s;
 	int len;
+	struct si_info *sii;
+
+	sii = (struct si_info *)sih;
 
 	if (!name)
 		return NULL;
@@ -1260,7 +1263,7 @@ char *getvar(char *vars, const char *name)
 		return NULL;
 
 	/* first look in vars[] */
-	for (s = vars; s && *s;) {
+	for (s = sii->vars; s && *s;) {
 		if ((memcmp(s, name, len) == 0) && (s[len] == '='))
 			return &s[len + 1];
 
@@ -1275,12 +1278,12 @@ char *getvar(char *vars, const char *name)
  * Search the vars for a specific one and return its value as
  * an integer. Returns 0 if not found.
  */
-int getintvar(char *vars, const char *name)
+int getintvar(struct si_pub *sih, const char *name)
 {
 	char *val;
 	unsigned long res;
 
-	val = getvar(vars, name);
+	val = getvar(sih, name);
 	if (val && !kstrtoul(val, 0, &res))
 		return res;
 
diff --git a/drivers/staging/brcm80211/brcmsmac/stf.c b/drivers/staging/brcm80211/brcmsmac/stf.c
index 9460cd1..3ce9049 100644
--- a/drivers/staging/brcm80211/brcmsmac/stf.c
+++ b/drivers/staging/brcm80211/brcmsmac/stf.c
@@ -373,8 +373,8 @@ void brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc)
 void brcms_c_stf_phy_chain_calc(struct brcms_c_info *wlc)
 {
 	/* get available rx/tx chains */
-	wlc->stf->hw_txchain = (u8) getintvar(wlc->pub->vars, "txchain");
-	wlc->stf->hw_rxchain = (u8) getintvar(wlc->pub->vars, "rxchain");
+	wlc->stf->hw_txchain = (u8) getintvar(wlc->hw->sih, "txchain");
+	wlc->stf->hw_rxchain = (u8) getintvar(wlc->hw->sih, "rxchain");
 
 	/* these parameter are intended to be used for all PHY types */
 	if (wlc->stf->hw_txchain == 0 || wlc->stf->hw_txchain == 0xf) {
-- 
1.7.4.1



^ permalink raw reply related

* [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup
From: Arend van Spriel @ 2011-10-05 13:19 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel

This series addresses more community feedback items received on mainline
patch (v2) posted August 25, 2011. The driver structures in brcmfmac could
do with some tidying and in the brcmsmac variables loaded from srom were
accessed by string identifiers. This has been replaced by enumerated
identifiers and the entries are stored in kernel standard linked list.

This series applies to staging-next and depends on the patch series posted
on Oct 4, 2011 (see Message-ID below).

Message-ID: <1317763152-17607-1-git-send-email-arend@broadcom.com>

Arend van Spriel (11):
  staging: brcm80211: move driver variable functions to srom.c
  staging: brcm80211: remove code duplication for driver variable
    lookup
  staging: brcm80211: change parameter in driver variable lookup
  staging: brcm80211: remove locking macro definitions
  staging: brcm80211: fix thread blocking issue in
    brcmf_sdbrcm_bus_stop()
  staging: brcm80211: remove invalid variable lookup from srom
  staging: brcm80211: use identifiers instead of string for srom lookup
  staging: brcm80211: use enum identifiers in srom variable tables
  staging: brcm80211: replace string based variable storage by linked
    list
  staging: brcm80211: remove parameter 'off' from _initvars_srom_pci()
  staging: brcm80211: cleanup driver variable references

Franky Lin (4):
  staging: brcm80211: remove threads_only code from fullmac
  staging: brcm80211: remove redundant bus register layer from fullmac
  staging: brcm80211: clean up struct brcmf_if in fullmac
  staging: brcm80211: remove brcmf_op_if from fullmac

 drivers/staging/brcm80211/brcmfmac/bcmsdh.c       |   10 -
 drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c |   16 +-
 drivers/staging/brcm80211/brcmfmac/dhd_linux.c    |  134 +--
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c     |  133 +--
 drivers/staging/brcm80211/brcmfmac/sdio_host.h    |    4 -
 drivers/staging/brcm80211/brcmsmac/aiutils.c      |   32 +-
 drivers/staging/brcm80211/brcmsmac/aiutils.h      |    6 +-
 drivers/staging/brcm80211/brcmsmac/antsel.c       |   15 +-
 drivers/staging/brcm80211/brcmsmac/channel.c      |    2 +-
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c  |  157 ++--
 drivers/staging/brcm80211/brcmsmac/main.c         |  144 +---
 drivers/staging/brcm80211/brcmsmac/main.h         |    5 -
 drivers/staging/brcm80211/brcmsmac/nicpci.c       |    5 +-
 drivers/staging/brcm80211/brcmsmac/nicpci.h       |    2 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c  |   42 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h  |    4 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_int.h  |    7 -
 drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c  |   64 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_n.c    |  330 ++++--
 drivers/staging/brcm80211/brcmsmac/phy_shim.c     |    9 +
 drivers/staging/brcm80211/brcmsmac/phy_shim.h     |    4 +
 drivers/staging/brcm80211/brcmsmac/pub.h          |  263 +++++-
 drivers/staging/brcm80211/brcmsmac/srom.c         | 1124 +++++++++++----------
 drivers/staging/brcm80211/brcmsmac/srom.h         |    4 +-
 drivers/staging/brcm80211/brcmsmac/stf.c          |    4 +-
 25 files changed, 1342 insertions(+), 1178 deletions(-)

-- 
1.7.4.1



^ permalink raw reply

* [PATCH 03/15] staging: brcm80211: remove redundant bus register layer from fullmac
From: Arend van Spriel @ 2011-10-05 13:20 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Franky Lin, Arend van Spriel
In-Reply-To: <1317820814-7083-1-git-send-email-arend@broadcom.com>

From: Franky Lin <frankyl@broadcom.com>

Remove some single line functions for bus register/unregister interface

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmfmac/bcmsdh.c       |   10 ----------
 drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c |   16 ++++------------
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c     |   14 --------------
 drivers/staging/brcm80211/brcmfmac/sdio_host.h    |    4 ----
 4 files changed, 4 insertions(+), 40 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
index 5906337..bff9dcd 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
@@ -362,16 +362,6 @@ int brcmf_sdio_remove(struct brcmf_sdio_dev *sdiodev)
 }
 EXPORT_SYMBOL(brcmf_sdio_remove);
 
-int brcmf_sdio_register(void)
-{
-	return brcmf_sdio_function_init();
-}
-
-void brcmf_sdio_unregister(void)
-{
-	brcmf_sdio_function_cleanup();
-}
-
 void brcmf_sdio_wdtmr_enable(struct brcmf_sdio_dev *sdiodev, bool enable)
 {
 	if (enable)
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index fc95bb2..e919de2 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -609,23 +609,15 @@ static struct sdio_driver brcmf_sdmmc_driver = {
 #endif	/* CONFIG_PM_SLEEP */
 };
 
-/*
- * module init
-*/
-int brcmf_sdio_function_init(void)
+/* bus register interface */
+int brcmf_bus_register(void)
 {
-	int error = 0;
 	brcmf_dbg(TRACE, "Enter\n");
 
-	error = sdio_register_driver(&brcmf_sdmmc_driver);
-
-	return error;
+	return sdio_register_driver(&brcmf_sdmmc_driver);
 }
 
-/*
- * module cleanup
-*/
-void brcmf_sdio_function_cleanup(void)
+void brcmf_bus_unregister(void)
 {
 	brcmf_dbg(TRACE, "Enter\n");
 
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 0ae8dc0..0f7b80d 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -4533,20 +4533,6 @@ void brcmf_sdbrcm_disconnect(void *ptr)
 	brcmf_dbg(TRACE, "Disconnected\n");
 }
 
-int brcmf_bus_register(void)
-{
-	brcmf_dbg(TRACE, "Enter\n");
-
-	return brcmf_sdio_register();
-}
-
-void brcmf_bus_unregister(void)
-{
-	brcmf_dbg(TRACE, "Enter\n");
-
-	brcmf_sdio_unregister();
-}
-
 struct device *brcmf_bus_get_device(struct brcmf_bus *bus)
 {
 	return &bus->sdiodev->func[2]->dev;
diff --git a/drivers/staging/brcm80211/brcmfmac/sdio_host.h b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
index 397ad48..726fa89 100644
--- a/drivers/staging/brcm80211/brcmfmac/sdio_host.h
+++ b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
@@ -211,10 +211,6 @@ extern int brcmf_sdcard_rwdata(struct brcmf_sdio_dev *sdiodev, uint rw,
 extern int brcmf_sdcard_abort(struct brcmf_sdio_dev *sdiodev, uint fn);
 
 /* platform specific/high level functions */
-extern int brcmf_sdio_function_init(void);
-extern int brcmf_sdio_register(void);
-extern void brcmf_sdio_unregister(void);
-extern void brcmf_sdio_function_cleanup(void);
 extern int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev);
 extern int brcmf_sdio_remove(struct brcmf_sdio_dev *sdiodev);
 
-- 
1.7.4.1



^ permalink raw reply related

* [PATCH 04/15] staging: brcm80211: remove code duplication for driver variable lookup
From: Arend van Spriel @ 2011-10-05 13:20 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel
In-Reply-To: <1317820814-7083-1-git-send-email-arend@broadcom.com>

The phy code used its own driver variable lookup functions which were
duplicates of those in the brcmsmac driver (in srom.c). The phy code
now uses the functions in srom.c through the phy_shim interface.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Alwin Beukers <alwin@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c |   36 ---
 drivers/staging/brcm80211/brcmsmac/phy/phy_int.h |    6 -
 drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c |   56 +++---
 drivers/staging/brcm80211/brcmsmac/phy/phy_n.c   |  247 ++++++++++++----------
 drivers/staging/brcm80211/brcmsmac/phy_shim.c    |    9 +
 drivers/staging/brcm80211/brcmsmac/phy_shim.h    |    3 +
 6 files changed, 180 insertions(+), 177 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
index 0d3c9d8..59767e3 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
@@ -126,42 +126,6 @@ const u8 ofdm_rate_lookup[] = {
 
 #define PHY_WREG_LIMIT  24
 
-char *phy_getvar(struct brcms_phy *pi, const char *name)
-{
-	char *vars = pi->vars;
-	char *s;
-	int len;
-
-	if (!name)
-		return NULL;
-
-	len = strlen(name);
-	if (len == 0)
-		return NULL;
-
-	for (s = vars; s && *s;) {
-		if ((memcmp(s, name, len) == 0) && (s[len] == '='))
-			return &s[len + 1];
-
-		while (*s++)
-			;
-	}
-
-	return NULL;
-}
-
-int phy_getintvar(struct brcms_phy *pi, const char *name)
-{
-	char *val;
-	unsigned long res;
-
-	val = PHY_GETVAR(pi, name);
-	if (val && !kstrtoul(val, 0, &res))
-		return res;
-
-	return 0;
-}
-
 void wlc_phyreg_enter(struct brcms_phy_pub *pih)
 {
 	struct brcms_phy *pi = (struct brcms_phy *) pih;
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h b/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h
index 4468090..4330e38 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_int.h
@@ -919,12 +919,6 @@ struct lcnphy_radio_regs {
 	u8 do_init_g;
 };
 
-extern char *phy_getvar(struct brcms_phy *pi, const char *name);
-extern int phy_getintvar(struct brcms_phy *pi, const char *name);
-
-#define PHY_GETVAR(pi, name)    phy_getvar(pi, name)
-#define PHY_GETINTVAR(pi, name) phy_getintvar(pi, name)
-
 extern u16 read_phy_reg(struct brcms_phy *pi, u16 addr);
 extern void write_phy_reg(struct brcms_phy *pi, u16 addr, u16 val);
 extern void and_phy_reg(struct brcms_phy *pi, u16 addr, u16 val);
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c
index a87e392..dbeeeba 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c
@@ -4823,18 +4823,21 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
 		u32 offset_ofdm, offset_mcs;
 
 		pi_lcn->lcnphy_tr_isolation_mid =
-			(u8) PHY_GETINTVAR(pi, "triso2g");
+			(u8) wlapi_getintvar(pi->vars, "triso2g");
 
 		pi_lcn->lcnphy_rx_power_offset =
-			(u8) PHY_GETINTVAR(pi, "rxpo2g");
+			(u8) wlapi_getintvar(pi->vars, "rxpo2g");
 
-		pi->txpa_2g[0] = (s16) PHY_GETINTVAR(pi, "pa0b0");
-		pi->txpa_2g[1] = (s16) PHY_GETINTVAR(pi, "pa0b1");
-		pi->txpa_2g[2] = (s16) PHY_GETINTVAR(pi, "pa0b2");
+		pi->txpa_2g[0] = (s16) wlapi_getintvar(pi->vars, "pa0b0");
+		pi->txpa_2g[1] = (s16) wlapi_getintvar(pi->vars, "pa0b1");
+		pi->txpa_2g[2] = (s16) wlapi_getintvar(pi->vars, "pa0b2");
 
-		pi_lcn->lcnphy_rssi_vf = (u8) PHY_GETINTVAR(pi, "rssismf2g");
-		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 =
+				(u8) wlapi_getintvar(pi->vars, "rssismf2g");
+		pi_lcn->lcnphy_rssi_vc =
+				(u8) wlapi_getintvar(pi->vars, "rssismc2g");
+		pi_lcn->lcnphy_rssi_gs =
+				(u8) wlapi_getintvar(pi->vars, "rssisav2g");
 
 		pi_lcn->lcnphy_rssi_vf_lowtemp = pi_lcn->lcnphy_rssi_vf;
 		pi_lcn->lcnphy_rssi_vc_lowtemp = pi_lcn->lcnphy_rssi_vc;
@@ -4844,7 +4847,7 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
 		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");
+		txpwr = (s8) wlapi_getintvar(pi->vars, "maxp2ga0");
 		pi->tx_srom_max_2g = txpwr;
 
 		for (i = 0; i < PWRTBL_NUM_COEFF; i++) {
@@ -4852,7 +4855,7 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
 			pi->txpa_2g_high_temp[i] = pi->txpa_2g[i];
 		}
 
-		cckpo = (u16) PHY_GETINTVAR(pi, "cck2gpo");
+		cckpo = (u16) wlapi_getintvar(pi->vars, "cck2gpo");
 		if (cckpo) {
 			uint max_pwr_chan = txpwr;
 
@@ -4862,7 +4865,8 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
 				cckpo >>= 4;
 			}
 
-			offset_ofdm = (u32) PHY_GETINTVAR(pi, "ofdm2gpo");
+			offset_ofdm =
+				(u32) wlapi_getintvar(pi->vars, "ofdm2gpo");
 			for (i = TXP_FIRST_OFDM; i <= TXP_LAST_OFDM; i++) {
 				pi->tx_srom_max_rate_2g[i] =
 					max_pwr_chan -
@@ -4872,12 +4876,13 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
 		} else {
 			u8 opo = 0;
 
-			opo = (u8) PHY_GETINTVAR(pi, "opo");
+			opo = (u8) wlapi_getintvar(pi->vars, "opo");
 
 			for (i = TXP_FIRST_CCK; i <= TXP_LAST_CCK; i++)
 				pi->tx_srom_max_rate_2g[i] = txpwr;
 
-			offset_ofdm = (u32) PHY_GETINTVAR(pi, "ofdm2gpo");
+			offset_ofdm =
+				(u32) wlapi_getintvar(pi->vars, "ofdm2gpo");
 
 			for (i = TXP_FIRST_OFDM; i <= TXP_LAST_OFDM; i++) {
 				pi->tx_srom_max_rate_2g[i] = txpwr -
@@ -4885,8 +4890,9 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
 				offset_ofdm >>= 4;
 			}
 			offset_mcs =
-				((u16) PHY_GETINTVAR(pi, "mcs2gpo1") << 16) |
-				(u16) PHY_GETINTVAR(pi, "mcs2gpo0");
+				wlapi_getintvar(pi->vars, "mcs2gpo1") << 16;
+			offset_mcs |=
+				(u16) wlapi_getintvar(pi->vars, "mcs2gpo0");
 			pi_lcn->lcnphy_mcs20_po = offset_mcs;
 			for (i = TXP_FIRST_SISO_MCS_20;
 			     i <= TXP_LAST_SISO_MCS_20; i++) {
@@ -4897,30 +4903,30 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
 		}
 
 		pi_lcn->lcnphy_rawtempsense =
-			(u16) PHY_GETINTVAR(pi, "rawtempsense");
+			(u16) wlapi_getintvar(pi->vars, "rawtempsense");
 		pi_lcn->lcnphy_measPower =
-			(u8) PHY_GETINTVAR(pi, "measpower");
+			(u8) wlapi_getintvar(pi->vars, "measpower");
 		pi_lcn->lcnphy_tempsense_slope =
-			(u8) PHY_GETINTVAR(pi, "tempsense_slope");
+			(u8) wlapi_getintvar(pi->vars, "tempsense_slope");
 		pi_lcn->lcnphy_hw_iqcal_en =
-			(bool) PHY_GETINTVAR(pi, "hw_iqcal_en");
+			(bool) wlapi_getintvar(pi->vars, "hw_iqcal_en");
 		pi_lcn->lcnphy_iqcal_swp_dis =
-			(bool) PHY_GETINTVAR(pi, "iqcal_swp_dis");
+			(bool) wlapi_getintvar(pi->vars, "iqcal_swp_dis");
 		pi_lcn->lcnphy_tempcorrx =
-			(u8) PHY_GETINTVAR(pi, "tempcorrx");
+			(u8) wlapi_getintvar(pi->vars, "tempcorrx");
 		pi_lcn->lcnphy_tempsense_option =
-			(u8) PHY_GETINTVAR(pi, "tempsense_option");
+			(u8) wlapi_getintvar(pi->vars, "tempsense_option");
 		pi_lcn->lcnphy_freqoffset_corr =
-			(u8) PHY_GETINTVAR(pi, "freqoffset_corr");
+			(u8) wlapi_getintvar(pi->vars, "freqoffset_corr");
 		if ((u8) getintvar(pi->vars, "aa2g") > 1)
 			wlc_phy_ant_rxdiv_set((struct brcms_phy_pub *) pi,
 					      (u8) getintvar(pi->vars,
 							     "aa2g"));
 	}
 	pi_lcn->lcnphy_cck_dig_filt_type = -1;
-	if (PHY_GETVAR(pi, "cckdigfilttype")) {
+	if (wlapi_getvar(pi->vars, "cckdigfilttype")) {
 		s16 temp;
-		temp = (s16) PHY_GETINTVAR(pi, "cckdigfilttype");
+		temp = (s16) wlapi_getintvar(pi->vars, "cckdigfilttype");
 		if (temp >= 0)
 			pi_lcn->lcnphy_cck_dig_filt_type = temp;
 	}
diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c
index 67cfcdd..c410bf0 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_n.c
@@ -14387,25 +14387,25 @@ static void wlc_phy_txpwr_srom_read_ppr_nphy(struct brcms_phy *pi)
 	if (pi->sh->sromrev >= 9)
 		return;
 
-	bw40po = (u16) PHY_GETINTVAR(pi, "bw40po");
+	bw40po = (u16) wlapi_getintvar(pi->vars, "bw40po");
 	pi->bw402gpo = bw40po & 0xf;
 	pi->bw405gpo = (bw40po & 0xf0) >> 4;
 	pi->bw405glpo = (bw40po & 0xf00) >> 8;
 	pi->bw405ghpo = (bw40po & 0xf000) >> 12;
 
-	cddpo = (u16) PHY_GETINTVAR(pi, "cddpo");
+	cddpo = (u16) wlapi_getintvar(pi->vars, "cddpo");
 	pi->cdd2gpo = cddpo & 0xf;
 	pi->cdd5gpo = (cddpo & 0xf0) >> 4;
 	pi->cdd5glpo = (cddpo & 0xf00) >> 8;
 	pi->cdd5ghpo = (cddpo & 0xf000) >> 12;
 
-	stbcpo = (u16) PHY_GETINTVAR(pi, "stbcpo");
+	stbcpo = (u16) wlapi_getintvar(pi->vars, "stbcpo");
 	pi->stbc2gpo = stbcpo & 0xf;
 	pi->stbc5gpo = (stbcpo & 0xf0) >> 4;
 	pi->stbc5glpo = (stbcpo & 0xf00) >> 8;
 	pi->stbc5ghpo = (stbcpo & 0xf000) >> 12;
 
-	bwduppo = (u16) PHY_GETINTVAR(pi, "bwduppo");
+	bwduppo = (u16) wlapi_getintvar(pi->vars, "bwduppo");
 	pi->bwdup2gpo = bwduppo & 0xf;
 	pi->bwdup5gpo = (bwduppo & 0xf0) >> 4;
 	pi->bwdup5glpo = (bwduppo & 0xf00) >> 8;
@@ -14417,168 +14417,188 @@ static void wlc_phy_txpwr_srom_read_ppr_nphy(struct brcms_phy *pi)
 		case 0:
 
 			pi->nphy_txpid2g[PHY_CORE_0] =
-				(u8) PHY_GETINTVAR(pi, "txpid2ga0");
+				(u8) wlapi_getintvar(pi->vars, "txpid2ga0");
 			pi->nphy_txpid2g[PHY_CORE_1] =
-				(u8) PHY_GETINTVAR(pi, "txpid2ga1");
+				(u8) wlapi_getintvar(pi->vars, "txpid2ga1");
 			pi->nphy_pwrctrl_info[PHY_CORE_0].max_pwr_2g =
-				(s8) PHY_GETINTVAR(pi, "maxp2ga0");
+				(s8) wlapi_getintvar(pi->vars, "maxp2ga0");
 			pi->nphy_pwrctrl_info[PHY_CORE_1].max_pwr_2g =
-				(s8) PHY_GETINTVAR(pi, "maxp2ga1");
+				(s8) wlapi_getintvar(pi->vars, "maxp2ga1");
 			pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_2g_a1 =
-				(s16) PHY_GETINTVAR(pi, "pa2gw0a0");
+				(s16) wlapi_getintvar(pi->vars, "pa2gw0a0");
 			pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_2g_a1 =
-				(s16) PHY_GETINTVAR(pi, "pa2gw0a1");
+				(s16) wlapi_getintvar(pi->vars, "pa2gw0a1");
 			pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_2g_b0 =
-				(s16) PHY_GETINTVAR(pi, "pa2gw1a0");
+				(s16) wlapi_getintvar(pi->vars, "pa2gw1a0");
 			pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_2g_b0 =
-				(s16) PHY_GETINTVAR(pi, "pa2gw1a1");
+				(s16) wlapi_getintvar(pi->vars, "pa2gw1a1");
 			pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_2g_b1 =
-				(s16) PHY_GETINTVAR(pi, "pa2gw2a0");
+				(s16) wlapi_getintvar(pi->vars, "pa2gw2a0");
 			pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_2g_b1 =
-				(s16) PHY_GETINTVAR(pi, "pa2gw2a1");
+				(s16) wlapi_getintvar(pi->vars, "pa2gw2a1");
 			pi->nphy_pwrctrl_info[PHY_CORE_0].idle_targ_2g =
-				(s8) PHY_GETINTVAR(pi, "itt2ga0");
+				(s8) wlapi_getintvar(pi->vars, "itt2ga0");
 			pi->nphy_pwrctrl_info[PHY_CORE_1].idle_targ_2g =
-				(s8) PHY_GETINTVAR(pi, "itt2ga1");
-
-			pi->cck2gpo = (u16) PHY_GETINTVAR(pi, "cck2gpo");
-
-			pi->ofdm2gpo = (u32) PHY_GETINTVAR(pi, "ofdm2gpo");
-
-			pi->mcs2gpo[0] = (u16) PHY_GETINTVAR(pi, "mcs2gpo0");
-			pi->mcs2gpo[1] = (u16) PHY_GETINTVAR(pi, "mcs2gpo1");
-			pi->mcs2gpo[2] = (u16) PHY_GETINTVAR(pi, "mcs2gpo2");
-			pi->mcs2gpo[3] = (u16) PHY_GETINTVAR(pi, "mcs2gpo3");
-			pi->mcs2gpo[4] = (u16) PHY_GETINTVAR(pi, "mcs2gpo4");
-			pi->mcs2gpo[5] = (u16) PHY_GETINTVAR(pi, "mcs2gpo5");
-			pi->mcs2gpo[6] = (u16) PHY_GETINTVAR(pi, "mcs2gpo6");
-			pi->mcs2gpo[7] = (u16) PHY_GETINTVAR(pi, "mcs2gpo7");
+				(s8) wlapi_getintvar(pi->vars, "itt2ga1");
+
+			pi->cck2gpo =
+				(u16) wlapi_getintvar(pi->vars, "cck2gpo");
+			pi->ofdm2gpo =
+				(u32) wlapi_getintvar(pi->vars, "ofdm2gpo");
+
+			pi->mcs2gpo[0] =
+				(u16) wlapi_getintvar(pi->vars, "mcs2gpo0");
+			pi->mcs2gpo[1] =
+				(u16) wlapi_getintvar(pi->vars, "mcs2gpo1");
+			pi->mcs2gpo[2] =
+				(u16) wlapi_getintvar(pi->vars, "mcs2gpo2");
+			pi->mcs2gpo[3] =
+				(u16) wlapi_getintvar(pi->vars, "mcs2gpo3");
+			pi->mcs2gpo[4] =
+				(u16) wlapi_getintvar(pi->vars, "mcs2gpo4");
+			pi->mcs2gpo[5] =
+				(u16) wlapi_getintvar(pi->vars, "mcs2gpo5");
+			pi->mcs2gpo[6] =
+				(u16) wlapi_getintvar(pi->vars, "mcs2gpo6");
+			pi->mcs2gpo[7] =
+				(u16) wlapi_getintvar(pi->vars, "mcs2gpo7");
 			break;
 		case 1:
 
 			pi->nphy_txpid5g[PHY_CORE_0] =
-				(u8) PHY_GETINTVAR(pi, "txpid5ga0");
+				(u8) wlapi_getintvar(pi->vars, "txpid5ga0");
 			pi->nphy_txpid5g[PHY_CORE_1] =
-				(u8) PHY_GETINTVAR(pi, "txpid5ga1");
+				(u8) wlapi_getintvar(pi->vars, "txpid5ga1");
 			pi->nphy_pwrctrl_info[PHY_CORE_0].max_pwr_5gm =
-				(s8) PHY_GETINTVAR(pi, "maxp5ga0");
+				(s8) wlapi_getintvar(pi->vars, "maxp5ga0");
 			pi->nphy_pwrctrl_info[PHY_CORE_1].max_pwr_5gm =
-				(s8) PHY_GETINTVAR(pi, "maxp5ga1");
+				(s8) wlapi_getintvar(pi->vars, "maxp5ga1");
 			pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_5gm_a1 =
-				(s16) PHY_GETINTVAR(pi, "pa5gw0a0");
+				(s16) wlapi_getintvar(pi->vars, "pa5gw0a0");
 			pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_5gm_a1 =
-				(s16) PHY_GETINTVAR(pi, "pa5gw0a1");
+				(s16) wlapi_getintvar(pi->vars, "pa5gw0a1");
 			pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_5gm_b0 =
-				(s16) PHY_GETINTVAR(pi, "pa5gw1a0");
+				(s16) wlapi_getintvar(pi->vars, "pa5gw1a0");
 			pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_5gm_b0 =
-				(s16) PHY_GETINTVAR(pi, "pa5gw1a1");
+				(s16) wlapi_getintvar(pi->vars, "pa5gw1a1");
 			pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_5gm_b1 =
-				(s16) PHY_GETINTVAR(pi, "pa5gw2a0");
+				(s16) wlapi_getintvar(pi->vars, "pa5gw2a0");
 			pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_5gm_b1 =
-				(s16) PHY_GETINTVAR(pi, "pa5gw2a1");
+				(s16) wlapi_getintvar(pi->vars, "pa5gw2a1");
 			pi->nphy_pwrctrl_info[PHY_CORE_0].idle_targ_5gm =
-				(s8) PHY_GETINTVAR(pi, "itt5ga0");
+				(s8) wlapi_getintvar(pi->vars, "itt5ga0");
 			pi->nphy_pwrctrl_info[PHY_CORE_1].idle_targ_5gm =
-				(s8) PHY_GETINTVAR(pi, "itt5ga1");
-
-			pi->ofdm5gpo = (u32) PHY_GETINTVAR(pi, "ofdm5gpo");
-
-			pi->mcs5gpo[0] = (u16) PHY_GETINTVAR(pi, "mcs5gpo0");
-			pi->mcs5gpo[1] = (u16) PHY_GETINTVAR(pi, "mcs5gpo1");
-			pi->mcs5gpo[2] = (u16) PHY_GETINTVAR(pi, "mcs5gpo2");
-			pi->mcs5gpo[3] = (u16) PHY_GETINTVAR(pi, "mcs5gpo3");
-			pi->mcs5gpo[4] = (u16) PHY_GETINTVAR(pi, "mcs5gpo4");
-			pi->mcs5gpo[5] = (u16) PHY_GETINTVAR(pi, "mcs5gpo5");
-			pi->mcs5gpo[6] = (u16) PHY_GETINTVAR(pi, "mcs5gpo6");
-			pi->mcs5gpo[7] = (u16) PHY_GETINTVAR(pi, "mcs5gpo7");
+				(s8) wlapi_getintvar(pi->vars, "itt5ga1");
+
+			pi->ofdm5gpo =
+				(u32) wlapi_getintvar(pi->vars, "ofdm5gpo");
+
+			pi->mcs5gpo[0] =
+				(u16) wlapi_getintvar(pi->vars, "mcs5gpo0");
+			pi->mcs5gpo[1] =
+				(u16) wlapi_getintvar(pi->vars, "mcs5gpo1");
+			pi->mcs5gpo[2] =
+				(u16) wlapi_getintvar(pi->vars, "mcs5gpo2");
+			pi->mcs5gpo[3] =
+				(u16) wlapi_getintvar(pi->vars, "mcs5gpo3");
+			pi->mcs5gpo[4] =
+				(u16) wlapi_getintvar(pi->vars, "mcs5gpo4");
+			pi->mcs5gpo[5] =
+				(u16) wlapi_getintvar(pi->vars, "mcs5gpo5");
+			pi->mcs5gpo[6] =
+				(u16) wlapi_getintvar(pi->vars, "mcs5gpo6");
+			pi->mcs5gpo[7] =
+				(u16) wlapi_getintvar(pi->vars, "mcs5gpo7");
 			break;
 		case 2:
 
 			pi->nphy_txpid5gl[0] =
-				(u8) PHY_GETINTVAR(pi, "txpid5gla0");
+				(u8) wlapi_getintvar(pi->vars, "txpid5gla0");
 			pi->nphy_txpid5gl[1] =
-				(u8) PHY_GETINTVAR(pi, "txpid5gla1");
+				(u8) wlapi_getintvar(pi->vars, "txpid5gla1");
 			pi->nphy_pwrctrl_info[0].max_pwr_5gl =
-				(s8) PHY_GETINTVAR(pi, "maxp5gla0");
+				(s8) wlapi_getintvar(pi->vars, "maxp5gla0");
 			pi->nphy_pwrctrl_info[1].max_pwr_5gl =
-				(s8) PHY_GETINTVAR(pi, "maxp5gla1");
+				(s8) wlapi_getintvar(pi->vars, "maxp5gla1");
 			pi->nphy_pwrctrl_info[0].pwrdet_5gl_a1 =
-				(s16) PHY_GETINTVAR(pi, "pa5glw0a0");
+				(s16) wlapi_getintvar(pi->vars, "pa5glw0a0");
 			pi->nphy_pwrctrl_info[1].pwrdet_5gl_a1 =
-				(s16) PHY_GETINTVAR(pi, "pa5glw0a1");
+				(s16) wlapi_getintvar(pi->vars, "pa5glw0a1");
 			pi->nphy_pwrctrl_info[0].pwrdet_5gl_b0 =
-				(s16) PHY_GETINTVAR(pi, "pa5glw1a0");
+				(s16) wlapi_getintvar(pi->vars, "pa5glw1a0");
 			pi->nphy_pwrctrl_info[1].pwrdet_5gl_b0 =
-				(s16) PHY_GETINTVAR(pi, "pa5glw1a1");
+				(s16) wlapi_getintvar(pi->vars, "pa5glw1a1");
 			pi->nphy_pwrctrl_info[0].pwrdet_5gl_b1 =
-				(s16) PHY_GETINTVAR(pi, "pa5glw2a0");
+				(s16) wlapi_getintvar(pi->vars, "pa5glw2a0");
 			pi->nphy_pwrctrl_info[1].pwrdet_5gl_b1 =
-				(s16) PHY_GETINTVAR(pi, "pa5glw2a1");
+				(s16) wlapi_getintvar(pi->vars, "pa5glw2a1");
 			pi->nphy_pwrctrl_info[0].idle_targ_5gl = 0;
 			pi->nphy_pwrctrl_info[1].idle_targ_5gl = 0;
 
-			pi->ofdm5glpo = (u32) PHY_GETINTVAR(pi, "ofdm5glpo");
+			pi->ofdm5glpo =
+				(u32) wlapi_getintvar(pi->vars, "ofdm5glpo");
 
 			pi->mcs5glpo[0] =
-				(u16) PHY_GETINTVAR(pi, "mcs5glpo0");
+				(u16) wlapi_getintvar(pi->vars, "mcs5glpo0");
 			pi->mcs5glpo[1] =
-				(u16) PHY_GETINTVAR(pi, "mcs5glpo1");
+				(u16) wlapi_getintvar(pi->vars, "mcs5glpo1");
 			pi->mcs5glpo[2] =
-				(u16) PHY_GETINTVAR(pi, "mcs5glpo2");
+				(u16) wlapi_getintvar(pi->vars, "mcs5glpo2");
 			pi->mcs5glpo[3] =
-				(u16) PHY_GETINTVAR(pi, "mcs5glpo3");
+				(u16) wlapi_getintvar(pi->vars, "mcs5glpo3");
 			pi->mcs5glpo[4] =
-				(u16) PHY_GETINTVAR(pi, "mcs5glpo4");
+				(u16) wlapi_getintvar(pi->vars, "mcs5glpo4");
 			pi->mcs5glpo[5] =
-				(u16) PHY_GETINTVAR(pi, "mcs5glpo5");
+				(u16) wlapi_getintvar(pi->vars, "mcs5glpo5");
 			pi->mcs5glpo[6] =
-				(u16) PHY_GETINTVAR(pi, "mcs5glpo6");
+				(u16) wlapi_getintvar(pi->vars, "mcs5glpo6");
 			pi->mcs5glpo[7] =
-				(u16) PHY_GETINTVAR(pi, "mcs5glpo7");
+				(u16) wlapi_getintvar(pi->vars, "mcs5glpo7");
 			break;
 		case 3:
 
 			pi->nphy_txpid5gh[0] =
-				(u8) PHY_GETINTVAR(pi, "txpid5gha0");
+				(u8) wlapi_getintvar(pi->vars, "txpid5gha0");
 			pi->nphy_txpid5gh[1] =
-				(u8) PHY_GETINTVAR(pi, "txpid5gha1");
+				(u8) wlapi_getintvar(pi->vars, "txpid5gha1");
 			pi->nphy_pwrctrl_info[0].max_pwr_5gh =
-				(s8) PHY_GETINTVAR(pi, "maxp5gha0");
+				(s8) wlapi_getintvar(pi->vars, "maxp5gha0");
 			pi->nphy_pwrctrl_info[1].max_pwr_5gh =
-				(s8) PHY_GETINTVAR(pi, "maxp5gha1");
+				(s8) wlapi_getintvar(pi->vars, "maxp5gha1");
 			pi->nphy_pwrctrl_info[0].pwrdet_5gh_a1 =
-				(s16) PHY_GETINTVAR(pi, "pa5ghw0a0");
+				(s16) wlapi_getintvar(pi->vars, "pa5ghw0a0");
 			pi->nphy_pwrctrl_info[1].pwrdet_5gh_a1 =
-				(s16) PHY_GETINTVAR(pi, "pa5ghw0a1");
+				(s16) wlapi_getintvar(pi->vars, "pa5ghw0a1");
 			pi->nphy_pwrctrl_info[0].pwrdet_5gh_b0 =
-				(s16) PHY_GETINTVAR(pi, "pa5ghw1a0");
+				(s16) wlapi_getintvar(pi->vars, "pa5ghw1a0");
 			pi->nphy_pwrctrl_info[1].pwrdet_5gh_b0 =
-				(s16) PHY_GETINTVAR(pi, "pa5ghw1a1");
+				(s16) wlapi_getintvar(pi->vars, "pa5ghw1a1");
 			pi->nphy_pwrctrl_info[0].pwrdet_5gh_b1 =
-				(s16) PHY_GETINTVAR(pi, "pa5ghw2a0");
+				(s16) wlapi_getintvar(pi->vars, "pa5ghw2a0");
 			pi->nphy_pwrctrl_info[1].pwrdet_5gh_b1 =
-				(s16) PHY_GETINTVAR(pi, "pa5ghw2a1");
+				(s16) wlapi_getintvar(pi->vars, "pa5ghw2a1");
 			pi->nphy_pwrctrl_info[0].idle_targ_5gh = 0;
 			pi->nphy_pwrctrl_info[1].idle_targ_5gh = 0;
 
-			pi->ofdm5ghpo = (u32) PHY_GETINTVAR(pi, "ofdm5ghpo");
+			pi->ofdm5ghpo =
+				(u32) wlapi_getintvar(pi->vars, "ofdm5ghpo");
 
 			pi->mcs5ghpo[0] =
-				(u16) PHY_GETINTVAR(pi, "mcs5ghpo0");
+				(u16) wlapi_getintvar(pi->vars, "mcs5ghpo0");
 			pi->mcs5ghpo[1] =
-				(u16) PHY_GETINTVAR(pi, "mcs5ghpo1");
+				(u16) wlapi_getintvar(pi->vars, "mcs5ghpo1");
 			pi->mcs5ghpo[2] =
-				(u16) PHY_GETINTVAR(pi, "mcs5ghpo2");
+				(u16) wlapi_getintvar(pi->vars, "mcs5ghpo2");
 			pi->mcs5ghpo[3] =
-				(u16) PHY_GETINTVAR(pi, "mcs5ghpo3");
+				(u16) wlapi_getintvar(pi->vars, "mcs5ghpo3");
 			pi->mcs5ghpo[4] =
-				(u16) PHY_GETINTVAR(pi, "mcs5ghpo4");
+				(u16) wlapi_getintvar(pi->vars, "mcs5ghpo4");
 			pi->mcs5ghpo[5] =
-				(u16) PHY_GETINTVAR(pi, "mcs5ghpo5");
+				(u16) wlapi_getintvar(pi->vars, "mcs5ghpo5");
 			pi->mcs5ghpo[6] =
-				(u16) PHY_GETINTVAR(pi, "mcs5ghpo6");
+				(u16) wlapi_getintvar(pi->vars, "mcs5ghpo6");
 			pi->mcs5ghpo[7] =
-				(u16) PHY_GETINTVAR(pi, "mcs5ghpo7");
+				(u16) wlapi_getintvar(pi->vars, "mcs5ghpo7");
 			break;
 		}
 	}
@@ -14589,34 +14609,40 @@ static void wlc_phy_txpwr_srom_read_ppr_nphy(struct brcms_phy *pi)
 static bool wlc_phy_txpwr_srom_read_nphy(struct brcms_phy *pi)
 {
 
-	pi->antswitch = (u8) PHY_GETINTVAR(pi, "antswitch");
-	pi->aa2g = (u8) PHY_GETINTVAR(pi, "aa2g");
-	pi->aa5g = (u8) PHY_GETINTVAR(pi, "aa5g");
-
-	pi->srom_fem2g.tssipos = (u8) PHY_GETINTVAR(pi, "tssipos2g");
-	pi->srom_fem2g.extpagain = (u8) PHY_GETINTVAR(pi, "extpagain2g");
-	pi->srom_fem2g.pdetrange = (u8) PHY_GETINTVAR(pi, "pdetrange2g");
-	pi->srom_fem2g.triso = (u8) PHY_GETINTVAR(pi, "triso2g");
-	pi->srom_fem2g.antswctrllut = (u8) PHY_GETINTVAR(pi, "antswctl2g");
-
-	pi->srom_fem5g.tssipos = (u8) PHY_GETINTVAR(pi, "tssipos5g");
-	pi->srom_fem5g.extpagain = (u8) PHY_GETINTVAR(pi, "extpagain5g");
-	pi->srom_fem5g.pdetrange = (u8) PHY_GETINTVAR(pi, "pdetrange5g");
-	pi->srom_fem5g.triso = (u8) PHY_GETINTVAR(pi, "triso5g");
-	if (PHY_GETVAR(pi, "antswctl5g"))
+	pi->antswitch = (u8) wlapi_getintvar(pi->vars, "antswitch");
+	pi->aa2g = (u8) wlapi_getintvar(pi->vars, "aa2g");
+	pi->aa5g = (u8) wlapi_getintvar(pi->vars, "aa5g");
+
+	pi->srom_fem2g.tssipos = (u8) wlapi_getintvar(pi->vars, "tssipos2g");
+	pi->srom_fem2g.extpagain =
+			(u8) wlapi_getintvar(pi->vars, "extpagain2g");
+	pi->srom_fem2g.pdetrange =
+			(u8) wlapi_getintvar(pi->vars, "pdetrange2g");
+	pi->srom_fem2g.triso = (u8) wlapi_getintvar(pi->vars, "triso2g");
+	pi->srom_fem2g.antswctrllut =
+			(u8) wlapi_getintvar(pi->vars, "antswctl2g");
+
+	pi->srom_fem5g.tssipos = (u8) wlapi_getintvar(pi->vars, "tssipos5g");
+	pi->srom_fem5g.extpagain =
+			(u8) wlapi_getintvar(pi->vars, "extpagain5g");
+	pi->srom_fem5g.pdetrange =
+			(u8) wlapi_getintvar(pi->vars, "pdetrange5g");
+	pi->srom_fem5g.triso = (u8) wlapi_getintvar(pi->vars, "triso5g");
+	if (wlapi_getvar(pi->vars, "antswctl5g"))
 		pi->srom_fem5g.antswctrllut =
-			(u8) PHY_GETINTVAR(pi, "antswctl5g");
+			(u8) wlapi_getintvar(pi->vars, "antswctl5g");
 	else
 		pi->srom_fem5g.antswctrllut =
-			(u8) PHY_GETINTVAR(pi, "antswctl2g");
+			(u8) wlapi_getintvar(pi->vars, "antswctl2g");
 
 	wlc_phy_txpower_ipa_upd(pi);
 
-	pi->phy_txcore_disable_temp = (s16) PHY_GETINTVAR(pi, "tempthresh");
+	pi->phy_txcore_disable_temp =
+			(s16) wlapi_getintvar(pi->vars, "tempthresh");
 	if (pi->phy_txcore_disable_temp == 0)
 		pi->phy_txcore_disable_temp = PHY_CHAIN_TX_DISABLE_TEMP;
 
-	pi->phy_tempsense_offset = (s8) PHY_GETINTVAR(pi, "tempoffset");
+	pi->phy_tempsense_offset = (s8) wlapi_getintvar(pi->vars, "tempoffset");
 	if (pi->phy_tempsense_offset != 0) {
 		if (pi->phy_tempsense_offset >
 		    (NPHY_SROM_TEMPSHIFT + NPHY_SROM_MAXTEMPOFFSET))
@@ -14631,7 +14657,8 @@ static bool wlc_phy_txpwr_srom_read_nphy(struct brcms_phy *pi)
 	pi->phy_txcore_enable_temp =
 		pi->phy_txcore_disable_temp - PHY_HYSTERESIS_DELTATEMP;
 
-	pi->phycal_tempdelta = (u8) PHY_GETINTVAR(pi, "phycal_tempdelta");
+	pi->phycal_tempdelta =
+			(u8) wlapi_getintvar(pi->vars, "phycal_tempdelta");
 	if (pi->phycal_tempdelta > NPHY_CAL_MAXTEMPDELTA)
 		pi->phycal_tempdelta = 0;
 
diff --git a/drivers/staging/brcm80211/brcmsmac/phy_shim.c b/drivers/staging/brcm80211/brcmsmac/phy_shim.c
index e0c19b6..0be07ed 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy_shim.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy_shim.c
@@ -215,3 +215,12 @@ wlapi_copyto_objmem(struct phy_shim_info *physhim, uint offset, const void *buf,
 {
 	brcms_b_copyto_objmem(physhim->wlc_hw, offset, buf, l, sel);
 }
+
+char *wlapi_getvar(char *vars, const char *name)
+{
+	return getvar(vars, name);
+}
+int wlapi_getintvar(char *vars, const char *name)
+{
+	return getintvar(vars, name);
+}
diff --git a/drivers/staging/brcm80211/brcmsmac/phy_shim.h b/drivers/staging/brcm80211/brcmsmac/phy_shim.h
index d88c820..35fe993 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy_shim.h
+++ b/drivers/staging/brcm80211/brcmsmac/phy_shim.h
@@ -178,4 +178,7 @@ extern void wlapi_copyto_objmem(struct phy_shim_info *physhim, uint,
 extern void wlapi_high_update_phy_mode(struct phy_shim_info *physhim,
 				       u32 phy_mode);
 extern u16 wlapi_bmac_get_txant(struct phy_shim_info *physhim);
+extern char *wlapi_getvar(char *vars, const char *name);
+extern int wlapi_getintvar(char *vars, const char *name);
+
 #endif				/* _BRCM_PHY_SHIM_H_ */
-- 
1.7.4.1



^ permalink raw reply related

* [PATCH 01/15] staging: brcm80211: move driver variable functions to srom.c
From: Arend van Spriel @ 2011-10-05 13:30 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel

The driver uses variables which are stored in string format. Using
strings as variable identifiers is disliked by the community. The
driver has been cleaned up and the only module providing these
variables is srom.c. The variable retrieval functions have been
moved to srom.c in preparation of a more likable way to store and
lookup these driver variables.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Alwin Beukers <alwin@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
Greg,

Retrying this one as I do not see it appearing on the reflectors nor
my own mailbox.

Gr. AvS
---
 drivers/staging/brcm80211/brcmsmac/main.c |   44 -----------------------------
 drivers/staging/brcm80211/brcmsmac/srom.c |   44 +++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 9fa8485..100e6ec 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -8881,47 +8881,3 @@ void brcms_c_set_radio_mpc(struct brcms_c_info *wlc, bool mpc)
 	wlc->mpc = mpc;
 	brcms_c_radio_mpc_upd(wlc);
 }
-
-/*
- * Search the name=value vars for a specific one and return its value.
- * Returns NULL if not found.
- */
-char *getvar(char *vars, const char *name)
-{
-	char *s;
-	int len;
-
-	if (!name)
-		return NULL;
-
-	len = strlen(name);
-	if (len == 0)
-		return NULL;
-
-	/* first look in vars[] */
-	for (s = vars; s && *s;) {
-		if ((memcmp(s, name, len) == 0) && (s[len] == '='))
-			return &s[len + 1];
-
-		while (*s++)
-			;
-	}
-	/* nothing found */
-	return NULL;
-}
-
-/*
- * Search the vars for a specific one and return its value as
- * an integer. Returns 0 if not found.
- */
-int getintvar(char *vars, const char *name)
-{
-	char *val;
-	unsigned long res;
-
-	val = getvar(vars, name);
-	if (val && !kstrtoul(val, 0, &res))
-		return res;
-
-	return 0;
-}
diff --git a/drivers/staging/brcm80211/brcmsmac/srom.c b/drivers/staging/brcm80211/brcmsmac/srom.c
index 13d17eb..02dbd98 100644
--- a/drivers/staging/brcm80211/brcmsmac/srom.c
+++ b/drivers/staging/brcm80211/brcmsmac/srom.c
@@ -1242,3 +1242,47 @@ int srom_var_init(struct si_pub *sih, void __iomem *curmap, char **vars,
 
 	return -EINVAL;
 }
+
+/*
+ * Search the name=value vars for a specific one and return its value.
+ * Returns NULL if not found.
+ */
+char *getvar(char *vars, const char *name)
+{
+	char *s;
+	int len;
+
+	if (!name)
+		return NULL;
+
+	len = strlen(name);
+	if (len == 0)
+		return NULL;
+
+	/* first look in vars[] */
+	for (s = vars; s && *s;) {
+		if ((memcmp(s, name, len) == 0) && (s[len] == '='))
+			return &s[len + 1];
+
+		while (*s++)
+			;
+	}
+	/* nothing found */
+	return NULL;
+}
+
+/*
+ * Search the vars for a specific one and return its value as
+ * an integer. Returns 0 if not found.
+ */
+int getintvar(char *vars, const char *name)
+{
+	char *val;
+	unsigned long res;
+
+	val = getvar(vars, name);
+	if (val && !kstrtoul(val, 0, &res))
+		return res;
+
+	return 0;
+}
-- 
1.7.4.1



^ permalink raw reply related

* [PATCH v3] move brcm80211 drivers to mainline
From: Arend van Spriel @ 2011-10-05 14:08 UTC (permalink / raw)
  To: John W. Linville
  Cc: linux-wireless@vger.kernel.org, devel@linuxdriverproject.org,
	Brett Rudley, Franky (Zhenhui) Lin, Roland Vossen, Alwin Beukers,
	gregkh@suse.de

With number of cleanup patch series merged in by Greg KH, I'd like to
once again propose moving brcm80211 out of staging and into mainline.

I've put together a patch to add a copy of the current sources from
staging-next into drivers/net/wireless/brcm80211 of the wireless-next
repository.

The patch is somewhat large, so I've posted the patch at:

http://linuxwireless.org/en/users/Drivers/brcm80211?action=AttachFile&do=view&target=0001-net-wireless-add-brcm80211-drivers-v3.patch

Changes from the previous version:

V3:
- remove -D line from Makefiles
- use endian annotated structures
- enable sparse endian checking
- remove use of (static) global variables
- remove own buffer printing implementation
- remove static function prototypes
- replace macros by inline functions
- reduce sparse warnings
- remove using string-based iovars
- remove driver internal use of ioctls
- remove (un)likely
- remove uncoditional curly braces for variable scoping
- remove error messages upon alloc failures
- reduced code indentation levels
- cleanup in brcmutil module
- remove changing lock state which is acquired by other layer 
(wpa_supplicant)
- brcmfmac:
     - use ffs() instead of brcmf_find_msb()
     - replace threads with work queues
     - cleanup module parameters
- brcmsmac:
     - not modifying ssn value upon AMPDU start
     - use hweight8() instead of brcmu_bitcount()
     - remove unnecessary mac80211 callbacks
     - remove brcms_c_set_par and get_par functions
     - remove bmac wrapper functions
     - remove lock related macros
     - add debugfs based event tracing (not functional in staging)

The brcmsmac driver has been verified to work on x86 (both 32- and 
64-bit), PPC
(64-bit), SPARC, MIPS BE, and ARM.  The brcmfmac driver has been verified to
work on x86 32-bit and ARM (additional testing is in progress, but getting a
working sdio controller on some of the other platforms remains challenging).

The drivers compile cleanly for x86 (32- and 64-bit), PPC (32- and 64-bit),
SPARC, MIPS BE, MIPS LE, and ARM.

Thanks,
Arend van Spriel



^ permalink raw reply

* [PATCH] ath6kl:Fix execution address of OTP AR6003 HW2.0
From: Sangwook Lee @ 2011-10-05 14:14 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, patches, Sangwook Lee

Fix OTP execution address for AR6003 HW2.0

ath6kl: writing otp to 0x543180 (3689 B)
ath6kl: bmi LZ stream start: addr: 0x543180)
ath6kl: bmi send LZ data: len: 3688)
ath6kl: bmi send LZ data: len: 4)
ath6kl: bmi LZ stream start: addr: 0x0)
ath6kl: bmi read memory: device: addr: 0x54061c, len: 4
ath6kl: app_start_override_addr 0x0
ath6kl: executing OTP at 0x0
ath6kl: bmi execute: addr: 0x0, param: 0)
ath6kl: bmi_recv_buf FIFO empty
ath6kl: Unable to read from the device: -22

Signed-off-by: Sangwook Lee <sangwook.lee@linaro.org>
---
 drivers/net/wireless/ath/ath6kl/init.c   |    3 +++
 drivers/net/wireless/ath/ath6kl/target.h |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index b277111..bfe802b 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -1211,6 +1211,9 @@ static int ath6kl_upload_otp(struct ath6kl *ar)
 		return ret;
 	}
 
+	if (ar->version.target_ver == AR6003_REV2_VERSION)
+		address = AR6003_REV2_APP_START_OVERRIDE;
+	
 	ar->hw.app_start_override_addr = address;
 
 	ath6kl_dbg(ATH6KL_DBG_BOOT, "app_start_override_addr 0x%x\n",
diff --git a/drivers/net/wireless/ath/ath6kl/target.h b/drivers/net/wireless/ath/ath6kl/target.h
index c9a7605..253c489 100644
--- a/drivers/net/wireless/ath/ath6kl/target.h
+++ b/drivers/net/wireless/ath/ath6kl/target.h
@@ -331,6 +331,7 @@ struct host_interest {
 	(((target_type) == TARGET_TYPE_AR6003) ? AR6003_VTOP(vaddr) : \
 	(((target_type) == TARGET_TYPE_AR6004) ? AR6004_VTOP(vaddr) : 0))
 
+#define AR6003_REV2_APP_START_OVERRIDE          0x944C00
 #define AR6003_REV2_APP_LOAD_ADDRESS            0x543180
 #define AR6003_REV2_BOARD_EXT_DATA_ADDRESS      0x57E500
 #define AR6003_REV2_DATASET_PATCH_ADDRESS       0x57e884
-- 
1.7.4.1


^ permalink raw reply related

* Re: [PATCH v3] move brcm80211 drivers to mainline
From: John W. Linville @ 2011-10-05 14:24 UTC (permalink / raw)
  To: Arend van Spriel
  Cc: linux-wireless@vger.kernel.org, devel@linuxdriverproject.org,
	Brett Rudley, Franky (Zhenhui) Lin, Roland Vossen, Alwin Beukers,
	gregkh@suse.de
In-Reply-To: <4E8C64EF.3070203@broadcom.com>

On Wed, Oct 05, 2011 at 04:08:47PM +0200, Arend van Spriel wrote:
> With number of cleanup patch series merged in by Greg KH, I'd like to
> once again propose moving brcm80211 out of staging and into mainline.
> 
> I've put together a patch to add a copy of the current sources from
> staging-next into drivers/net/wireless/brcm80211 of the wireless-next
> repository.
> 
> The patch is somewhat large, so I've posted the patch at:
> 
> http://linuxwireless.org/en/users/Drivers/brcm80211?action=AttachFile&do=view&target=0001-net-wireless-add-brcm80211-drivers-v3.patch

Feel free to complain, but I plan to merge this in time for the merge
window unless someone identifies a true "showstopper" problem with
this patch in the next day or so.

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

^ permalink raw reply

* Re: [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup
From: Hauke Mehrtens @ 2011-10-05 14:40 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: gregkh, devel, linux-wireless
In-Reply-To: <1317820814-7083-1-git-send-email-arend@broadcom.com>

On 10/05/2011 03:19 PM, Arend van Spriel wrote:
> This series addresses more community feedback items received on mainline
> patch (v2) posted August 25, 2011. The driver structures in brcmfmac could
> do with some tidying and in the brcmsmac variables loaded from srom were
> accessed by string identifiers. This has been replaced by enumerated
> identifiers and the entries are stored in kernel standard linked list.
> 
> This series applies to staging-next and depends on the patch series posted
> on Oct 4, 2011 (see Message-ID below).
> 
> Message-ID: <1317763152-17607-1-git-send-email-arend@broadcom.com>
> 
> Arend van Spriel (11):
>   staging: brcm80211: move driver variable functions to srom.c
>   staging: brcm80211: remove code duplication for driver variable
>     lookup
>   staging: brcm80211: change parameter in driver variable lookup
>   staging: brcm80211: remove locking macro definitions
>   staging: brcm80211: fix thread blocking issue in
>     brcmf_sdbrcm_bus_stop()
>   staging: brcm80211: remove invalid variable lookup from srom
>   staging: brcm80211: use identifiers instead of string for srom lookup
>   staging: brcm80211: use enum identifiers in srom variable tables
>   staging: brcm80211: replace string based variable storage by linked
>     list
>   staging: brcm80211: remove parameter 'off' from _initvars_srom_pci()
>   staging: brcm80211: cleanup driver variable references
> 
> Franky Lin (4):
>   staging: brcm80211: remove threads_only code from fullmac
>   staging: brcm80211: remove redundant bus register layer from fullmac
>   staging: brcm80211: clean up struct brcmf_if in fullmac
>   staging: brcm80211: remove brcmf_op_if from fullmac
> 
>  drivers/staging/brcm80211/brcmfmac/bcmsdh.c       |   10 -
>  drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c |   16 +-
>  drivers/staging/brcm80211/brcmfmac/dhd_linux.c    |  134 +--
>  drivers/staging/brcm80211/brcmfmac/dhd_sdio.c     |  133 +--
>  drivers/staging/brcm80211/brcmfmac/sdio_host.h    |    4 -
>  drivers/staging/brcm80211/brcmsmac/aiutils.c      |   32 +-
>  drivers/staging/brcm80211/brcmsmac/aiutils.h      |    6 +-
>  drivers/staging/brcm80211/brcmsmac/antsel.c       |   15 +-
>  drivers/staging/brcm80211/brcmsmac/channel.c      |    2 +-
>  drivers/staging/brcm80211/brcmsmac/mac80211_if.c  |  157 ++--
>  drivers/staging/brcm80211/brcmsmac/main.c         |  144 +---
>  drivers/staging/brcm80211/brcmsmac/main.h         |    5 -
>  drivers/staging/brcm80211/brcmsmac/nicpci.c       |    5 +-
>  drivers/staging/brcm80211/brcmsmac/nicpci.h       |    2 +-
>  drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c  |   42 +-
>  drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h  |    4 +-
>  drivers/staging/brcm80211/brcmsmac/phy/phy_int.h  |    7 -
>  drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c  |   64 +-
>  drivers/staging/brcm80211/brcmsmac/phy/phy_n.c    |  330 ++++--
>  drivers/staging/brcm80211/brcmsmac/phy_shim.c     |    9 +
>  drivers/staging/brcm80211/brcmsmac/phy_shim.h     |    4 +
>  drivers/staging/brcm80211/brcmsmac/pub.h          |  263 +++++-
>  drivers/staging/brcm80211/brcmsmac/srom.c         | 1124 +++++++++++----------
>  drivers/staging/brcm80211/brcmsmac/srom.h         |    4 +-
>  drivers/staging/brcm80211/brcmsmac/stf.c          |    4 +-
>  25 files changed, 1342 insertions(+), 1178 deletions(-)
> 
Hi Arend,

the code handling sprom looks better that before, but why don't you use
a struct for the sprom and put all the stuff into it like it is done in
ssb/bcma? We have haven't observance any problem using structs in b43 on
pci bus and SoCs with a nvram storing the sprom variables.

I found some references to SROM4_ and other older version, but I think
this driver only supports devices with sprom 8 and 9.

Hauke

^ permalink raw reply

* Re: [PATCH v3] move brcm80211 drivers to mainline
From: Johannes Berg @ 2011-10-05 14:56 UTC (permalink / raw)
  To: Arend van Spriel
  Cc: John W. Linville, linux-wireless@vger.kernel.org,
	devel@linuxdriverproject.org, Brett Rudley, Franky (Zhenhui) Lin,
	Roland Vossen, Alwin Beukers, gregkh@suse.de
In-Reply-To: <4E8C64EF.3070203@broadcom.com>

On Wed, 2011-10-05 at 16:08 +0200, Arend van Spriel wrote:
With number of cleanup patch series merged in by Greg KH, I'd like to
> once again propose moving brcm80211 out of staging and into mainline.
> 
> I've put together a patch to add a copy of the current sources from
> staging-next into drivers/net/wireless/brcm80211 of the wireless-next
> repository.
> 
> The patch is somewhat large, so I've posted the patch at:
> 
> http://linuxwireless.org/en/users/Drivers/brcm80211?action=AttachFile&do=view&target=0001-net-wireless-add-brcm80211-drivers-v3.patch

Some comments.

I sort of understand your fascination with "generic utils" but they're
wasteful if they're in a single driver only. They should either be made
more generic (for all drivers) or dissolved, so:

 * You can get rid of BRCMS_BITSCNT and brcmu_bitcount, they're no
   longer used at all.
 * brcmu_mhz2channel isn't used anywhere either
 * neither is brcmu_chspec_ctlchan
 * brcmu_mw_to_qdbm is used only in a single file,
   it can move there to save the export etc.
 * same for brcmu_qdbm_to_mw, brcmu_chipname, brcmu_parse_tlvs,
   brcmu_chspec_malformed
 * brcmu_mkiovar is used only in fmac, so you can move it there
   to save the export
 * brcmu_format_flags is used only in smac, so same
 * same for brcmu_format_flags

After all the above, bcmutils are left with only the pktq and pktbuf
stuff, which hopefully will be either more generic or dissolved at some
point in the future since it should really just be a few skb queues.

Now the drivers :-)

FMAC:
 * A whole bunch of things in dhd.h still seem to lack endian
   annotations, which I wouldn't be too worried about, if it didn't
   also seem to lack conversions. For example brcmf_pkt_filter_enable,
   brcmf_pkt_filter, brcmf_pkt_filter_pattern.
 * These, along with others like brcmf_bss_info, also seem to lack
   __packed annotations. I thought you fixed all this, what am I
   missing?
 * bss_info[1]; and similar should just be [] I think?
 * some very odd indentation on line 1172 of wl_cfg80211.c

SMAC:
 * do you really want to be 40MHz intolerant all the time? not
   supporting 40 MHz is one thing, but being intolerant?
 * brcms_ops_stop doesn't seem right -- this should really power down
   the device, this shouldn't be done per interface since the monitor
   case will want to RX/TX even when no interface is there; also, you'll
   want multi-vif support soon :-)
 * locking tx() is inefficient, you should be able to go with a lock per
   HW queue
 * brcms_ops_sta_add is strange -- it shouldn't be modifying the station
   parameters, why would it do that? seems like a bug to me, especially
   always assuming the peer can do greenfield etc. This data should
   already be set by mac80211, if not that's a bug, not something to
   "fix" in the driver
 * I still think things like brcms_msleep() are guaranteed to create
   subtle locking bugs that are almost impossible to find since it drops
   the spinlock and if somebody calls the function somewhere they won't
   necessarily keep that in mind. There are a whole bunch of functions
   behaving like that.


Anyway, the code is now readable to me, I see no glaring mac80211 or
cfg80211 interfacing errors, so I guess you can work the rest in
mainline.

johannes


^ permalink raw reply

* Re: [PATCH v3] move brcm80211 drivers to mainline
From: Hauke Mehrtens @ 2011-10-05 15:06 UTC (permalink / raw)
  To: Arend van Spriel
  Cc: John W. Linville, linux-wireless@vger.kernel.org,
	devel@linuxdriverproject.org, Brett Rudley, Franky (Zhenhui) Lin,
	Roland Vossen, Alwin Beukers, gregkh@suse.de
In-Reply-To: <4E8C64EF.3070203@broadcom.com>

On 10/05/2011 04:08 PM, Arend van Spriel wrote:
> With number of cleanup patch series merged in by Greg KH, I'd like to
> once again propose moving brcm80211 out of staging and into mainline.
> 
> I've put together a patch to add a copy of the current sources from
> staging-next into drivers/net/wireless/brcm80211 of the wireless-next
> repository.
> 
> The patch is somewhat large, so I've posted the patch at:
> 
> http://linuxwireless.org/en/users/Drivers/brcm80211?action=AttachFile&do=view&target=0001-net-wireless-add-brcm80211-drivers-v3.patch
> 
> 
> Changes from the previous version:
> 
> V3:
> - remove -D line from Makefiles
> - use endian annotated structures
> - enable sparse endian checking
> - remove use of (static) global variables
> - remove own buffer printing implementation
> - remove static function prototypes
> - replace macros by inline functions
> - reduce sparse warnings
> - remove using string-based iovars
> - remove driver internal use of ioctls
> - remove (un)likely
> - remove uncoditional curly braces for variable scoping
> - remove error messages upon alloc failures
> - reduced code indentation levels
> - cleanup in brcmutil module
> - remove changing lock state which is acquired by other layer
> (wpa_supplicant)
> - brcmfmac:
>     - use ffs() instead of brcmf_find_msb()
>     - replace threads with work queues
>     - cleanup module parameters
> - brcmsmac:
>     - not modifying ssn value upon AMPDU start
>     - use hweight8() instead of brcmu_bitcount()
>     - remove unnecessary mac80211 callbacks
>     - remove brcms_c_set_par and get_par functions
>     - remove bmac wrapper functions
>     - remove lock related macros
>     - add debugfs based event tracing (not functional in staging)
> 
> The brcmsmac driver has been verified to work on x86 (both 32- and
> 64-bit), PPC
> (64-bit), SPARC, MIPS BE, and ARM.  The brcmfmac driver has been
> verified to
> work on x86 32-bit and ARM (additional testing is in progress, but
> getting a
> working sdio controller on some of the other platforms remains
> challenging).
> 
> The drivers compile cleanly for x86 (32- and 64-bit), PPC (32- and 64-bit),
> SPARC, MIPS BE, MIPS LE, and ARM.
> 
> Thanks,
> Arend van Spriel
> 
Hi Arend,

Most of the things defined in
drivers/net/wireless/brcm80211/include/soc.h are also defined in
drivers/net/wireless/brcm80211/brcmsmac/aiutils.h.

Hauke

^ permalink raw reply

* Re: 答复: 答复: 答复: 3.1-rc6+ rtl8192se issue
From: Borislav Petkov @ 2011-10-05 15:15 UTC (permalink / raw)
  To: Larry Finger; +Cc: 李朝明, linux-wireless, 'LKML'
In-Reply-To: <4E83D092.7010405@lwfinger.net>

On Wed, Sep 28, 2011 at 08:57:38PM -0500, Larry Finger wrote:
> Asa you probably do not want to kill your standard tree, unpack the
> Realtek version normally, cd to where it unpacked, and do a make.
> Once it builds, do the following:
> 
> sudo modprobe -rv rtl8192se
> sudo modprobe -v mac80211
> sudo insmod rtlwifi.ko
> sudo insmod rtl8192se/rtl8192se.ko
> 
> >
> >Also, any preferred module parameters settings you want me to test?
> 
> Try it first with the default parameters. If that fails, use "ips=0".

Ok, I can cautiosly say now that after a couple days of running the
Realtek version that the box runs just fine, no hiccups whatsoever.

Larry, you said in an earlier mail that you've gone through the
rtl8192se changes and weren't optimistic with the attached diff you sent
me. What about the rtlwifi changes, is there something in Realtek's
version which is missing upstream that would cause the sluggishness?

Thanks.

-- 
Regards/Gruss,
Boris.

^ permalink raw reply

* RE: [PATCH v3] move brcm80211 drivers to mainline
From: Arend Van Spriel @ 2011-10-05 15:34 UTC (permalink / raw)
  To: Johannes Berg
  Cc: John W. Linville, linux-wireless@vger.kernel.org,
	devel@linuxdriverproject.org, Brett Rudley, Franky (Zhenhui) Lin,
	Roland Vossen, Alwin Beukers, gregkh@suse.de
In-Reply-To: <1317826602.4839.46.camel@jlt3.sipsolutions.net>

PiBGcm9tOiBKb2hhbm5lcyBCZXJnIFttYWlsdG86am9oYW5uZXNAc2lwc29sdXRpb25zLm5ldF0N
Cj4gU2VudDogd29lbnNkYWcgNSBva3RvYmVyIDIwMTEgMTY6NTcNCj4gDQo+IFNvbWUgY29tbWVu
dHMuDQo+IA0KPiBJIHNvcnQgb2YgdW5kZXJzdGFuZCB5b3VyIGZhc2NpbmF0aW9uIHdpdGggImdl
bmVyaWMgdXRpbHMiIGJ1dCB0aGV5J3JlDQo+IHdhc3RlZnVsIGlmIHRoZXkncmUgaW4gYSBzaW5n
bGUgZHJpdmVyIG9ubHkuIFRoZXkgc2hvdWxkIGVpdGhlciBiZSBtYWRlDQo+IG1vcmUgZ2VuZXJp
YyAoZm9yIGFsbCBkcml2ZXJzKSBvciBkaXNzb2x2ZWQsIHNvOg0KPiANCj4gICogWW91IGNhbiBn
ZXQgcmlkIG9mIEJSQ01TX0JJVFNDTlQgYW5kIGJyY211X2JpdGNvdW50LCB0aGV5J3JlIG5vDQo+
ICAgIGxvbmdlciB1c2VkIGF0IGFsbC4NCj4gICogYnJjbXVfbWh6MmNoYW5uZWwgaXNuJ3QgdXNl
ZCBhbnl3aGVyZSBlaXRoZXINCj4gICogbmVpdGhlciBpcyBicmNtdV9jaHNwZWNfY3RsY2hhbg0K
PiAgKiBicmNtdV9td190b19xZGJtIGlzIHVzZWQgb25seSBpbiBhIHNpbmdsZSBmaWxlLA0KPiAg
ICBpdCBjYW4gbW92ZSB0aGVyZSB0byBzYXZlIHRoZSBleHBvcnQgZXRjLg0KPiAgKiBzYW1lIGZv
ciBicmNtdV9xZGJtX3RvX213LCBicmNtdV9jaGlwbmFtZSwgYnJjbXVfcGFyc2VfdGx2cywNCj4g
ICAgYnJjbXVfY2hzcGVjX21hbGZvcm1lZA0KPiAgKiBicmNtdV9ta2lvdmFyIGlzIHVzZWQgb25s
eSBpbiBmbWFjLCBzbyB5b3UgY2FuIG1vdmUgaXQgdGhlcmUNCj4gICAgdG8gc2F2ZSB0aGUgZXhw
b3J0DQo+ICAqIGJyY211X2Zvcm1hdF9mbGFncyBpcyB1c2VkIG9ubHkgaW4gc21hYywgc28gc2Ft
ZQ0KPiAgKiBzYW1lIGZvciBicmNtdV9mb3JtYXRfZmxhZ3MNCj4gDQo+IEFmdGVyIGFsbCB0aGUg
YWJvdmUsIGJjbXV0aWxzIGFyZSBsZWZ0IHdpdGggb25seSB0aGUgcGt0cSBhbmQgcGt0YnVmDQo+
IHN0dWZmLCB3aGljaCBob3BlZnVsbHkgd2lsbCBiZSBlaXRoZXIgbW9yZSBnZW5lcmljIG9yIGRp
c3NvbHZlZCBhdCBzb21lDQo+IHBvaW50IGluIHRoZSBmdXR1cmUgc2luY2UgaXQgc2hvdWxkIHJl
YWxseSBqdXN0IGJlIGEgZmV3IHNrYiBxdWV1ZXMuDQoNCkFncmVlLiBUaGVyZSBpcyBvcHBvcnR1
bml0eSB0byBjbGVhbnVwIG9uIHRoZSBicmNtdXRpbCBtb2R1bGUgb3INCmV2ZW4gZ2V0IHJpZCBv
ZiBpdC4NCg0KPiBOb3cgdGhlIGRyaXZlcnMgOi0pDQo+IA0KPiBGTUFDOg0KPiAgKiBBIHdob2xl
IGJ1bmNoIG9mIHRoaW5ncyBpbiBkaGQuaCBzdGlsbCBzZWVtIHRvIGxhY2sgZW5kaWFuDQo+ICAg
IGFubm90YXRpb25zLCB3aGljaCBJIHdvdWxkbid0IGJlIHRvbyB3b3JyaWVkIGFib3V0LCBpZiBp
dCBkaWRuJ3QNCj4gICAgYWxzbyBzZWVtIHRvIGxhY2sgY29udmVyc2lvbnMuIEZvciBleGFtcGxl
IGJyY21mX3BrdF9maWx0ZXJfZW5hYmxlLA0KPiAgICBicmNtZl9wa3RfZmlsdGVyLCBicmNtZl9w
a3RfZmlsdGVyX3BhdHRlcm4uDQo+ICAqIFRoZXNlLCBhbG9uZyB3aXRoIG90aGVycyBsaWtlIGJy
Y21mX2Jzc19pbmZvLCBhbHNvIHNlZW0gdG8gbGFjaw0KPiAgICBfX3BhY2tlZCBhbm5vdGF0aW9u
cy4gSSB0aG91Z2h0IHlvdSBmaXhlZCBhbGwgdGhpcywgd2hhdCBhbSBJDQo+ICAgIG1pc3Npbmc/
DQo+ICAqIGJzc19pbmZvWzFdOyBhbmQgc2ltaWxhciBzaG91bGQganVzdCBiZSBbXSBJIHRoaW5r
Pw0KPiAgKiBzb21lIHZlcnkgb2RkIGluZGVudGF0aW9uIG9uIGxpbmUgMTE3MiBvZiB3bF9jZmc4
MDIxMS5jDQo+IA0KPiBTTUFDOg0KPiAgKiBkbyB5b3UgcmVhbGx5IHdhbnQgdG8gYmUgNDBNSHog
aW50b2xlcmFudCBhbGwgdGhlIHRpbWU/IG5vdA0KPiAgICBzdXBwb3J0aW5nIDQwIE1IeiBpcyBv
bmUgdGhpbmcsIGJ1dCBiZWluZyBpbnRvbGVyYW50Pw0KPiAgKiBicmNtc19vcHNfc3RvcCBkb2Vz
bid0IHNlZW0gcmlnaHQgLS0gdGhpcyBzaG91bGQgcmVhbGx5IHBvd2VyIGRvd24NCj4gICAgdGhl
IGRldmljZSwgdGhpcyBzaG91bGRuJ3QgYmUgZG9uZSBwZXIgaW50ZXJmYWNlIHNpbmNlIHRoZSBt
b25pdG9yDQo+ICAgIGNhc2Ugd2lsbCB3YW50IHRvIFJYL1RYIGV2ZW4gd2hlbiBubyBpbnRlcmZh
Y2UgaXMgdGhlcmU7IGFsc28sDQo+IHlvdSdsbA0KPiAgICB3YW50IG11bHRpLXZpZiBzdXBwb3J0
IHNvb24gOi0pDQoNCkFncmVlLiBXZSBub3RpY2VkIHJlYWRpbmcgbWFjODAyMTEuaCB3aXRoIHN0
YXRlbWVudCBhYm91dCBhZGRfaW50ZXJmYWNlDQpjYWxsYmFjayBub3QgYmVpbmcgdXNlZCBpbiBt
b25pdG9yIG1vZGUuDQoNCj4gICogbG9ja2luZyB0eCgpIGlzIGluZWZmaWNpZW50LCB5b3Ugc2hv
dWxkIGJlIGFibGUgdG8gZ28gd2l0aCBhIGxvY2sNCj4gcGVyDQo+ICAgIEhXIHF1ZXVlDQo+ICAq
IGJyY21zX29wc19zdGFfYWRkIGlzIHN0cmFuZ2UgLS0gaXQgc2hvdWxkbid0IGJlIG1vZGlmeWlu
ZyB0aGUNCj4gc3RhdGlvbg0KPiAgICBwYXJhbWV0ZXJzLCB3aHkgd291bGQgaXQgZG8gdGhhdD8g
c2VlbXMgbGlrZSBhIGJ1ZyB0byBtZSwgZXNwZWNpYWxseQ0KPiAgICBhbHdheXMgYXNzdW1pbmcg
dGhlIHBlZXIgY2FuIGRvIGdyZWVuZmllbGQgZXRjLiBUaGlzIGRhdGEgc2hvdWxkDQo+ICAgIGFs
cmVhZHkgYmUgc2V0IGJ5IG1hYzgwMjExLCBpZiBub3QgdGhhdCdzIGEgYnVnLCBub3Qgc29tZXRo
aW5nIHRvDQo+ICAgICJmaXgiIGluIHRoZSBkcml2ZXINCj4gICogSSBzdGlsbCB0aGluayB0aGlu
Z3MgbGlrZSBicmNtc19tc2xlZXAoKSBhcmUgZ3VhcmFudGVlZCB0byBjcmVhdGUNCj4gICAgc3Vi
dGxlIGxvY2tpbmcgYnVncyB0aGF0IGFyZSBhbG1vc3QgaW1wb3NzaWJsZSB0byBmaW5kIHNpbmNl
IGl0DQo+IGRyb3BzDQo+ICAgIHRoZSBzcGlubG9jayBhbmQgaWYgc29tZWJvZHkgY2FsbHMgdGhl
IGZ1bmN0aW9uIHNvbWV3aGVyZSB0aGV5IHdvbid0DQo+ICAgIG5lY2Vzc2FyaWx5IGtlZXAgdGhh
dCBpbiBtaW5kLiBUaGVyZSBhcmUgYSB3aG9sZSBidW5jaCBvZiBmdW5jdGlvbnMNCj4gICAgYmVo
YXZpbmcgbGlrZSB0aGF0Lg0KDQpBZ3JlZS4gVGhlIGxvY2tpbmcgc3RyYXRlZ3kgaW4gdGhlIGRy
aXZlciB3b3JrcyBhbmQgaGFzIGJlZW4gcHJvdmVuDQp0byB3b3JrIGZvciB0aGUgY3VycmVudCBj
b2RlIGJhc2UgaW4gbWFueSB0ZXN0IGN5Y2xlcywgYnV0IGl0IHBvc2VzDQphIHJpc2sgZm9yIHVw
Y29taW5nIGZlYXR1cmUgZGV2ZWxvcG1lbnQuDQoNCj4gDQo+IEFueXdheSwgdGhlIGNvZGUgaXMg
bm93IHJlYWRhYmxlIHRvIG1lLCBJIHNlZSBubyBnbGFyaW5nIG1hYzgwMjExIG9yDQo+IGNmZzgw
MjExIGludGVyZmFjaW5nIGVycm9ycywgc28gSSBndWVzcyB5b3UgY2FuIHdvcmsgdGhlIHJlc3Qg
aW4NCj4gbWFpbmxpbmUuDQo+IA0KPiBqb2hhbm5lcw0KPiANCg0KVGhhbmtzIGZvciB0aGUgZmVl
ZGJhY2suIFRoZXNlIGFyZSBhbGwgdmFsaWQgcG9pbnRzIGFuZCBhcyBzdWNoIGRlc2VydmUNCm91
ciBhdHRlbnRpb24uDQoNCkFyZW5kDQo=


^ permalink raw reply

* RE: [PATCH v3] move brcm80211 drivers to mainline
From: Arend Van Spriel @ 2011-10-05 15:40 UTC (permalink / raw)
  To: Hauke Mehrtens
  Cc: John W. Linville, linux-wireless@vger.kernel.org,
	devel@linuxdriverproject.org, Brett Rudley, Franky (Zhenhui) Lin,
	Roland Vossen, Alwin Beukers, gregkh@suse.de
In-Reply-To: <4E8C7289.50706@hauke-m.de>

> From: Hauke Mehrtens [mailto:hauke@hauke-m.de]
> Sent: woensdag 5 oktober 2011 17:07
> 
> Hi Arend,
> 
> Most of the things defined in
> drivers/net/wireless/brcm80211/include/soc.h are also defined in
> drivers/net/wireless/brcm80211/brcmsmac/aiutils.h.
> 
> Hauke

Thanks, Hauke

One of the reasons we wanted to move to mainline is that bcma
is worked on from John's repo and we want our brcmsmac driver
to use that. The aiutils.h file is going away when we are
using bcma.

Gr. AvS


^ permalink raw reply

* Re: [PATCH v3] move brcm80211 drivers to mainline
From: Larry Finger @ 2011-10-05 15:44 UTC (permalink / raw)
  To: Arend Van Spriel
  Cc: Hauke Mehrtens, John W. Linville, linux-wireless@vger.kernel.org,
	devel@linuxdriverproject.org, Brett Rudley, Franky (Zhenhui) Lin,
	Roland Vossen, Alwin Beukers, gregkh@suse.de
In-Reply-To: <400C43189542CE41BC0A5B252FC90136BC0D574E7D@SJEXCHCCR02.corp.ad.broadcom.com>

On 10/05/2011 10:40 AM, Arend Van Spriel wrote:
>> From: Hauke Mehrtens [mailto:hauke@hauke-m.de]
>> Sent: woensdag 5 oktober 2011 17:07
>>
>> Hi Arend,
>>
>> Most of the things defined in
>> drivers/net/wireless/brcm80211/include/soc.h are also defined in
>> drivers/net/wireless/brcm80211/brcmsmac/aiutils.h.
>>
>> Hauke
>
> Thanks, Hauke
>
> One of the reasons we wanted to move to mainline is that bcma
> is worked on from John's repo and we want our brcmsmac driver
> to use that. The aiutils.h file is going away when we are
> using bcma.

Good to hear that patches to switch to bcma will be coming soon.

Larry


^ permalink raw reply

* RE: [PATCH v3] move brcm80211 drivers to mainline
From: Arend Van Spriel @ 2011-10-05 16:38 UTC (permalink / raw)
  To: Larry Finger
  Cc: Hauke Mehrtens, John W. Linville, linux-wireless@vger.kernel.org,
	devel@linuxdriverproject.org, Brett Rudley, Franky (Zhenhui) Lin,
	Roland Vossen, Alwin Beukers, gregkh@suse.de
In-Reply-To: <4E8C7B72.8070106@lwfinger.net>

> From: Larry Finger [mailto:larry.finger@gmail.com] On Behalf Of Larry
> Finger
> Sent: woensdag 5 oktober 2011 17:45
> 
> On 10/05/2011 10:40 AM, Arend Van Spriel wrote:
> >> From: Hauke Mehrtens [mailto:hauke@hauke-m.de]
> >> Sent: woensdag 5 oktober 2011 17:07
> >>
> >> Hi Arend,
> >>
> >> Most of the things defined in
> >> drivers/net/wireless/brcm80211/include/soc.h are also defined in
> >> drivers/net/wireless/brcm80211/brcmsmac/aiutils.h.
> >>
> >> Hauke
> >
> > Thanks, Hauke
> >
> > One of the reasons we wanted to move to mainline is that bcma
> > is worked on from John's repo and we want our brcmsmac driver
> > to use that. The aiutils.h file is going away when we are
> > using bcma.
> 
> Good to hear that patches to switch to bcma will be coming soon.
> 
> Larry
> 

Hi Larry,

Reading between the lines? ;-) It will not be there yesterday, but
we will definitely make an effort to make that switch. Work was
started on it but other cleanup was interfering so we decided
to focus on the cleanup.

Gr. AvS


^ permalink raw reply

* Re: [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup
From: Arend van Spriel @ 2011-10-05 16:56 UTC (permalink / raw)
  To: Hauke Mehrtens
  Cc: gregkh@suse.de, devel@linuxdriverproject.org,
	linux-wireless@vger.kernel.org
In-Reply-To: <4E8C6C77.9000402@hauke-m.de>

On 10/05/2011 04:40 PM, Hauke Mehrtens wrote:
> On 10/05/2011 03:19 PM, Arend van Spriel wrote:
>> This series addresses more community feedback items received on mainline
>> patch (v2) posted August 25, 2011. The driver structures in brcmfmac could
>> do with some tidying and in the brcmsmac variables loaded from srom were
>> accessed by string identifiers. This has been replaced by enumerated
>> identifiers and the entries are stored in kernel standard linked list.
>>
>> This series applies to staging-next and depends on the patch series posted
>> on Oct 4, 2011 (see Message-ID below).
>>
>> Message-ID:<1317763152-17607-1-git-send-email-arend@broadcom.com>
>>
>> Arend van Spriel (11):
>>    staging: brcm80211: move driver variable functions to srom.c
>>    staging: brcm80211: remove code duplication for driver variable
>>      lookup
>>    staging: brcm80211: change parameter in driver variable lookup
>>    staging: brcm80211: remove locking macro definitions
>>    staging: brcm80211: fix thread blocking issue in
>>      brcmf_sdbrcm_bus_stop()
>>    staging: brcm80211: remove invalid variable lookup from srom
>>    staging: brcm80211: use identifiers instead of string for srom lookup
>>    staging: brcm80211: use enum identifiers in srom variable tables
>>    staging: brcm80211: replace string based variable storage by linked
>>      list
>>    staging: brcm80211: remove parameter 'off' from _initvars_srom_pci()
>>    staging: brcm80211: cleanup driver variable references
>>
>> Franky Lin (4):
>>    staging: brcm80211: remove threads_only code from fullmac
>>    staging: brcm80211: remove redundant bus register layer from fullmac
>>    staging: brcm80211: clean up struct brcmf_if in fullmac
>>    staging: brcm80211: remove brcmf_op_if from fullmac
>>
>>   drivers/staging/brcm80211/brcmfmac/bcmsdh.c       |   10 -
>>   drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c |   16 +-
>>   drivers/staging/brcm80211/brcmfmac/dhd_linux.c    |  134 +--
>>   drivers/staging/brcm80211/brcmfmac/dhd_sdio.c     |  133 +--
>>   drivers/staging/brcm80211/brcmfmac/sdio_host.h    |    4 -
>>   drivers/staging/brcm80211/brcmsmac/aiutils.c      |   32 +-
>>   drivers/staging/brcm80211/brcmsmac/aiutils.h      |    6 +-
>>   drivers/staging/brcm80211/brcmsmac/antsel.c       |   15 +-
>>   drivers/staging/brcm80211/brcmsmac/channel.c      |    2 +-
>>   drivers/staging/brcm80211/brcmsmac/mac80211_if.c  |  157 ++--
>>   drivers/staging/brcm80211/brcmsmac/main.c         |  144 +---
>>   drivers/staging/brcm80211/brcmsmac/main.h         |    5 -
>>   drivers/staging/brcm80211/brcmsmac/nicpci.c       |    5 +-
>>   drivers/staging/brcm80211/brcmsmac/nicpci.h       |    2 +-
>>   drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c  |   42 +-
>>   drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h  |    4 +-
>>   drivers/staging/brcm80211/brcmsmac/phy/phy_int.h  |    7 -
>>   drivers/staging/brcm80211/brcmsmac/phy/phy_lcn.c  |   64 +-
>>   drivers/staging/brcm80211/brcmsmac/phy/phy_n.c    |  330 ++++--
>>   drivers/staging/brcm80211/brcmsmac/phy_shim.c     |    9 +
>>   drivers/staging/brcm80211/brcmsmac/phy_shim.h     |    4 +
>>   drivers/staging/brcm80211/brcmsmac/pub.h          |  263 +++++-
>>   drivers/staging/brcm80211/brcmsmac/srom.c         | 1124 +++++++++++----------
>>   drivers/staging/brcm80211/brcmsmac/srom.h         |    4 +-
>>   drivers/staging/brcm80211/brcmsmac/stf.c          |    4 +-
>>   25 files changed, 1342 insertions(+), 1178 deletions(-)
>>
> Hi Arend,
>
> the code handling sprom looks better that before, but why don't you use
> a struct for the sprom and put all the stuff into it like it is done in
> ssb/bcma? We have haven't observance any problem using structs in b43 on
> pci bus and SoCs with a nvram storing the sprom variables.

If all lookup is done during driver initialization I guess it is not 
such a problem. I do not know how much cycles are involved in sprom or 
nvram access so it may not even matter.

> I found some references to SROM4_ and other older version, but I think
> this driver only supports devices with sprom 8 and 9.
>
> Hauke

Older sprom revisions can indeed go.

Thanks,
Arend



^ permalink raw reply

* Re: [PATCH v13 5/5] ath9k: implement .get_antenna and .set_antenna
From: Daniel Smith @ 2011-10-05 18:09 UTC (permalink / raw)
  To: linux-wireless; +Cc: Felix Fietkau
In-Reply-To: <1315006827-81443-5-git-send-email-nbd@openwrt.org>

On 9/2/2011 7:40 PM, Felix Fietkau wrote:
> On MIMO chips this can be used to enable/disable hardware chains, ensuring
> that the MCS information is updated accordingly.
> On non-MIMO chips with rx diversity (e.g. 9285), this configures the rx
> input antenna.

I have been working with this patch as I needed the ability to select 
the rx chain/antenna on an AR9820.. A problem I have ran into is that 
regardless of what I set the antenna chain to, the radiotap header 
always reports antenna 1. I know this originates from the rx status 
descriptor, but is this really what should be used to report the antenna 
when using chains to select the antenna?

V/r,
Daniel


^ permalink raw reply

* Compat-wireless release for 2011-10-05 is baked
From: Compat-wireless cronjob account @ 2011-10-05 19:04 UTC (permalink / raw)
  To: linux-wireless

>From git://github.com/mcgrof/compat-wireless
   ed03ef8..2309ddb  master     -> origin/master
>From git://github.com/mcgrof/compat
   2239769..966e847  master     -> origin/master
>From git://github.com/sfrothwell/linux-next
 + 8f37235...a2851f2 akpm-end   -> origin/akpm-end  (forced update)
   0f86267..a8062e4  akpm-start -> origin/akpm-start
 + db5dbd6...09d70e2 master     -> origin/master  (forced update)
   0f86267..a8062e4  stable     -> origin/stable
 * [new tag]         next-20111005 -> next-20111005
/usr/bin/sha1sum: *.tar.bz2: No such file or directory

compat-wireless code metrics

    812096 - Total upstream lines of code being pulled
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(601) [sender=3.0.7]

^ permalink raw reply

* RE: mwifiex: add cfg80211 handlers add/del_virtual_intf
From: Bing Zhao @ 2011-10-05 19:08 UTC (permalink / raw)
  To: Dan Carpenter, Yogesh Powar; +Cc: linux-wireless@vger.kernel.org
In-Reply-To: <20111005060744.GB32513@elgon.mountain>

Hi Dan,

Thanks for your comment.

> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> Sent: Tuesday, October 04, 2011 11:08 PM
> To: Yogesh Powar
> Cc: Bing Zhao; linux-wireless@vger.kernel.org
> Subject: re: mwifiex: add cfg80211 handlers add/del_virtual_intf
> 
> Hi Yogesh,
> 
> The Smatch static checker complains that 93a1df48d22429 "mwifiex: add
> cfg80211 handlers add/del_virtual_intf" introduces a potential NULL
> dereference.
> 
> @@ -985,9 +817,20 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem)
>                        atomic_read(&adapter->cmd_pending));
>         }
> 
> -       /* Remove interface */
> -       for (i = 0; i < adapter->priv_num; i++)
> -               mwifiex_remove_interface(adapter, i);
> +       for (i = 0; i < adapter->priv_num; i++) {
> +               priv = adapter->priv[i];
> +
> +               if (!priv)
> +                       continue;
> +
> +               rtnl_lock();
> +               mwifiex_del_virtual_intf(priv->wdev->wiphy, priv->netdev);
> +               rtnl_unlock();
> +       }
> +
> +       wiphy_unregister(priv->wdev->wiphy);
>                          ^^^^^^^^^^
> Can priv be NULL here?  How do we know that the last element of
> adapter->priv[]; is non-NULL when we have to check the others?

That's a good catch.

Since the first element of priv[] cannot be NULL. How about this fix?

+       priv = adapter->priv[0];
+       BUG_ON(!priv);
+
        wiphy_unregister(priv->wdev->wiphy);

Thanks,
Bing

> 
> regards,
> dan carpenter

^ permalink raw reply

* Re: mwifiex: add cfg80211 handlers add/del_virtual_intf
From: Dan Carpenter @ 2011-10-05 19:52 UTC (permalink / raw)
  To: Bing Zhao; +Cc: Yogesh Powar, linux-wireless@vger.kernel.org
In-Reply-To: <477F20668A386D41ADCC57781B1F70430815597445@SC-VEXCH1.marvell.com>

On Wed, Oct 05, 2011 at 12:08:36PM -0700, Bing Zhao wrote:
> Since the first element of priv[] cannot be NULL. How about this fix?
> 
> +       priv = adapter->priv[0];
> +       BUG_ON(!priv);
> +
>         wiphy_unregister(priv->wdev->wiphy);
> 

I don't know the code at all, so I'll trust you on that.  :)

But please don't add the BUG_ON().  Calls to BUG_ON() make the code
messier, and they are more painful than needed for the user.  If we
don't have the BUG_ON() then we get an Oops and the driver will die,
but we can still can close our documents and reboot the system.

Debugging NULL dereference bugs is normally super easy.  Just compile
with CONFIG_DEBUG_INFO=y, run gdb on the .ko file and type:
"list *(function_name+0x63)" at the gdb prompt.  Done.

regards,
dan carpenter


^ permalink raw reply

* Re: [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac
From: Greg KH @ 2011-10-05 20:40 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: gregkh, devel, linux-wireless
In-Reply-To: <1317763152-17607-1-git-send-email-arend@broadcom.com>

On Tue, Oct 04, 2011 at 11:18:46PM +0200, Arend van Spriel wrote:
> Third attempt as the mailer somehow did not sent these outside the
> Broadcom intranet. Another series of cleanup changes based on community
> feedback received on the mainline patch (v2) as sent August 25, 2011.
> 
> This series is to be applied to the staging-next branch. There are no
> pending patches that this series depend on.

Applied, thanks.

greg k-h

^ permalink raw reply

* Re: [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup
From: Greg KH @ 2011-10-05 20:47 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: gregkh, devel, linux-wireless
In-Reply-To: <1317820814-7083-1-git-send-email-arend@broadcom.com>

On Wed, Oct 05, 2011 at 03:19:59PM +0200, Arend van Spriel wrote:
> This series addresses more community feedback items received on mainline
> patch (v2) posted August 25, 2011. The driver structures in brcmfmac could
> do with some tidying and in the brcmsmac variables loaded from srom were
> accessed by string identifiers. This has been replaced by enumerated
> identifiers and the entries are stored in kernel standard linked list.
> 
> This series applies to staging-next and depends on the patch series posted
> on Oct 4, 2011 (see Message-ID below).
> 
> Message-ID: <1317763152-17607-1-git-send-email-arend@broadcom.com>

All applied, thanks.

greg k-h

^ permalink raw reply

* [PATCH] mwifiex: fix smatch errors
From: Bing Zhao @ 2011-10-05 21:58 UTC (permalink / raw)
  To: linux-wireless
  Cc: John W. Linville, Amitkumar Karwar, Kiran Divekar, Yogesh Powar,
	Frank Huang, Bing Zhao, Dan Carpenter

From: Yogesh Ashok Powar <yogeshp@marvell.com>

drivers/net/wireless/mwifiex/main.c +828 mwifiex_remove_card(52)
  error: potential null derefence 'priv'.
drivers/net/wireless/mwifiex/main.c +828 mwifiex_remove_card(52)
  error: we previously assumed 'priv' could be null (see line 820)
drivers/net/wireless/mwifiex/txrx.c +90 mwifiex_process_tx(24)
  error: potential null derefence 'local_tx_pd'.
drivers/net/wireless/mwifiex/sta_ioctl.c +766
mwifiex_rate_ioctl_set_rate_value(30)
  error: buffer overflow 'rate' 14 <= 14

Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
---
 drivers/net/wireless/mwifiex/main.c      |    4 ++++
 drivers/net/wireless/mwifiex/sta_ioctl.c |    2 +-
 drivers/net/wireless/mwifiex/txrx.c      |    3 ++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
index 8486451..277ea84 100644
--- a/drivers/net/wireless/mwifiex/main.c
+++ b/drivers/net/wireless/mwifiex/main.c
@@ -825,6 +825,10 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem)
 		rtnl_unlock();
 	}
 
+	priv = adapter->priv[0];
+	if (!priv)
+		goto exit_remove;
+
 	wiphy_unregister(priv->wdev->wiphy);
 	wiphy_free(priv->wdev->wiphy);
 	kfree(priv->wdev);
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index 520800b..f20550a 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -763,7 +763,7 @@ static int mwifiex_rate_ioctl_set_rate_value(struct mwifiex_private *priv,
 			if ((rate[i] & 0x7f) == (rate_cfg->rate & 0x7f))
 				break;
 		}
-		if (!rate[i] || (i == MWIFIEX_SUPPORTED_RATES)) {
+		if ((i == MWIFIEX_SUPPORTED_RATES) || !rate[i]) {
 			dev_err(adapter->dev, "fixed data rate %#x is out "
 			       "of range\n", rate_cfg->rate);
 			return -1;
diff --git a/drivers/net/wireless/mwifiex/txrx.c b/drivers/net/wireless/mwifiex/txrx.c
index 6190b2f..5d95c4b 100644
--- a/drivers/net/wireless/mwifiex/txrx.c
+++ b/drivers/net/wireless/mwifiex/txrx.c
@@ -87,7 +87,8 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
 			(adapter->pps_uapsd_mode) &&
 			(adapter->tx_lock_flag)) {
 				priv->adapter->tx_lock_flag = false;
-				local_tx_pd->flags = 0;
+				if (local_tx_pd)
+					local_tx_pd->flags = 0;
 		}
 		dev_dbg(adapter->dev, "data: -EBUSY is returned\n");
 		break;
-- 
1.7.0.2


^ permalink raw reply related

* Re: [RFC 4/6] ath9k: add DFS build parameter
From: Luis R. Rodriguez @ 2011-10-05 22:20 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: Zefir Kurtisi, linux-wireless, ath9k-devel, kgiori
In-Reply-To: <4E8AE1CC.5060703@openwrt.org>

On Tue, Oct 4, 2011 at 3:37 AM, Felix Fietkau <nbd@openwrt.org> wrote:
> On 2011-10-04 11:55 AM, Zefir Kurtisi wrote:
>>
>> On 10/03/2011 08:26 PM, Luis R. Rodriguez wrote:
>>>
>>>  On Mon, Oct 3, 2011 at 3:29 AM, Zefir Kurtisi<zefir.kurtisi@neratec.com>
>>>  wrote:
>>>>
>>>>  Signed-off-by: Zefir Kurtisi<zefir.kurtisi@neratec.com>
>>>>  ---
>>>>  drivers/net/wireless/ath/ath9k/Kconfig  |    7 +++++++
>>>>  drivers/net/wireless/ath/ath9k/Makefile |    2 ++
>>>>  2 files changed, 9 insertions(+), 0 deletions(-)
>>>>
>>>>  diff --git a/drivers/net/wireless/ath/ath9k/Kconfig
>>>> b/drivers/net/wireless/ath/ath9k/Kconfig
>>>>  index d9c08c6..adddcca 100644
>>>>  --- a/drivers/net/wireless/ath/ath9k/Kconfig
>>>>  +++ b/drivers/net/wireless/ath/ath9k/Kconfig
>>>>  @@ -58,6 +58,13 @@ config ATH9K_RATE_CONTROL
>>>>          Say Y, if you want to use the ath9k specific rate control
>>>>          module instead of minstrel_ht.
>>>>
>>>>  +config ATH9K_DFS
>>>>  +       bool "Atheros ath9k DFS support"
>>>>  +       depends on ATH9K
>>>>  +       default y
>>>
>>>  At this point selecting y does nothing. Leave this patch out until
>>>  selecting "y" means something.
>>>
>> What do you mean by 'nothing'? It allows you to select DFS as ath9k
>> feature in your kernel configuration, or? Though, I agree that enabling it
>> by default is not a good idea.
>>
>>>  Default should be n, and in particular Atheros itself can only likely
>>>  commit to supporting DFS for AR9003 when it finds resources to do so
>>>  as well as properly test it, so DFS support kconfig should state this.
>>>  If someone wants to step up to completely support all bugs for older
>>>  families that is their prerogative but we cannot commit to it, due to
>>>  the regulatory considerations though unless this happens this cannot
>>>  and should not be enabled for older families in code.
>>>
>> In fact, AR9003 is the platform we are interested in. Although it
>> seems that older chipsets do also detect pulses with this patches
>> (AR9280 does, IIRC), I agree to limit DFS support to AR9003 (and later).
>> This should be easily possible by setting priv_ops->set_radar_params for
>> AR9003 only. I'll remove it for AR5008 in my v2 RFC.
>
> Please don't remove support code for older hardware. I'm fine with adding a
> SREV check that prevents it from being enabled by default on older hardware,
> but eventually I will need at least AR9280 DFS support for a few devices in
> OpenWrt.

That's fine, leaving it disabled is what I meant, and only once
something has been properly tested do we enable it. I personally only
want to spend my own energy on AR9003 and newer.

  Luis

^ permalink raw reply


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