Commit 7ddaad7e authored by Arend van Spriel's avatar Arend van Spriel Committed by Greg Kroah-Hartman
Browse files

staging: brcm80211: change parameter in driver variable lookup



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: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: default avatarRoland Vossen <rvossen@broadcom.com>
Reviewed-by: default avatarAlwin Beukers <alwin@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f4e5c544
Loading
Loading
Loading
Loading
+8 −10
Original line number Diff line number Diff line
@@ -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;
}
+8 −7
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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);

+15 −14
Original line number Diff line number Diff line
@@ -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);

+2 −2
Original line number Diff line number Diff line
@@ -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;
Loading