staging: brcm80211: cleanup driver variable references
authorArend van Spriel <arend@broadcom.com>
Wed, 5 Oct 2011 13:20:12 +0000 (15:20 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 5 Oct 2011 20:42:51 +0000 (13:42 -0700)
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>
drivers/staging/brcm80211/brcmsmac/aiutils.c
drivers/staging/brcm80211/brcmsmac/aiutils.h
drivers/staging/brcm80211/brcmsmac/main.c
drivers/staging/brcm80211/brcmsmac/main.h
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h
drivers/staging/brcm80211/brcmsmac/phy/phy_int.h
drivers/staging/brcm80211/brcmsmac/pub.h
drivers/staging/brcm80211/brcmsmac/srom.c
drivers/staging/brcm80211/brcmsmac/srom.h

index afba8b120709a85d81233450f6a932802132108a..025fa0eb6f473e2b30316fce4c78af4262b823bd 100644 (file)
@@ -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;
@@ -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 === */
@@ -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;
 
@@ -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;
        }
index dce555133744709e0d67ca1f6952204d4b4c066b..106a7424a7cd4d60ee098d691db77e21067ba77c 100644 (file)
@@ -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 */
@@ -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);
index 5ec25e89eefc906ba35dec06483db8a8cf7ed31e..1e35be95262b74a28b7384ee763899af52fa64d6 100644 (file)
@@ -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)
 {
@@ -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;
@@ -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)) {
@@ -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;
@@ -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);
@@ -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 */
@@ -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;
@@ -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;
index 441292a24183cc3c7c178b651cd57a7f937f97ef..7a2554f611a63c27a3e23a0f28b59759201eb1c1 100644 (file)
@@ -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 */
@@ -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.
@@ -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;
index 59767e36735cb6997d6f81a1ad5838cccdfbe4b7..d54cfdb0a8e17aa860223039ecfbbd81d35e8e02 100644 (file)
@@ -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;
@@ -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;
@@ -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;
index 44818af3047e23eb560411f5090879d9fdf7cd6e..96e15163222b37e0e38f16b8ac90ca8cfb1dae11 100644 (file)
@@ -167,7 +167,6 @@ struct shared_phy_params {
        uint unit;
        uint corerev;
        uint buscorerev;
-       char *vars;
        u16 vid;
        u16 did;
        uint chip;
@@ -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,
index 4330e3846d9c99715d998c73de0bc9f17f00fda8..bea85241a244630cc8be4baf9693ea5cb0a91676 100644 (file)
@@ -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;
index 8c9ac8f4ee00e408a378f08dd2392bbaa65aa881..3942f47b15c367ed72d3db4440aafe236a7c751e 100644 (file)
@@ -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 */
index 8400cf41e9a0be3851a60cfbb9961c9cebe686f1..99f791048e841b7295a9fb8abf8c4f172c267029 100644 (file)
@@ -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;
@@ -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;
 }
index 395ab7ffb523a0348aece121dcfc203845ee5490..708c43ff51ccf44286c25ce0e18500f1f6799fc7 100644 (file)
@@ -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,