Skip to content

Commit

Permalink
staging: brcm80211: cleanup driver variable references
Browse files Browse the repository at this point in the history
Throughout the data structures within the driver several references
to the driver variables were stored. As the storage and access
functions are now consolidated into srom.c those references are
no longer needed and have been removed.

Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Alwin Beukers <alwin@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Arend van Spriel authored and Greg Kroah-Hartman committed Oct 5, 2011
1 parent 4d648c8 commit 5d3e78e
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 68 deletions.
13 changes: 4 additions & 9 deletions drivers/staging/brcm80211/brcmsmac/aiutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1025,8 +1025,7 @@ static __used void ai_nvram_process(struct si_info *sii)
}

static struct si_info *ai_doattach(struct si_info *sii,
void __iomem *regs, struct pci_dev *pbus,
char **vars, uint *varsz)
void __iomem *regs, struct pci_dev *pbus)
{
struct si_pub *sih = &sii->pub;
u32 w, savewin;
Expand Down Expand Up @@ -1091,11 +1090,9 @@ static struct si_info *ai_doattach(struct si_info *sii,
goto exit;

/* Init nvram from sprom/otp if they exist */
if (srom_var_init(&sii->pub, cc, vars, varsz))
if (srom_var_init(&sii->pub, cc))
goto exit;

sii->vars = vars ? *vars : NULL;
sii->varsz = varsz ? *varsz : 0;
ai_nvram_process(sii);

/* === NVRAM, clock is ready === */
Expand Down Expand Up @@ -1172,11 +1169,9 @@ static struct si_info *ai_doattach(struct si_info *sii,
* devid - pci device id (used to determine chip#)
* osh - opaque OS handle
* regs - virtual address of initial core registers
* vars - pointer to a pointer area for "environment" variables
* varsz - pointer to int to return the size of the vars
*/
struct si_pub *
ai_attach(void __iomem *regs, struct pci_dev *sdh, char **vars, uint *varsz)
ai_attach(void __iomem *regs, struct pci_dev *sdh)
{
struct si_info *sii;

Expand All @@ -1185,7 +1180,7 @@ ai_attach(void __iomem *regs, struct pci_dev *sdh, char **vars, uint *varsz)
if (sii == NULL)
return NULL;

if (ai_doattach(sii, regs, sdh, vars, varsz) == NULL) {
if (ai_doattach(sii, regs, sdh) == NULL) {
kfree(sii);
return NULL;
}
Expand Down
5 changes: 1 addition & 4 deletions drivers/staging/brcm80211/brcmsmac/aiutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,6 @@ struct si_info {
struct pcicore_info *pch; /* PCI/E core handle */

struct list_head var_list; /* list of srom variables */
char *vars;
uint varsz;

void __iomem *curmap; /* current regs va */
void __iomem *regs[SI_MAXCORES]; /* other regs va */
Expand Down Expand Up @@ -320,8 +318,7 @@ extern u32 ai_addrspacesize(struct si_pub *sih, uint asidx);
extern void ai_write_wrap_reg(struct si_pub *sih, u32 offset, u32 val);

/* === exported functions === */
extern struct si_pub *ai_attach(void __iomem *regs, struct pci_dev *sdh,
char **vars, uint *varsz);
extern struct si_pub *ai_attach(void __iomem *regs, struct pci_dev *sdh);
extern void ai_detach(struct si_pub *sih);
extern uint ai_coreid(struct si_pub *sih);
extern uint ai_corerev(struct si_pub *sih);
Expand Down
30 changes: 3 additions & 27 deletions drivers/staging/brcm80211/brcmsmac/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3106,16 +3106,6 @@ brcms_b_copyfrom_objmem(struct brcms_hardware *wlc_hw, uint offset, void *buf,
}
}

static void brcms_b_copyfrom_vars(struct brcms_hardware *wlc_hw, char **buf,
uint *len)
{
BCMMSG(wlc_hw->wlc->wiphy, "nvram vars totlen=%d\n",
wlc_hw->vars_size);

*buf = wlc_hw->vars;
*len = wlc_hw->vars_size;
}

static void brcms_b_retrylimit_upd(struct brcms_hardware *wlc_hw,
u16 SRL, u16 LRL)
{
Expand Down Expand Up @@ -4551,7 +4541,6 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,
struct brcms_hardware *wlc_hw;
struct d11regs __iomem *regs;
char *macaddr = NULL;
char *vars;
uint err = 0;
uint j;
bool wme = false;
Expand All @@ -4576,15 +4565,13 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,
* Do the hardware portion of the attach. Also initialize software
* state that depends on the particular hardware we are running.
*/
wlc_hw->sih = ai_attach(regsva, btparam,
&wlc_hw->vars, &wlc_hw->vars_size);
wlc_hw->sih = ai_attach(regsva, btparam);
if (wlc_hw->sih == NULL) {
wiphy_err(wiphy, "wl%d: brcms_b_attach: si_attach failed\n",
unit);
err = 11;
goto fail;
}
vars = wlc_hw->vars;

/* verify again the device is supported */
if (!brcms_c_chipmatch(vendor, device)) {
Expand Down Expand Up @@ -4692,7 +4679,6 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,
sha_params.physhim = wlc_hw->physhim;
sha_params.unit = unit;
sha_params.corerev = wlc_hw->corerev;
sha_params.vars = vars;
sha_params.vid = wlc_hw->vendorid;
sha_params.did = wlc_hw->deviceid;
sha_params.chip = wlc_hw->sih->chip;
Expand Down Expand Up @@ -4738,8 +4724,8 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,
/* Get a phy for this band */
wlc_hw->band->pi =
wlc_phy_attach(wlc_hw->phy_sh, regs,
wlc_hw->band->bandtype, vars,
wlc->wiphy);
wlc_hw->band->bandtype,
wlc->wiphy);
if (wlc_hw->band->pi == NULL) {
wiphy_err(wiphy, "wl%d: brcms_b_attach: wlc_phy_"
"attach failed\n", unit);
Expand Down Expand Up @@ -4897,12 +4883,10 @@ static bool brcms_c_attach_stf_ant_init(struct brcms_c_info *wlc)
{
int aa;
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 */
Expand Down Expand Up @@ -5092,10 +5076,6 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,

pub->phy_11ncapable = BRCMS_PHY_11N_CAP(wlc->band);

/* propagate *vars* from BMAC driver to high driver */
brcms_b_copyfrom_vars(wlc->hw, &pub->vars, &wlc->vars_size);


/* disable allowed duty cycle */
wlc->tx_duty_cycle_ofdm = 0;
wlc->tx_duty_cycle_cck = 0;
Expand Down Expand Up @@ -5304,10 +5284,6 @@ static int brcms_b_detach(struct brcms_c_info *wlc)

wlc_phy_shim_detach(wlc_hw->physhim);

/* free vars */
kfree(wlc_hw->vars);
wlc_hw->vars = NULL;

if (wlc_hw->sih) {
ai_detach(wlc_hw->sih);
wlc_hw->sih = NULL;
Expand Down
5 changes: 0 additions & 5 deletions drivers/staging/brcm80211/brcmsmac/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,6 @@ struct brcms_hardware {
u32 machwcap_backup; /* backup of machwcap */

struct si_pub *sih; /* SI handle (cookie for siutils calls) */
char *vars; /* "environment" name=value */
uint vars_size; /* size of vars, free vars on detach */
struct d11regs __iomem *regs; /* pointer to device registers */
struct phy_shim_info *physhim; /* phy shim layer handler */
struct shared_phy *phy_sh; /* pointer to shared phy state */
Expand Down Expand Up @@ -420,7 +418,6 @@ struct brcms_txq_info {
* ampdu: ampdu module handler.
* asi: antsel module handler.
* cmi: channel manager module handler.
* vars_size: size of vars, free vars on detach.
* vendorid: PCI vendor id.
* deviceid: PCI device id.
* ucode_rev: microcode revision.
Expand Down Expand Up @@ -513,8 +510,6 @@ struct brcms_c_info {
struct antsel_info *asi;
struct brcms_cm_info *cmi;

uint vars_size;

u16 vendorid;
u16 deviceid;
uint ucode_rev;
Expand Down
6 changes: 1 addition & 5 deletions drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ static u32 wlc_phy_get_radio_ver(struct brcms_phy *pi)

struct brcms_phy_pub *
wlc_phy_attach(struct shared_phy *sh, struct d11regs __iomem *regs,
int bandtype, char *vars, struct wiphy *wiphy)
int bandtype, struct wiphy *wiphy)
{
struct brcms_phy *pi;
u32 sflags = 0;
Expand Down Expand Up @@ -493,8 +493,6 @@ wlc_phy_attach(struct shared_phy *sh, struct d11regs __iomem *regs,
pi->phy_init_por = true;
pi->phy_wreg_limit = PHY_WREG_LIMIT;

pi->vars = vars;

pi->txpwr_percent = 100;

pi->do_initcal = true;
Expand Down Expand Up @@ -609,8 +607,6 @@ wlc_phy_attach(struct shared_phy *sh, struct d11regs __iomem *regs,
pi->next = pi->sh->phy_head;
sh->phy_head = pi;

pi->vars = (char *)&pi->vars;

memcpy(&pi->pubpi_ro, &pi->pubpi, sizeof(struct brcms_phy_pub));

return &pi->pubpi_ro;
Expand Down
4 changes: 1 addition & 3 deletions drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ struct shared_phy_params {
uint unit;
uint corerev;
uint buscorerev;
char *vars;
u16 vid;
u16 did;
uint chip;
Expand All @@ -185,8 +184,7 @@ struct shared_phy_params {
extern struct shared_phy *wlc_phy_shared_attach(struct shared_phy_params *shp);
extern struct brcms_phy_pub *wlc_phy_attach(struct shared_phy *sh,
struct d11regs __iomem *regs,
int bandtype, char *vars,
struct wiphy *wiphy);
int bandtype, struct wiphy *wiphy);
extern void wlc_phy_detach(struct brcms_phy_pub *ppi);

extern bool wlc_phy_get_phyversion(struct brcms_phy_pub *pih, u16 *phytype,
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/brcm80211/brcmsmac/phy/phy_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,6 @@ struct brcms_phy {

struct d11regs __iomem *regs;
struct brcms_phy *next;
char *vars;
struct brcms_phy_pub pubpi;

bool do_initcal;
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/brcm80211/brcmsmac/pub.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,6 @@ struct brcms_pub {
uint unit; /* device instance number */
uint corerev; /* core revision */
struct si_pub *sih; /* SI handle (cookie for siutils calls) */
char *vars; /* "environment" name=value */
bool up; /* interface up and running */
bool hw_off; /* HW is off */
bool hw_up; /* one time hw up/down */
Expand Down
14 changes: 3 additions & 11 deletions drivers/staging/brcm80211/brcmsmac/srom.c
Original file line number Diff line number Diff line change
Expand Up @@ -1154,8 +1154,7 @@ static int otp_read_pci(struct si_pub *sih, u16 *buf, uint bufsz)
* Initialize nonvolatile variable table from sprom.
* Return 0 on success, nonzero on error.
*/
static int initvars_srom_pci(struct si_pub *sih, void __iomem *curmap,
char **vars, uint *count)
static int initvars_srom_pci(struct si_pub *sih, void __iomem *curmap)
{
u16 *srom;
u16 __iomem *sromwindow;
Expand Down Expand Up @@ -1243,21 +1242,14 @@ void srom_free_vars(struct si_pub *sih)
* Initialize local vars from the right source for this platform.
* Return 0 on success, nonzero on error.
*/
int srom_var_init(struct si_pub *sih, void __iomem *curmap, char **vars,
uint *count)
int srom_var_init(struct si_pub *sih, void __iomem *curmap)
{
uint len;

len = 0;

if (vars == NULL || count == NULL)
return 0;

*vars = NULL;
*count = 0;

if (curmap != NULL)
return initvars_srom_pci(sih, curmap, vars, count);
return initvars_srom_pci(sih, curmap);

return -EINVAL;
}
Expand Down
3 changes: 1 addition & 2 deletions drivers/staging/brcm80211/brcmsmac/srom.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
#include "types.h"

/* Prototypes */
extern int srom_var_init(struct si_pub *sih, void __iomem *curmap, char **vars,
uint *count);
extern int srom_var_init(struct si_pub *sih, void __iomem *curmap);
extern void srom_free_vars(struct si_pub *sih);

extern int srom_read(struct si_pub *sih, uint bus, void *curmap,
Expand Down

0 comments on commit 5d3e78e

Please sign in to comment.