linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac
@ 2011-10-04 21:18 Arend van Spriel
  2011-10-04 21:18 ` [PATCH 01/26] staging: brcm80211: cleaned up struct brcms_bss_cfg Arend van Spriel
                   ` (26 more replies)
  0 siblings, 27 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:18 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel

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.

Alwin Beukers (15):
  staging: brcm80211: fixed checkpatch warnings
  staging: brcm80211: removed accessor functions for band type and
    etheraddress.
  staging: brcm80211: fixed function returns
  staging: brcm80211: made NULL ethernet address const
  staging: brcm80211: removed empty brcms_c_reset_bmac_done callback
    function
  staging: brcm80211: decreased indentation level of
    brcms_c_wme_setparams function
  staging: brcm80211: removed redundant code from brcms_c_set_gmode
  staging: brcm80211: cleanup of shared memory related wrapper
    functions
  staging: brcm80211: cleanup of transmit buffer size related wrapper
    function
  staging: brcm80211: cleanup of several wrapper functions
  staging: brcm80211: removed unneeded call to
    brcms_b_tx_fifo_suspended
  staging: brcm80211: removed synchronisation of wlc->machwcap field
  staging: brcm80211: remove brcms_b_dotxstatus wrapper function
  staging: brcm80211: combined if statements
  staging: brcm80211: remove N mode validation function

Arend van Spriel (4):
  staging: brcm80211: remove setting ssn to zero upon AMPDU_TX_START
  staging: brcm80211: remove filtering of received frames
  staging: brcm80211: remove brcmu_bprintf and related functions
  staging: brcm80211: replace brcmu_bitcount with hweight8

Franky Lin (3):
  staging: brcm80211: clean up rtnl_lock in fullmac
  staging: brcm80211: remove fullmac module_param for intr/poll mode
  staging: brcm80211: stop using assigned thread priority in fullmac

Roland Vossen (4):
  staging: brcm80211: cleaned up struct brcms_bss_cfg
  staging: brcm80211: fullmac: fixed double #include
  staging: brcm80211: softmac: added event tracing
  staging: brcm80211: smac: fix for 64 bit systems

 drivers/staging/brcm80211/brcmfmac/dhd_linux.c     |    3 +
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c      |   72 +---
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c   |   25 +-
 drivers/staging/brcm80211/brcmsmac/Makefile        |    3 +-
 drivers/staging/brcm80211/brcmsmac/aiutils.c       |   14 +-
 drivers/staging/brcm80211/brcmsmac/ampdu.c         |   14 +-
 drivers/staging/brcm80211/brcmsmac/antsel.c        |    4 +-
 .../brcm80211/brcmsmac/brcms_trace_events.c        |   23 +
 .../brcm80211/brcmsmac/brcms_trace_events.h        |   92 ++++
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c   |   19 +-
 drivers/staging/brcm80211/brcmsmac/mac80211_if.h   |    2 +
 drivers/staging/brcm80211/brcmsmac/main.c          |  525 ++++----------------
 drivers/staging/brcm80211/brcmsmac/main.h          |   50 +--
 drivers/staging/brcm80211/brcmsmac/nicpci.c        |    3 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c   |    7 +-
 drivers/staging/brcm80211/brcmsmac/srom.c          |    3 +-
 drivers/staging/brcm80211/brcmsmac/stf.c           |   10 +-
 drivers/staging/brcm80211/brcmsmac/types.h         |    1 -
 drivers/staging/brcm80211/brcmsmac/ucode_loader.h  |    4 +-
 drivers/staging/brcm80211/brcmutil/utils.c         |   34 --
 drivers/staging/brcm80211/include/brcmu_utils.h    |   15 -
 21 files changed, 252 insertions(+), 671 deletions(-)
 create mode 100644 drivers/staging/brcm80211/brcmsmac/brcms_trace_events.c
 create mode 100644 drivers/staging/brcm80211/brcmsmac/brcms_trace_events.h

-- 
1.7.4.1



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

* [PATCH 01/26] staging: brcm80211: cleaned up struct brcms_bss_cfg
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
@ 2011-10-04 21:18 ` Arend van Spriel
  2011-10-04 21:18 ` [PATCH 02/26] staging: brcm80211: remove setting ssn to zero upon AMPDU_TX_START Arend van Spriel
                   ` (25 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:18 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Roland Vossen, Arend van Spriel

From: Roland Vossen <rvossen@broadcom.com>

Several fields were unused or were only set once. They have been
removed. Uncalled functions that relied on these constants have been
removed as well.

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

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index de5f5c0..efc6682 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -1741,34 +1741,6 @@ void brcms_b_bw_set(struct brcms_hardware *wlc_hw, u16 bw)
 		brcms_b_clkctl_clk(wlc_hw, CLK_DYNAMIC);
 }
 
-static void
-brcms_c_write_hw_bcntemplate0(struct brcms_hardware *wlc_hw, u16 bcn[],
-			      int len)
-{
-	struct d11regs __iomem *regs = wlc_hw->regs;
-
-	brcms_b_write_template_ram(wlc_hw, T_BCN0_TPL_BASE, (len + 3) & ~3,
-				    bcn);
-	/* write beacon length to SCR */
-	brcms_b_write_shm(wlc_hw, M_BCN0_FRM_BYTESZ, (u16) len);
-	/* mark beacon0 valid */
-	OR_REG(&regs->maccommand, MCMD_BCN0VLD);
-}
-
-static void
-brcms_c_write_hw_bcntemplate1(struct brcms_hardware *wlc_hw, u16 bcn[],
-			      int len)
-{
-	struct d11regs __iomem *regs = wlc_hw->regs;
-
-	brcms_b_write_template_ram(wlc_hw, T_BCN1_TPL_BASE, (len + 3) & ~3,
-				    bcn);
-	/* write beacon length to SCR */
-	brcms_b_write_shm(wlc_hw, M_BCN1_FRM_BYTESZ, (u16) len);
-	/* mark beacon1 valid */
-	OR_REG(&regs->maccommand, MCMD_BCN1VLD);
-}
-
 static void brcms_b_upd_synthpu(struct brcms_hardware *wlc_hw)
 {
 	u16 v;
@@ -3288,8 +3260,7 @@ bool brcms_c_ps_allowed(struct brcms_c_info *wlc)
 		if (!cfg->BSS)
 			return false;
 
-		if (!cfg->dtim_programmed)
-			return false;
+		return false;
 	}
 
 	return true;
@@ -3791,9 +3762,6 @@ void brcms_c_init(struct brcms_c_info *wlc)
 	/* update beacon listen interval */
 	brcms_c_bcn_li_upd(wlc);
 
-	/* the world is new again, so is our reported rate */
-	brcms_c_reprate_init(wlc);
-
 	/* write ethernet address to core */
 	brcms_c_set_mac(wlc->bsscfg);
 	brcms_c_set_bssid(wlc->bsscfg);
@@ -4054,17 +4022,12 @@ brcms_b_set_chanspec(struct brcms_hardware *wlc_hw, u16 chanspec,
 static void brcms_c_setband(struct brcms_c_info *wlc,
 					   uint bandunit)
 {
-	struct brcms_bss_cfg *cfg = wlc->bsscfg;
-
 	wlc->band = wlc->bandstate[bandunit];
 
 	if (!wlc->pub->up)
 		return;
 
 	/* wait for at least one beacon before entering sleeping state */
-	if (cfg->associated)
-		cfg->PMawakebcn = true;
-
 	brcms_c_set_ps_ctrl(wlc);
 
 	/* band-specific initializations */
@@ -5357,7 +5320,6 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
 		goto fail;
 	}
 
-	wlc->bsscfg->_idx = 0;
 	wlc->bsscfg->wlc = wlc;
 
 	wlc->mimoft = FT_HT;
@@ -8763,82 +8725,6 @@ int brcms_c_get_header_len(void)
 	return TXOFF;
 }
 
-/* mac is assumed to be suspended at this point */
-static void
-brcms_b_write_hw_bcntemplates(struct brcms_hardware *wlc_hw, u16 bcn[],
-			      int len, bool both)
-{
-	struct d11regs __iomem *regs = wlc_hw->regs;
-
-	if (both) {
-		brcms_c_write_hw_bcntemplate0(wlc_hw, bcn, len);
-		brcms_c_write_hw_bcntemplate1(wlc_hw, bcn, len);
-	} else {
-		/* bcn 0 */
-		if (!(R_REG(&regs->maccommand) & MCMD_BCN0VLD))
-			brcms_c_write_hw_bcntemplate0(wlc_hw, bcn, len);
-		/* bcn 1 */
-		else if (!
-			 (R_REG(&regs->maccommand) & MCMD_BCN1VLD))
-			brcms_c_write_hw_bcntemplate1(wlc_hw, bcn, len);
-	}
-}
-
-static void brcms_c_write_hw_bcntemplates(struct brcms_c_info *wlc, u16 bcn[],
-					  int len, bool both)
-{
-	brcms_b_write_hw_bcntemplates(wlc->hw, bcn, len, both);
-}
-
-/*
- * Update a beacon for a particular BSS
- * For MBSS, this updates the software template and sets "latest" to
- * the index of the template updated. Otherwise, it updates the hardware
- * template.
- */
-void brcms_c_bss_update_beacon(struct brcms_c_info *wlc,
-			       struct brcms_bss_cfg *cfg)
-{
-	int len = BCN_TMPL_LEN;
-
-	/* Clear the soft intmask */
-	wlc->defmacintmask &= ~MI_BCNTPL;
-
-	if (!cfg->up)
-		/* Only allow updates on an UP bss */
-		return;
-
-	/* Optimize:  Some of if/else could be combined */
-	if ((cfg->flags & BRCMS_BSSCFG_HW_BCN) != 0) {
-		/* Hardware beaconing for this config */
-		u16 bcn[BCN_TMPL_LEN / 2];
-		u32 both_valid = MCMD_BCN0VLD | MCMD_BCN1VLD;
-		struct d11regs __iomem *regs = wlc->regs;
-
-		/* Check if both templates are in use, if so sched. an interrupt
-		 *      that will call back into this routine
-		 */
-		if ((R_REG(&regs->maccommand) & both_valid) == both_valid)
-			/* clear any previous status */
-			W_REG(&regs->macintstatus, MI_BCNTPL);
-
-		/* Check that after scheduling the interrupt both of the
-		 *      templates are still busy. if not clear the int. & remask
-		 */
-		if ((R_REG(&regs->maccommand) & both_valid) == both_valid) {
-			wlc->defmacintmask |= MI_BCNTPL;
-			return;
-		}
-
-		wlc->bcn_rspec =
-		    brcms_c_lowest_basic_rspec(wlc, &cfg->current_bss->rateset);
-		/* update the template and ucode shm */
-		brcms_c_bcn_prb_template(wlc, IEEE80211_STYPE_BEACON,
-				     wlc->bcn_rspec, cfg, bcn, &len);
-		brcms_c_write_hw_bcntemplates(wlc, bcn, len, false);
-	}
-}
-
 /*
  * Update all beacons for the system.
  */
@@ -8847,7 +8733,8 @@ void brcms_c_update_beacon(struct brcms_c_info *wlc)
 	struct brcms_bss_cfg *bsscfg = wlc->bsscfg;
 
 	if (bsscfg->up && !bsscfg->BSS)
-		brcms_c_bss_update_beacon(wlc, bsscfg);
+		/* Clear the soft intmask */
+		wlc->defmacintmask &= ~MI_BCNTPL;
 }
 
 /* Write ssid into shared memory */
@@ -8946,19 +8833,6 @@ int brcms_c_prep_pdu(struct brcms_c_info *wlc, struct sk_buff *pdu, uint *fifop)
 	return 0;
 }
 
-/* init tx reported rate mechanism */
-void brcms_c_reprate_init(struct brcms_c_info *wlc)
-{
-	brcms_c_bsscfg_reprate_init(wlc->bsscfg);
-}
-
-/* per bsscfg init tx reported rate mechanism */
-void brcms_c_bsscfg_reprate_init(struct brcms_bss_cfg *bsscfg)
-{
-	bsscfg->txrspecidx = 0;
-	memset((char *)bsscfg->txrspec, 0, sizeof(bsscfg->txrspec));
-}
-
 void brcms_default_rateset(struct brcms_c_info *wlc, struct brcms_c_rateset *rs)
 {
 	brcms_c_rateset_default(rs, NULL, wlc->band->phytype,
diff --git a/drivers/staging/brcm80211/brcmsmac/main.h b/drivers/staging/brcm80211/brcmsmac/main.h
index e458916..9e1575c 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.h
+++ b/drivers/staging/brcm80211/brcmsmac/main.h
@@ -634,35 +634,18 @@ struct antsel_info {
  * enable: is this configuration enabled
  * associated: is BSS in ASSOCIATED state
  * BSS: infraustructure or adhoc
- * dtim_programmed:
  * SSID_len: the length of SSID
  * SSID: SSID string
- * bcmc_scb: one bcmc_scb per band
- * _idx: the index of this bsscfg, assigned at wlc_bsscfg_alloc()
  *
  *
  * BSSID: BSSID (associated)
  * cur_etheraddr: h/w address
- * bcmc_fid: the last BCMC FID queued to TX_BCMC_FIFO
- * bcmc_fid_shm: the last BCMC FID written to shared mem
  * flags: BSSCFG flags; see below
- * bcn: AP beacon
- * bcn_len: AP beacon length
- * ar_disassoc: disassociated in associated recreation
  *
  * current_bss: BSS parms in ASSOCIATED state
  *
- * PM states
- * ---------
- * PMawakebcn: bcn recvd during current waking state
- * PMpending: waiting for tx status with PM indicated set
- * priorPMstate: Detecting PM state transitions
- * PSpoll: flags there is an outstanding PS-Poll frame
  *
  * ID: 'unique' ID of this bsscfg, assigned at bsscfg allocation
- *
- * txrspecidx: index into tx rate circular buffer
- * txrspec: circular buffer of prev MPDUs tx rates
  */
 struct brcms_bss_cfg {
 	struct brcms_c_info *wlc;
@@ -670,27 +653,11 @@ struct brcms_bss_cfg {
 	bool enable;
 	bool associated;
 	bool BSS;
-	bool dtim_programmed;
 	u8 SSID_len;
 	u8 SSID[IEEE80211_MAX_SSID_LEN];
-	struct scb *bcmc_scb[MAXBANDS];
-	s8 _idx;
 	u8 BSSID[ETH_ALEN];
 	u8 cur_etheraddr[ETH_ALEN];
-	u16 bcmc_fid;
-	u16 bcmc_fid_shm;
-	u32 flags;
-	u8 *bcn;
-	uint bcn_len;
-	bool ar_disassoc;
 	struct brcms_bss_info *current_bss;
-	bool PMawakebcn;
-	bool PMpending;
-	bool priorPMstate;
-	bool PSpoll;
-	u16 ID;
-	uint txrspecidx;
-	u32 txrspec[NTXRATE][2];
 };
 
 extern void brcms_c_fatal_error(struct brcms_c_info *wlc);
@@ -765,9 +732,6 @@ extern void brcms_c_inval_dma_pkts(struct brcms_hardware *hw,
 			       struct ieee80211_sta *sta,
 			       void (*dma_callback_fn));
 
-extern void brcms_c_reprate_init(struct brcms_c_info *wlc);
-extern void brcms_c_bsscfg_reprate_init(struct brcms_bss_cfg *bsscfg);
-
 /* Shared memory access */
 extern void brcms_c_write_shm(struct brcms_c_info *wlc, uint offset, u16 v);
 extern u16 brcms_c_read_shm(struct brcms_c_info *wlc, uint offset);
@@ -775,8 +739,6 @@ extern void brcms_c_copyto_shm(struct brcms_c_info *wlc, uint offset,
 			       const void *buf, int len);
 
 extern void brcms_c_update_beacon(struct brcms_c_info *wlc);
-extern void brcms_c_bss_update_beacon(struct brcms_c_info *wlc,
-				  struct brcms_bss_cfg *bsscfg);
 
 extern void brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend);
 extern void brcms_c_bss_update_probe_resp(struct brcms_c_info *wlc,
-- 
1.7.4.1



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

* [PATCH 02/26] staging: brcm80211: remove setting ssn to zero upon AMPDU_TX_START
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
  2011-10-04 21:18 ` [PATCH 01/26] staging: brcm80211: cleaned up struct brcms_bss_cfg Arend van Spriel
@ 2011-10-04 21:18 ` Arend van Spriel
  2011-10-04 21:18 ` [PATCH 03/26] staging: brcm80211: remove filtering of received frames Arend van Spriel
                   ` (24 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:18 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel

The ssn should be given a valid value by the driver or it should not
override the value. Removed override to zero from the driver.

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

diff --git a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
index 6787498..c5afeaf 100644
--- a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
@@ -669,11 +669,6 @@ brcms_ops_ampdu_action(struct ieee80211_hw *hw,
 				  tid);
 			return -EINVAL;
 		}
-		/*
-		 * Future improvement:
-		 *   Use the starting sequence number provided ...
-		 */
-		*ssn = 0;
 		ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
 		break;
 
-- 
1.7.4.1



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

* [PATCH 03/26] staging: brcm80211: remove filtering of received frames
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
  2011-10-04 21:18 ` [PATCH 01/26] staging: brcm80211: cleaned up struct brcms_bss_cfg Arend van Spriel
  2011-10-04 21:18 ` [PATCH 02/26] staging: brcm80211: remove setting ssn to zero upon AMPDU_TX_START Arend van Spriel
@ 2011-10-04 21:18 ` Arend van Spriel
  2011-10-04 21:18 ` [PATCH 04/26] staging: brcm80211: remove brcmu_bprintf and related functions Arend van Spriel
                   ` (23 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:18 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel

In the receive path of the brcmsmac driver probe request frames and
frames with invalid mac address fields are dropped. This is only
fine for STA mode. Anticipating coming AP and monitor mode functionality
this is unwanted behavior.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/main.c |   23 +----------------------
 1 files changed, 1 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index efc6682..39b91d6 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -8238,29 +8238,8 @@ void brcms_c_recv(struct brcms_c_info *wlc, struct sk_buff *p)
 	if (len < D11_PHY_HDR_LEN + sizeof(h->frame_control))
 		goto toss;
 
+	/* not supporting A-MSDU */
 	is_amsdu = rxh->RxStatus2 & RXS_AMSDU_MASK;
-
-	/* explicitly test bad src address to avoid sending bad deauth */
-	if (!is_amsdu) {
-		/* CTS and ACK CTL frames are w/o a2 */
-
-		if (ieee80211_is_data(h->frame_control) ||
-		    ieee80211_is_mgmt(h->frame_control)) {
-			if ((is_zero_ether_addr(h->addr2) ||
-			     is_multicast_ether_addr(h->addr2))) {
-				wiphy_err(wlc->wiphy, "wl%d: %s: dropping a "
-					  "frame with invalid src mac address,"
-					  " a2: %pM\n",
-					 wlc->pub->unit, __func__, h->addr2);
-				goto toss;
-			}
-		}
-	}
-
-	/* due to sheer numbers, toss out probe reqs for now */
-	if (ieee80211_is_probe_req(h->frame_control))
-		goto toss;
-
 	if (is_amsdu)
 		goto toss;
 
-- 
1.7.4.1



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

* [PATCH 04/26] staging: brcm80211: remove brcmu_bprintf and related functions
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (2 preceding siblings ...)
  2011-10-04 21:18 ` [PATCH 03/26] staging: brcm80211: remove filtering of received frames Arend van Spriel
@ 2011-10-04 21:18 ` Arend van Spriel
  2011-10-04 21:18 ` [PATCH 05/26] staging: brcm80211: replace brcmu_bitcount with hweight8 Arend van Spriel
                   ` (22 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:18 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel

The functions brcmu_bprintf and brcmu_binit could be replaced by
snprintf kernel function. These are no longer used in both brcm80211
drivers so they have been removed.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/types.h      |    1 -
 drivers/staging/brcm80211/brcmutil/utils.c      |   34 -----------------------
 drivers/staging/brcm80211/include/brcmu_utils.h |   15 ----------
 3 files changed, 0 insertions(+), 50 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/types.h b/drivers/staging/brcm80211/brcmsmac/types.h
index 23969fe..27a814b 100644
--- a/drivers/staging/brcm80211/brcmsmac/types.h
+++ b/drivers/staging/brcm80211/brcmsmac/types.h
@@ -329,7 +329,6 @@ struct ieee80211_tx_queue_params;
 struct brcms_info;
 struct brcms_c_info;
 struct brcms_hardware;
-struct brcmu_strbuf;
 struct brcms_txq_info;
 struct brcms_band;
 struct dma_pub;
diff --git a/drivers/staging/brcm80211/brcmutil/utils.c b/drivers/staging/brcm80211/brcmutil/utils.c
index 1fe47fe..62bcc71 100644
--- a/drivers/staging/brcm80211/brcmutil/utils.c
+++ b/drivers/staging/brcm80211/brcmutil/utils.c
@@ -598,37 +598,3 @@ uint brcmu_bitcount(u8 *bitmap, uint length)
 	return bitcount;
 }
 EXPORT_SYMBOL(brcmu_bitcount);
-
-/* Initialization of brcmu_strbuf structure */
-void brcmu_binit(struct brcmu_strbuf *b, char *buf, uint size)
-{
-	b->origsize = b->size = size;
-	b->origbuf = b->buf = buf;
-}
-EXPORT_SYMBOL(brcmu_binit);
-
-/* Buffer sprintf wrapper to guard against buffer overflow */
-int brcmu_bprintf(struct brcmu_strbuf *b, const char *fmt, ...)
-{
-	va_list ap;
-	int r;
-
-	va_start(ap, fmt);
-	r = vsnprintf(b->buf, b->size, fmt, ap);
-
-	/* Non Ansi C99 compliant returns -1,
-	 * Ansi compliant return r >= b->size,
-	 * stdlib returns 0, handle all
-	 */
-	if ((r == -1) || (r >= (int)b->size) || (r == 0)) {
-		b->size = 0;
-	} else {
-		b->size -= r;
-		b->buf += r;
-	}
-
-	va_end(ap);
-
-	return r;
-}
-EXPORT_SYMBOL(brcmu_bprintf);
diff --git a/drivers/staging/brcm80211/include/brcmu_utils.h b/drivers/staging/brcm80211/include/brcmu_utils.h
index cf34bd3..a7d3df2 100644
--- a/drivers/staging/brcm80211/include/brcmu_utils.h
+++ b/drivers/staging/brcm80211/include/brcmu_utils.h
@@ -19,18 +19,6 @@
 
 #include <linux/skbuff.h>
 
-/* Buffer structure for collecting string-formatted data
-* using brcmu_bprintf() API.
-* Use brcmu_binit() to initialize before use
-*/
-
-struct brcmu_strbuf {
-	char *buf;	/* pointer to current position in origbuf */
-	unsigned int size;	/* current (residual) size in bytes */
-	char *origbuf;	/* unmodified pointer to orignal buffer */
-	unsigned int origsize;	/* unmodified orignal buffer size in bytes */
-};
-
 /*
  * Spin at most 'us' microseconds while 'exp' is true.
  * Caller should explicitly test 'exp' when this completes
@@ -228,9 +216,6 @@ extern struct brcmu_tlv *brcmu_parse_tlvs(void *buf, int buflen,
 extern u16 brcmu_qdbm_to_mw(u8 qdbm);
 extern u8 brcmu_mw_to_qdbm(u16 mw);
 
-extern void brcmu_binit(struct brcmu_strbuf *b, char *buf, uint size);
-extern int brcmu_bprintf(struct brcmu_strbuf *b, const char *fmt, ...);
-
 extern uint brcmu_mkiovar(char *name, char *data, uint datalen,
 			  char *buf, uint len);
 extern uint brcmu_bitcount(u8 *bitmap, uint bytelength);
-- 
1.7.4.1



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

* [PATCH 05/26] staging: brcm80211: replace brcmu_bitcount with hweight8
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (3 preceding siblings ...)
  2011-10-04 21:18 ` [PATCH 04/26] staging: brcm80211: remove brcmu_bprintf and related functions Arend van Spriel
@ 2011-10-04 21:18 ` Arend van Spriel
  2011-10-04 21:18 ` [PATCH 06/26] staging: brcm80211: fullmac: fixed double #include Arend van Spriel
                   ` (21 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:18 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Arend van Spriel

The kernel provides bit operations to replace brcmu_bitcount so
using those instead.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c |    7 +++----
 drivers/staging/brcm80211/brcmsmac/stf.c         |   10 +++++-----
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
index 45e3b4b..0d3c9d8 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
@@ -15,6 +15,7 @@
  */
 #include <linux/kernel.h>
 #include <linux/delay.h>
+#include <linux/bitops.h>
 
 #include <brcm_hw_ids.h>
 #include <chipcommon.h>
@@ -2879,8 +2880,7 @@ void wlc_phy_stf_chain_init(struct brcms_phy_pub *pih, u8 txchain, u8 rxchain)
 	pi->sh->hw_phyrxchain = rxchain;
 	pi->sh->phytxchain = txchain;
 	pi->sh->phyrxchain = rxchain;
-	pi->pubpi.phy_corenum = (u8) brcmu_bitcount((u8 *)&pi->sh->phyrxchain,
-						    sizeof(u8));
+	pi->pubpi.phy_corenum = (u8)hweight8(pi->sh->phyrxchain);
 }
 
 void wlc_phy_stf_chain_set(struct brcms_phy_pub *pih, u8 txchain, u8 rxchain)
@@ -2892,8 +2892,7 @@ void wlc_phy_stf_chain_set(struct brcms_phy_pub *pih, u8 txchain, u8 rxchain)
 	if (ISNPHY(pi))
 		wlc_phy_rxcore_setstate_nphy(pih, rxchain);
 
-	pi->pubpi.phy_corenum = (u8) brcmu_bitcount((u8 *)&pi->sh->phyrxchain,
-						    sizeof(u8));
+	pi->pubpi.phy_corenum = (u8)hweight8(pi->sh->phyrxchain);
 }
 
 void wlc_phy_stf_chain_get(struct brcms_phy_pub *pih, u8 *txchain, u8 *rxchain)
diff --git a/drivers/staging/brcm80211/brcmsmac/stf.c b/drivers/staging/brcm80211/brcmsmac/stf.c
index ba3c3ef..9460cd1 100644
--- a/drivers/staging/brcm80211/brcmsmac/stf.c
+++ b/drivers/staging/brcm80211/brcmsmac/stf.c
@@ -165,10 +165,10 @@ static int brcms_c_stf_txcore_set(struct brcms_c_info *wlc, u8 Nsts,
 	BCMMSG(wlc->wiphy, "wl%d: Nsts %d core_mask %x\n",
 		 wlc->pub->unit, Nsts, core_mask);
 
-	if (BRCMS_BITSCNT(core_mask) > wlc->stf->txstreams)
+	if (hweight8(core_mask) > wlc->stf->txstreams)
 		core_mask = 0;
 
-	if ((BRCMS_BITSCNT(core_mask) == wlc->stf->txstreams) &&
+	if ((hweight8(core_mask) == wlc->stf->txstreams) &&
 	    ((core_mask & ~wlc->stf->txchain)
 	     || !(core_mask & wlc->stf->txchain)))
 		core_mask = wlc->stf->txchain;
@@ -278,7 +278,7 @@ int brcms_c_stf_txchain_set(struct brcms_c_info *wlc, s32 int_val, bool force)
 	 * if nrate override is configured to be non-SISO STF mode, reject
 	 * reducing txchain to 1
 	 */
-	txstreams = (u8) BRCMS_BITSCNT(txchain);
+	txstreams = (u8) hweight8(txchain);
 	if (txstreams > MAX_STREAMS_SUPPORTED)
 		return -EINVAL;
 
@@ -385,7 +385,7 @@ void brcms_c_stf_phy_chain_calc(struct brcms_c_info *wlc)
 	}
 
 	wlc->stf->txchain = wlc->stf->hw_txchain;
-	wlc->stf->txstreams = (u8) BRCMS_BITSCNT(wlc->stf->hw_txchain);
+	wlc->stf->txstreams = (u8) hweight8(wlc->stf->hw_txchain);
 
 	if (wlc->stf->hw_rxchain == 0 || wlc->stf->hw_rxchain == 0xf) {
 		if (BRCMS_ISNPHY(wlc->band))
@@ -395,7 +395,7 @@ void brcms_c_stf_phy_chain_calc(struct brcms_c_info *wlc)
 	}
 
 	wlc->stf->rxchain = wlc->stf->hw_rxchain;
-	wlc->stf->rxstreams = (u8) BRCMS_BITSCNT(wlc->stf->hw_rxchain);
+	wlc->stf->rxstreams = (u8) hweight8(wlc->stf->hw_rxchain);
 
 	/* initialize the txcore table */
 	memcpy(wlc->stf->txcore, txcore_default, sizeof(wlc->stf->txcore));
-- 
1.7.4.1



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

* [PATCH 06/26] staging: brcm80211: fullmac: fixed double #include
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (4 preceding siblings ...)
  2011-10-04 21:18 ` [PATCH 05/26] staging: brcm80211: replace brcmu_bitcount with hweight8 Arend van Spriel
@ 2011-10-04 21:18 ` Arend van Spriel
  2011-10-04 21:18 ` [PATCH 07/26] staging: brcm80211: clean up rtnl_lock in fullmac Arend van Spriel
                   ` (20 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:18 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Roland Vossen, Arend van Spriel

From: Roland Vossen <rvossen@broadcom.com>

Fix double include as detected by checkincludes script.

Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index d12aa75..f7b3077 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -21,7 +21,6 @@
 #include <linux/sched.h>
 #include <linux/kthread.h>
 #include <linux/netdevice.h>
-#include <linux/sched.h>
 #include <linux/bitops.h>
 #include <linux/etherdevice.h>
 #include <linux/ieee80211.h>
-- 
1.7.4.1



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

* [PATCH 07/26] staging: brcm80211: clean up rtnl_lock in fullmac
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (5 preceding siblings ...)
  2011-10-04 21:18 ` [PATCH 06/26] staging: brcm80211: fullmac: fixed double #include Arend van Spriel
@ 2011-10-04 21:18 ` Arend van Spriel
  2011-10-04 21:18 ` [PATCH 08/26] staging: brcm80211: remove fullmac module_param for intr/poll mode Arend van Spriel
                   ` (19 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:18 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Franky Lin, Arend van Spriel

From: Franky Lin <frankyl@broadcom.com>

rtnl lock is used improperly in fullmac. This patch intends to clean
them up.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Sukesh Srikakula <sukeshs@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmfmac/dhd_linux.c   |    3 ++
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c |   24 +--------------------
 2 files changed, 5 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index 641cd9c..804b2bc 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -32,6 +32,7 @@
 #include <linux/mutex.h>
 #include <linux/wait.h>
 #include <net/cfg80211.h>
+#include <net/rtnetlink.h>
 #include <defs.h>
 #include <brcmu_utils.h>
 #include <brcmu_wifi.h>
@@ -1240,7 +1241,9 @@ void brcmf_detach(struct brcmf_pub *drvr)
 
 			ifp = drvr_priv->iflist[0];
 			if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
+				rtnl_lock();
 				brcmf_netdev_stop(ifp->ndev);
+				rtnl_unlock();
 				unregister_netdev(ifp->ndev);
 			}
 
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index f7b3077..fc643c1 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -26,7 +26,6 @@
 #include <linux/ieee80211.h>
 #include <linux/uaccess.h>
 #include <net/cfg80211.h>
-#include <net/rtnetlink.h>
 
 #include <brcmu_utils.h>
 #include <defs.h>
@@ -2223,10 +2222,8 @@ static s32 brcmf_iscan_done(struct brcmf_cfg80211_priv *cfg_priv)
 	s32 err = 0;
 
 	iscan->state = WL_ISCAN_STATE_IDLE;
-	rtnl_lock();
 	brcmf_inform_bss(cfg_priv);
 	brcmf_notify_iscan_complete(iscan, false);
-	rtnl_unlock();
 
 	return err;
 }
@@ -2248,10 +2245,8 @@ static s32 brcmf_iscan_inprogress(struct brcmf_cfg80211_priv *cfg_priv)
 	struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_priv->iscan;
 	s32 err = 0;
 
-	rtnl_lock();
 	brcmf_inform_bss(cfg_priv);
 	brcmf_run_iscan(iscan, NULL, BRCMF_SCAN_ACTION_CONTINUE);
-	rtnl_unlock();
 	/* Reschedule the timer */
 	mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000);
 	iscan->timer_on = 1;
@@ -2265,9 +2260,7 @@ static s32 brcmf_iscan_aborted(struct brcmf_cfg80211_priv *cfg_priv)
 	s32 err = 0;
 
 	iscan->state = WL_ISCAN_STATE_IDLE;
-	rtnl_lock();
 	brcmf_notify_iscan_complete(iscan, true);
-	rtnl_unlock();
 
 	return err;
 }
@@ -2286,12 +2279,10 @@ static void brcmf_cfg80211_iscan_handler(struct work_struct *work)
 		iscan->timer_on = 0;
 	}
 
-	rtnl_lock();
 	if (brcmf_get_iscan_results(iscan, &status, &cfg_priv->bss_list)) {
 		status = BRCMF_SCAN_RESULTS_ABORTED;
 		WL_ERR("Abort iscan\n");
 	}
-	rtnl_unlock();
 
 	el->handler[status](cfg_priv);
 }
@@ -2408,9 +2399,7 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
 		 * generated due to DISASSOC call to the fw to keep
 		 * the state fw and WPA_Supplicant state consistent
 		 */
-		rtnl_unlock();
 		brcmf_delay(500);
-		rtnl_lock();
 	}
 
 	set_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status);
@@ -2978,7 +2967,6 @@ brcmf_notify_mic_status(struct brcmf_cfg80211_priv *cfg_priv,
 	u16 flags = be16_to_cpu(e->flags);
 	enum nl80211_key_type key_type;
 
-	rtnl_lock();
 	if (flags & BRCMF_EVENT_MSG_GROUP)
 		key_type = NL80211_KEYTYPE_GROUP;
 	else
@@ -2986,7 +2974,6 @@ brcmf_notify_mic_status(struct brcmf_cfg80211_priv *cfg_priv,
 
 	cfg80211_michael_mic_failure(ndev, (u8 *)&e->addr, key_type, -1,
 				     NULL, GFP_KERNEL);
-	rtnl_unlock();
 
 	return 0;
 }
@@ -3563,8 +3550,7 @@ static s32 brcmf_dongle_probecap(struct brcmf_cfg80211_priv *cfg_priv)
 	return wl_update_wiphybands(cfg_priv);
 }
 
-static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv,
-			       bool need_lock)
+static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv)
 {
 	struct net_device *ndev;
 	struct wireless_dev *wdev;
@@ -3576,8 +3562,6 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv,
 
 	ndev = cfg_to_ndev(cfg_priv);
 	wdev = ndev->ieee80211_ptr;
-	if (need_lock)
-		rtnl_lock();
 
 	brcmf_dongle_scantime(ndev, WL_SCAN_CHANNEL_TIME,
 			WL_SCAN_UNASSOC_TIME, WL_SCAN_PASSIVE_TIME);
@@ -3607,8 +3591,6 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv,
 	/* -EINPROGRESS: Call commit handler */
 
 default_conf_out:
-	if (need_lock)
-		rtnl_unlock();
 
 	cfg_priv->dongle_up = true;
 
@@ -3658,7 +3640,7 @@ static s32 __brcmf_cfg80211_up(struct brcmf_cfg80211_priv *cfg_priv)
 
 	brcmf_debugfs_add_netdev_params(cfg_priv);
 
-	err = brcmf_config_dongle(cfg_priv, false);
+	err = brcmf_config_dongle(cfg_priv);
 	if (err)
 		return err;
 
@@ -3683,9 +3665,7 @@ static s32 __brcmf_cfg80211_down(struct brcmf_cfg80211_priv *cfg_priv)
 		   generated due to DISASSOC call to the fw to keep
 		   the state fw and WPA_Supplicant state consistent
 		 */
-		rtnl_unlock();
 		brcmf_delay(500);
-		rtnl_lock();
 	}
 
 	set_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status);
-- 
1.7.4.1



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

* [PATCH 08/26] staging: brcm80211: remove fullmac module_param for intr/poll mode
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (6 preceding siblings ...)
  2011-10-04 21:18 ` [PATCH 07/26] staging: brcm80211: clean up rtnl_lock in fullmac Arend van Spriel
@ 2011-10-04 21:18 ` Arend van Spriel
  2011-10-04 21:18 ` [PATCH 09/26] staging: brcm80211: stop using assigned thread priority in fullmac Arend van Spriel
                   ` (18 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:18 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Franky Lin, Arend van Spriel

From: Franky Lin <frankyl@broadcom.com>

Use constant for interrupt/polling mode configuration.

Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 5423280..6c2391b 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -725,14 +725,6 @@ module_param(brcmf_dpc_prio, int, 0);
 
 #define SDIO_DRIVE_STRENGTH	6	/* in milliamps */
 
-/* Use polling */
-uint brcmf_poll;
-module_param(brcmf_poll, uint, 0);
-
-/* Use interrupts */
-uint brcmf_intr = true;
-module_param(brcmf_intr, uint, 0);
-
 #define RETRYCHAN(chan) ((chan) == SDPCM_EVENT_CHANNEL)
 
 /* Retry count for register access failures */
@@ -4324,8 +4316,8 @@ brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, u32 regsva)
 				    BRCMF_SDALIGN);
 
 	/* Set the poll and/or interrupt flags */
-	bus->intr = (bool) brcmf_intr;
-	bus->poll = (bool) brcmf_poll;
+	bus->intr = true;
+	bus->poll = false;
 	if (bus->poll)
 		bus->pollrate = 1;
 
-- 
1.7.4.1



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

* [PATCH 09/26] staging: brcm80211: stop using assigned thread priority in fullmac
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (7 preceding siblings ...)
  2011-10-04 21:18 ` [PATCH 08/26] staging: brcm80211: remove fullmac module_param for intr/poll mode Arend van Spriel
@ 2011-10-04 21:18 ` Arend van Spriel
  2011-10-04 21:18 ` [PATCH 10/26] staging: brcm80211: fixed checkpatch warnings Arend van Spriel
                   ` (17 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:18 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Franky Lin, Arend van Spriel

From: Franky Lin <frankyl@broadcom.com>

Stop assigning priority to watchdog and dpc threads. Remove related
code.

Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c |   60 ++----------------------
 1 files changed, 5 insertions(+), 55 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 6c2391b..f3e6249 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -715,14 +715,6 @@ static int qcount[NUMPRIO];
 static int tx_packets[NUMPRIO];
 #endif				/* BCMDBG */
 
-/* Watchdog thread priority, -1 to use kernel timer */
-int brcmf_watchdog_prio = 97;
-module_param(brcmf_watchdog_prio, int, 0);
-
-/* DPC thread priority, -1 to use tasklet */
-int brcmf_dpc_prio = 98;
-module_param(brcmf_dpc_prio, int, 0);
-
 #define SDIO_DRIVE_STRENGTH	6	/* in milliamps */
 
 #define RETRYCHAN(chan) ((chan) == SDPCM_EVENT_CHANNEL)
@@ -2692,16 +2684,6 @@ static int brcmf_sdbrcm_dpc_thread(void *data)
 {
 	struct brcmf_bus *bus = (struct brcmf_bus *) data;
 
-	/* This thread doesn't need any user-level access,
-	 * so get rid of all our resources
-	 */
-	if (brcmf_dpc_prio > 0) {
-		struct sched_param param;
-		param.sched_priority = (brcmf_dpc_prio < MAX_RT_PRIO) ?
-				       brcmf_dpc_prio : (MAX_RT_PRIO - 1);
-		sched_setscheduler(current, SCHED_FIFO, &param);
-	}
-
 	allow_signal(SIGTERM);
 	/* Run until signal received */
 	while (1) {
@@ -4364,16 +4346,6 @@ brcmf_sdbrcm_watchdog_thread(void *data)
 {
 	struct brcmf_bus *bus = (struct brcmf_bus *)data;
 
-	/* This thread doesn't need any user-level access,
-	* so get rid of all our resources
-	*/
-	if (brcmf_watchdog_prio > 0) {
-		struct sched_param param;
-		param.sched_priority = (brcmf_watchdog_prio < MAX_RT_PRIO) ?
-				       brcmf_watchdog_prio : (MAX_RT_PRIO - 1);
-		sched_setscheduler(current, SCHED_FIFO, &param);
-	}
-
 	allow_signal(SIGTERM);
 	/* Run until signal received */
 	while (1) {
@@ -4394,7 +4366,7 @@ brcmf_sdbrcm_watchdog(unsigned long data)
 {
 	struct brcmf_bus *bus = (struct brcmf_bus *)data;
 
-	if (brcmf_watchdog_prio >= 0) {
+	if (bus->threads_only) {
 		if (bus->watchdog_tsk)
 			complete(&bus->watchdog_wait);
 		else
@@ -4493,6 +4465,7 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
 	bus->tx_seq = SDPCM_SEQUENCE_WRAP - 1;
 	bus->usebufpool = false;	/* Use bufpool if allocated,
 					 else use locally malloced rxbuf */
+	bus->threads_only = true;
 
 	/* attempt to attach to the dongle */
 	if (!(brcmf_sdbrcm_probe_attach(bus, regsva))) {
@@ -4510,14 +4483,9 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
 	bus->timer.function = brcmf_sdbrcm_watchdog;
 
 	/* Initialize thread based operation and lock */
-	if ((brcmf_watchdog_prio >= 0) && (brcmf_dpc_prio >= 0)) {
-		bus->threads_only = true;
+	if (bus->threads_only) {
 		sema_init(&bus->sdsem, 1);
-	} else {
-		bus->threads_only = false;
-	}
 
-	if (brcmf_dpc_prio >= 0) {
 		/* Initialize watchdog thread */
 		init_completion(&bus->watchdog_wait);
 		bus->watchdog_tsk = kthread_run(brcmf_sdbrcm_watchdog_thread,
@@ -4527,11 +4495,6 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
 			       "brcmf_watchdog thread failed to start\n");
 			bus->watchdog_tsk = NULL;
 		}
-	} else
-		bus->watchdog_tsk = NULL;
-
-	/* Set up the bottom half handler */
-	if (brcmf_dpc_prio >= 0) {
 		/* Initialize DPC thread */
 		init_completion(&bus->dpc_wait);
 		bus->dpc_tsk = kthread_run(brcmf_sdbrcm_dpc_thread,
@@ -4542,9 +4505,10 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
 			bus->dpc_tsk = NULL;
 		}
 	} else {
+		bus->watchdog_tsk = NULL;
+		bus->dpc_tsk = NULL;
 		tasklet_init(&bus->tasklet, brcmf_sdbrcm_dpc_tasklet,
 			     (unsigned long)bus);
-		bus->dpc_tsk = NULL;
 	}
 
 	/* Attach to the brcmf/OS/network interface */
@@ -4613,20 +4577,6 @@ int brcmf_bus_register(void)
 {
 	brcmf_dbg(TRACE, "Enter\n");
 
-	/* Sanity check on the module parameters */
-	do {
-		/* Both watchdog and DPC as tasklets are ok */
-		if ((brcmf_watchdog_prio < 0) && (brcmf_dpc_prio < 0))
-			break;
-
-		/* If both watchdog and DPC are threads, TX must be deferred */
-		if (brcmf_watchdog_prio >= 0 && brcmf_dpc_prio >= 0)
-			break;
-
-		brcmf_dbg(ERROR, "Invalid module parameters.\n");
-		return -EINVAL;
-	} while (0);
-
 	return brcmf_sdio_register();
 }
 
-- 
1.7.4.1



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

* [PATCH 10/26] staging: brcm80211: fixed checkpatch warnings
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (8 preceding siblings ...)
  2011-10-04 21:18 ` [PATCH 09/26] staging: brcm80211: stop using assigned thread priority in fullmac Arend van Spriel
@ 2011-10-04 21:18 ` Arend van Spriel
  2011-10-04 21:18 ` [PATCH 11/26] staging: brcm80211: removed accessor functions for band type and etheraddress Arend van Spriel
                   ` (16 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:18 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Alwin Beukers, Arend van Spriel

From: Alwin Beukers <alwin@broadcom.com>

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/aiutils.c |   14 ++++++--------
 drivers/staging/brcm80211/brcmsmac/main.c    |    3 +--
 drivers/staging/brcm80211/brcmsmac/nicpci.c  |    3 +--
 drivers/staging/brcm80211/brcmsmac/srom.c    |    3 +--
 4 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/aiutils.c b/drivers/staging/brcm80211/brcmsmac/aiutils.c
index 0b3ba6a..8d4024e 100644
--- a/drivers/staging/brcm80211/brcmsmac/aiutils.c
+++ b/drivers/staging/brcm80211/brcmsmac/aiutils.c
@@ -1054,9 +1054,8 @@ static struct si_info *ai_doattach(struct si_info *sii,
 	cc = (struct chipcregs __iomem *) regs;
 
 	/* bus/core/clk setup for register access */
-	if (!ai_buscore_prep(sii)) {
+	if (!ai_buscore_prep(sii))
 		return NULL;
-	}
 
 	/*
 	 * ChipID recognition.
@@ -1084,19 +1083,18 @@ static struct si_info *ai_doattach(struct si_info *sii,
 		return NULL;
 	}
 	/* no cores found, bail out */
-	if (sii->numcores == 0) {
+	if (sii->numcores == 0)
 		return NULL;
-	}
+
 	/* bus/core/clk setup */
 	origidx = SI_CC_IDX;
-	if (!ai_buscore_setup(sii, savewin, &origidx)) {
+	if (!ai_buscore_setup(sii, savewin, &origidx))
 		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, vars, varsz))
 		goto exit;
-	}
+
 	pvars = vars ? *vars : NULL;
 	ai_nvram_process(sii, pvars);
 
diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 39b91d6..db05521 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -5995,9 +5995,8 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)
 	 * If we are switching to gmode == GMODE_LEGACY_B,
 	 * clean up rate info that may refer to OFDM rates.
 	 */
-	if ((gmode == GMODE_LEGACY_B) && (band->gmode != GMODE_LEGACY_B)) {
+	if ((gmode == GMODE_LEGACY_B) && (band->gmode != GMODE_LEGACY_B))
 		band->gmode = gmode;
-	}
 
 	band->gmode = gmode;
 
diff --git a/drivers/staging/brcm80211/brcmsmac/nicpci.c b/drivers/staging/brcm80211/brcmsmac/nicpci.c
index e3cce29..460b105 100644
--- a/drivers/staging/brcm80211/brcmsmac/nicpci.c
+++ b/drivers/staging/brcm80211/brcmsmac/nicpci.c
@@ -394,9 +394,8 @@ static bool pcie_mdiosetblock(struct pcicore_info *pi, uint blk)
 		i++;
 	}
 
-	if (i >= pcie_serdes_spinwait) {
+	if (i >= pcie_serdes_spinwait)
 		return false;
-	}
 
 	return true;
 }
diff --git a/drivers/staging/brcm80211/brcmsmac/srom.c b/drivers/staging/brcm80211/brcmsmac/srom.c
index 6f3b12c..13d17eb 100644
--- a/drivers/staging/brcm80211/brcmsmac/srom.c
+++ b/drivers/staging/brcm80211/brcmsmac/srom.c
@@ -1175,8 +1175,7 @@ static int initvars_srom_pci(struct si_pub *sih, void __iomem *curmap,
 			if (sromrev == 0x10)
 				sromrev = 1;
 		}
-	}
-	else {
+	} else {
 		/* Use OTP if SPROM not available */
 		err = otp_read_pci(sih, srom, SROM_MAX);
 		if (err == 0)
-- 
1.7.4.1



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

* [PATCH 11/26] staging: brcm80211: removed accessor functions for band type and etheraddress.
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (9 preceding siblings ...)
  2011-10-04 21:18 ` [PATCH 10/26] staging: brcm80211: fixed checkpatch warnings Arend van Spriel
@ 2011-10-04 21:18 ` Arend van Spriel
  2011-10-04 21:18 ` [PATCH 12/26] staging: brcm80211: fixed function returns Arend van Spriel
                   ` (15 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:18 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Alwin Beukers, Arend van Spriel

From: Alwin Beukers <alwin@broadcom.com>

Functions were trivial so not really adding value.

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/brcmsmac/main.c |   21 +++++----------------
 1 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index db05521..b6c4361 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -1369,16 +1369,6 @@ static void brcms_b_wait_for_wake(struct brcms_hardware *wlc_hw)
 		  DBGST_ASLEEP), wlc_hw->wlc->fastpwrup_dly);
 }
 
-static void brcms_b_hw_etheraddr(struct brcms_hardware *wlc_hw, u8 *ea)
-{
-	memcpy(ea, wlc_hw->etheraddr, ETH_ALEN);
-}
-
-static int brcms_b_bandtype(struct brcms_hardware *wlc_hw)
-{
-	return wlc_hw->band->bandtype;
-}
-
 /* control chip clock to save power, enable dynamic clock or force fast clock */
 static void brcms_b_clkctl_clk(struct brcms_hardware *wlc_hw, uint mode)
 {
@@ -3939,7 +3929,7 @@ static void brcms_b_set_shortslot(struct brcms_hardware *wlc_hw, bool shortslot)
 {
 	wlc_hw->shortslot = shortslot;
 
-	if (brcms_b_bandtype(wlc_hw) == BRCM_BAND_2G && wlc_hw->up) {
+	if (wlc_hw->band->bandtype == BRCM_BAND_2G && wlc_hw->up) {
 		brcms_c_suspend_mac_and_wait(wlc_hw->wlc);
 		brcms_b_update_slot_timing(wlc_hw, shortslot);
 		brcms_c_enable_mac(wlc_hw->wlc);
@@ -4854,8 +4844,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,
-				       brcms_b_bandtype(wlc_hw), vars,
-				       wlc->wiphy);
+					wlc_hw->band->bandtype, vars,
+					wlc->wiphy);
 		if (wlc_hw->band->pi == NULL) {
 			wiphy_err(wiphy, "wl%d: brcms_b_attach: wlc_phy_"
 				  "attach failed\n", unit);
@@ -5235,9 +5225,8 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
 	for (i = 0; i < NFIFO; i++)
 		wlc->core->txavail[i] = wlc->hw->txavail[i];
 
-	brcms_b_hw_etheraddr(wlc->hw, wlc->perm_etheraddr);
-
-	memcpy(&pub->cur_etheraddr, &wlc->perm_etheraddr, ETH_ALEN);
+	memcpy(&wlc->perm_etheraddr, &wlc->hw->etheraddr, ETH_ALEN);
+	memcpy(&pub->cur_etheraddr, &wlc->hw->etheraddr, ETH_ALEN);
 
 	for (j = 0; j < wlc->pub->_nbands; j++) {
 		wlc->band = wlc->bandstate[j];
-- 
1.7.4.1



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

* [PATCH 12/26] staging: brcm80211: fixed function returns
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (10 preceding siblings ...)
  2011-10-04 21:18 ` [PATCH 11/26] staging: brcm80211: removed accessor functions for band type and etheraddress Arend van Spriel
@ 2011-10-04 21:18 ` Arend van Spriel
  2011-10-04 21:18 ` [PATCH 13/26] staging: brcm80211: made NULL ethernet address const Arend van Spriel
                   ` (14 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:18 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Alwin Beukers, Arend van Spriel

From: Alwin Beukers <alwin@broadcom.com>

- removed unneeded return statements at end of functions.
- changed return value of brcms_c_radio_monitor_start to void.

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/brcmsmac/main.c |   23 ++---------------------
 1 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index b6c4361..dc95ba0 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -1572,8 +1572,6 @@ void brcms_c_ucode_wake_override_set(struct brcms_hardware *wlc_hw,
 
 	brcms_c_mctrl_write(wlc_hw);
 	brcms_b_wait_for_wake(wlc_hw);
-
-	return;
 }
 
 void brcms_c_ucode_wake_override_clear(struct brcms_hardware *wlc_hw,
@@ -1585,8 +1583,6 @@ void brcms_c_ucode_wake_override_clear(struct brcms_hardware *wlc_hw,
 		return;
 
 	brcms_c_mctrl_write(wlc_hw);
-
-	return;
 }
 
 /* When driver needs ucode to stop beaconing, it has to make sure that
@@ -1607,8 +1603,6 @@ static void brcms_c_ucode_mute_override_set(struct brcms_hardware *wlc_hw)
 		return;
 
 	brcms_c_mctrl_write(wlc_hw);
-
-	return;
 }
 
 /* Clear the override on AP and INFRA bits */
@@ -3217,8 +3211,6 @@ static void brcms_b_pllreq(struct brcms_hardware *wlc_hw, bool set, u32 req_bit)
 				brcms_b_xtal(wlc_hw, OFF);
 		}
 	}
-
-	return;
 }
 
 static void brcms_b_antsel_set(struct brcms_hardware *wlc_hw, u32 antsel_avail)
@@ -4308,17 +4300,16 @@ static void brcms_c_down_led_upd(struct brcms_c_info *wlc)
 	brcms_c_pllreq(wlc, false, BRCMS_PLLREQ_FLIP);
 }
 
-static bool brcms_c_radio_monitor_start(struct brcms_c_info *wlc)
+static void brcms_c_radio_monitor_start(struct brcms_c_info *wlc)
 {
 	/* Don't start the timer if HWRADIO feature is disabled */
 	if (wlc->radio_monitor)
-		return true;
+		return;
 
 	wlc->radio_monitor = true;
 	brcms_c_pllreq(wlc, true, BRCMS_PLLREQ_RADIO_MON);
 	brcms_add_timer(wlc->wl, wlc->radio_timer, TIMER_INTERVAL_RADIOCHK,
 			true);
-	return true;
 }
 
 void brcms_c_radio_disable(struct brcms_c_info *wlc)
@@ -6123,8 +6114,6 @@ static void brcms_c_ofdm_rateset_war(struct brcms_c_info *wlc)
 		r = wlc->default_bss->rateset.rates[0];
 
 	wlc_phy_ofdm_rateset_war(wlc->band->pi, war);
-
-	return;
 }
 
 int brcms_c_set_channel(struct brcms_c_info *wlc, u16 channel)
@@ -7785,8 +7774,6 @@ brcms_c_compute_ofdm_plcp(u32 rspec, u32 length, u8 *plcp)
 	plcp[2] |= (tmp >> 16) & 0xff;
 	plcp[1] |= (tmp >> 8) & 0xff;
 	plcp[0] |= tmp & 0xff;
-
-	return;
 }
 
 /* Rate: 802.11 rate code, length: PSDU length in octets */
@@ -7808,7 +7795,6 @@ brcms_c_compute_plcp(struct brcms_c_info *wlc, u32 rspec,
 		brcms_c_compute_ofdm_plcp(rspec, length, plcp);
 	else
 		brcms_c_compute_cck_plcp(wlc, rspec, length, plcp);
-	return;
 }
 
 /* brcms_c_compute_rtscts_dur()
@@ -7997,8 +7983,6 @@ brcms_b_read_tsf(struct brcms_hardware *wlc_hw, u32 *tsf_l_ptr,
 	/* read the tsf timer low, then high to get an atomic read */
 	*tsf_l_ptr = R_REG(&regs->tsf_timerlow);
 	*tsf_h_ptr = R_REG(&regs->tsf_timerhigh);
-
-	return;
 }
 
 /*
@@ -8175,7 +8159,6 @@ brcms_c_recvctl(struct brcms_c_info *wlc, struct d11rxhdr *rxh,
 
 	memcpy(IEEE80211_SKB_RXCB(p), &rx_status, sizeof(rx_status));
 	ieee80211_rx_irqsafe(wlc->pub->ieee_hw, p);
-	return;
 }
 
 /* Process received frames */
@@ -8683,8 +8666,6 @@ brcms_c_bcn_prb_template(struct brcms_c_info *wlc, u16 type,
 	memcpy(&h->bssid, &cfg->BSSID, ETH_ALEN);
 
 	/* SEQ filled in by MAC */
-
-	return;
 }
 
 int brcms_c_get_header_len(void)
-- 
1.7.4.1



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

* [PATCH 13/26] staging: brcm80211: made NULL ethernet address const
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (11 preceding siblings ...)
  2011-10-04 21:18 ` [PATCH 12/26] staging: brcm80211: fixed function returns Arend van Spriel
@ 2011-10-04 21:18 ` Arend van Spriel
  2011-10-04 21:19 ` [PATCH 14/26] staging: brcm80211: removed empty brcms_c_reset_bmac_done callback function Arend van Spriel
                   ` (13 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:18 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Alwin Beukers, Arend van Spriel

From: Alwin Beukers <alwin@broadcom.com>

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/brcmsmac/main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index dc95ba0..6a0a5d0 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -2646,7 +2646,7 @@ static void brcms_b_tx_fifo_resume(struct brcms_hardware *wlc_hw,
 
 static void brcms_b_mute(struct brcms_hardware *wlc_hw, bool on, u32 flags)
 {
-	u8 null_ether_addr[ETH_ALEN] = {0, 0, 0, 0, 0, 0};
+	const u8 null_ether_addr[ETH_ALEN] = {0, 0, 0, 0, 0, 0};
 
 	if (on) {
 		/* suspend tx fifos */
-- 
1.7.4.1



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

* [PATCH 14/26] staging: brcm80211: removed empty brcms_c_reset_bmac_done callback function
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (12 preceding siblings ...)
  2011-10-04 21:18 ` [PATCH 13/26] staging: brcm80211: made NULL ethernet address const Arend van Spriel
@ 2011-10-04 21:19 ` Arend van Spriel
  2011-10-04 21:19 ` [PATCH 15/26] staging: brcm80211: decreased indentation level of brcms_c_wme_setparams function Arend van Spriel
                   ` (12 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:19 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Alwin Beukers, Arend van Spriel

From: Alwin Beukers <alwin@broadcom.com>

Empty functions are good candidates for removal.

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/brcmsmac/main.c |    6 ------
 drivers/staging/brcm80211/brcmsmac/main.h |    1 -
 2 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 6a0a5d0..d75756d 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -3258,8 +3258,6 @@ static void brcms_b_reset(struct brcms_hardware *wlc_hw)
 
 	/* purge the dma rings */
 	brcms_c_flushqueues(wlc_hw->wlc);
-
-	brcms_c_reset_bmac_done(wlc_hw->wlc);
 }
 
 void brcms_c_reset(struct brcms_c_info *wlc)
@@ -8868,10 +8866,6 @@ void brcms_c_pllreq(struct brcms_c_info *wlc, bool set, u32 req_bit)
 	brcms_b_pllreq(wlc->hw, set, req_bit);
 }
 
-void brcms_c_reset_bmac_done(struct brcms_c_info *wlc)
-{
-}
-
 /* check for the particular priority flow control bit being set */
 bool
 brcms_c_txflowcontrol_prio_isset(struct brcms_c_info *wlc,
diff --git a/drivers/staging/brcm80211/brcmsmac/main.h b/drivers/staging/brcm80211/brcmsmac/main.h
index 9e1575c..5a2ec53 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.h
+++ b/drivers/staging/brcm80211/brcmsmac/main.h
@@ -677,7 +677,6 @@ extern int brcms_c_xmtfifo_sz_get(struct brcms_c_info *wlc, uint fifo,
 extern void brcms_c_write_template_ram(struct brcms_c_info *wlc, int offset,
 				       int len, void *buf);
 extern void brcms_c_pllreq(struct brcms_c_info *wlc, bool set, u32 req_bit);
-extern void brcms_c_reset_bmac_done(struct brcms_c_info *wlc);
 
 #if defined(BCMDBG)
 extern void brcms_c_print_rxh(struct d11rxhdr *rxh);
-- 
1.7.4.1



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

* [PATCH 15/26] staging: brcm80211: decreased indentation level of brcms_c_wme_setparams function
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (13 preceding siblings ...)
  2011-10-04 21:19 ` [PATCH 14/26] staging: brcm80211: removed empty brcms_c_reset_bmac_done callback function Arend van Spriel
@ 2011-10-04 21:19 ` Arend van Spriel
  2011-10-04 21:19 ` [PATCH 16/26] staging: brcm80211: removed redundant code from brcms_c_set_gmode Arend van Spriel
                   ` (11 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:19 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Alwin Beukers, Arend van Spriel

From: Alwin Beukers <alwin@broadcom.com>

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/brcmsmac/main.c |   40 +++++++++++++----------------
 1 files changed, 18 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index d75756d..3349716 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -4199,26 +4199,23 @@ void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci,
 		return;
 	}
 
-	do {
-		memset((char *)&acp_shm, 0, sizeof(struct shm_acparams));
-		/* fill in shm ac params struct */
-		acp_shm.txop = params->txop;
-		/* convert from units of 32us to us for ucode */
-		wlc->edcf_txop[aci & 0x3] = acp_shm.txop =
-		    EDCF_TXOP2USEC(acp_shm.txop);
-		acp_shm.aifs = (params->aifs & EDCF_AIFSN_MASK);
-
-		if (aci == AC_VI && acp_shm.txop == 0
-		    && acp_shm.aifs < EDCF_AIFSN_MAX)
-			acp_shm.aifs++;
-
-		if (acp_shm.aifs < EDCF_AIFSN_MIN
-		    || acp_shm.aifs > EDCF_AIFSN_MAX) {
-			wiphy_err(wlc->wiphy, "wl%d: edcf_setparams: bad "
-				  "aifs %d\n", wlc->pub->unit, acp_shm.aifs);
-			continue;
-		}
-
+	memset((char *)&acp_shm, 0, sizeof(struct shm_acparams));
+	/* fill in shm ac params struct */
+	acp_shm.txop = params->txop;
+	/* convert from units of 32us to us for ucode */
+	wlc->edcf_txop[aci & 0x3] = acp_shm.txop =
+	    EDCF_TXOP2USEC(acp_shm.txop);
+	acp_shm.aifs = (params->aifs & EDCF_AIFSN_MASK);
+
+	if (aci == AC_VI && acp_shm.txop == 0
+	    && acp_shm.aifs < EDCF_AIFSN_MAX)
+		acp_shm.aifs++;
+
+	if (acp_shm.aifs < EDCF_AIFSN_MIN
+	    || acp_shm.aifs > EDCF_AIFSN_MAX) {
+		wiphy_err(wlc->wiphy, "wl%d: edcf_setparams: bad "
+			  "aifs %d\n", wlc->pub->unit, acp_shm.aifs);
+	} else {
 		acp_shm.cwmin = params->cw_min;
 		acp_shm.cwmax = params->cw_max;
 		acp_shm.cwcur = acp_shm.cwmin;
@@ -4239,8 +4236,7 @@ void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci,
 					  M_EDCF_QINFO +
 					  wme_ac2fifo[aci] * M_EDCF_QLEN + i,
 					  *shm_entry++);
-
-	} while (0);
+	}
 
 	if (suspend)
 		brcms_c_suspend_mac_and_wait(wlc);
-- 
1.7.4.1



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

* [PATCH 16/26] staging: brcm80211: removed redundant code from brcms_c_set_gmode
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (14 preceding siblings ...)
  2011-10-04 21:19 ` [PATCH 15/26] staging: brcm80211: decreased indentation level of brcms_c_wme_setparams function Arend van Spriel
@ 2011-10-04 21:19 ` Arend van Spriel
  2011-10-04 21:19 ` [PATCH 17/26] staging: brcm80211: cleanup of shared memory related wrapper functions Arend van Spriel
                   ` (10 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:19 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Alwin Beukers, Arend van Spriel

From: Alwin Beukers <alwin@broadcom.com>

The comment says the rateset is being cleared when switching to GMODE_LEGACY_B,
but the code that follows it does not do so. Besides, the rateset is already
valid at this point.

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/brcmsmac/main.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 3349716..9988e03 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -5965,13 +5965,6 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)
 		return -ENOTSUPP;
 	}
 
-	/*
-	 * If we are switching to gmode == GMODE_LEGACY_B,
-	 * clean up rate info that may refer to OFDM rates.
-	 */
-	if ((gmode == GMODE_LEGACY_B) && (band->gmode != GMODE_LEGACY_B))
-		band->gmode = gmode;
-
 	band->gmode = gmode;
 
 	wlc->shortslot_override = shortslot;
-- 
1.7.4.1



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

* [PATCH 17/26] staging: brcm80211: cleanup of shared memory related wrapper functions
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (15 preceding siblings ...)
  2011-10-04 21:19 ` [PATCH 16/26] staging: brcm80211: removed redundant code from brcms_c_set_gmode Arend van Spriel
@ 2011-10-04 21:19 ` Arend van Spriel
  2011-10-04 21:19 ` [PATCH 18/26] staging: brcm80211: cleanup of transmit buffer size related wrapper function Arend van Spriel
                   ` (9 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:19 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Alwin Beukers, Arend van Spriel

From: Alwin Beukers <alwin@broadcom.com>

- removed brcms_c_read_shm and brcms_c_write_shm functions.
- removed redundant argument check from brcms_c_copyto_shm function.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/ampdu.c  |   10 ++--
 drivers/staging/brcm80211/brcmsmac/antsel.c |    4 +-
 drivers/staging/brcm80211/brcmsmac/main.c   |   78 ++++++++++++---------------
 drivers/staging/brcm80211/brcmsmac/main.h   |    2 -
 4 files changed, 41 insertions(+), 53 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/ampdu.c b/drivers/staging/brcm80211/brcmsmac/ampdu.c
index e29c62e..506c392 100644
--- a/drivers/staging/brcm80211/brcmsmac/ampdu.c
+++ b/drivers/staging/brcm80211/brcmsmac/ampdu.c
@@ -369,7 +369,7 @@ static int brcms_c_ffpld_check_txfunfl(struct brcms_c_info *wlc, int fid)
 	u16 cur_txunfl;
 
 	/* return if we got here for a different reason than underflows */
-	cur_txunfl = brcms_c_read_shm(wlc,
+	cur_txunfl = brcms_b_read_shm(wlc->hw,
 				      M_UCODE_MACSTAT +
 				      offsetof(struct macstat, txfunfl[fid]));
 	new_txunfl = (u16) (cur_txunfl - fifo->prev_txfunfl);
@@ -1182,11 +1182,11 @@ void brcms_c_ampdu_shm_upd(struct ampdu_info *ampdu)
 	 */
 	if ((ampdu->rx_factor & IEEE80211_HT_AMPDU_PARM_FACTOR) ==
 	    IEEE80211_HT_MAX_AMPDU_64K) {
-		brcms_c_write_shm(wlc, M_MIMO_MAXSYM, MIMO_MAXSYM_MAX);
-		brcms_c_write_shm(wlc, M_WATCHDOG_8TU, WATCHDOG_8TU_MAX);
+		brcms_b_write_shm(wlc->hw, M_MIMO_MAXSYM, MIMO_MAXSYM_MAX);
+		brcms_b_write_shm(wlc->hw, M_WATCHDOG_8TU, WATCHDOG_8TU_MAX);
 	} else {
-		brcms_c_write_shm(wlc, M_MIMO_MAXSYM, MIMO_MAXSYM_DEF);
-		brcms_c_write_shm(wlc, M_WATCHDOG_8TU, WATCHDOG_8TU_DEF);
+		brcms_b_write_shm(wlc->hw, M_MIMO_MAXSYM, MIMO_MAXSYM_DEF);
+		brcms_b_write_shm(wlc->hw, M_WATCHDOG_8TU, WATCHDOG_8TU_DEF);
 	}
 }
 
diff --git a/drivers/staging/brcm80211/brcmsmac/antsel.c b/drivers/staging/brcm80211/brcmsmac/antsel.c
index c61c520..c2aa47b 100644
--- a/drivers/staging/brcm80211/brcmsmac/antsel.c
+++ b/drivers/staging/brcm80211/brcmsmac/antsel.c
@@ -206,7 +206,7 @@ static int brcms_c_antsel_cfgupd(struct antsel_info *asi,
 	 */
 	ant_cfg = antsel->ant_config[ANT_SELCFG_TX_DEF];
 	mimo_antsel = brcms_c_antsel_antcfg2antsel(asi, ant_cfg);
-	brcms_c_write_shm(wlc, M_MIMO_ANTSEL_TXDFLT, mimo_antsel);
+	brcms_b_write_shm(wlc->hw, M_MIMO_ANTSEL_TXDFLT, mimo_antsel);
 	/*
 	 * Update driver stats for currently selected
 	 * default tx/rx antenna config
@@ -218,7 +218,7 @@ static int brcms_c_antsel_cfgupd(struct antsel_info *asi,
 	 */
 	ant_cfg = antsel->ant_config[ANT_SELCFG_RX_DEF];
 	mimo_antsel = brcms_c_antsel_antcfg2antsel(asi, ant_cfg);
-	brcms_c_write_shm(wlc, M_MIMO_ANTSEL_RXDFLT, mimo_antsel);
+	brcms_b_write_shm(wlc->hw, M_MIMO_ANTSEL_RXDFLT, mimo_antsel);
 	/*
 	 * Update driver stats for currently selected
 	 * default tx/rx antenna config
diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 9988e03..5d3bfda 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -3104,17 +3104,26 @@ brcms_b_write_objmem(struct brcms_hardware *wlc_hw, uint offset, u16 v,
 		W_REG(objdata_lo, v);
 }
 
+/*
+ * Read a single u16 from shared memory.
+ * SHM 'offset' needs to be an even address
+ */
 u16 brcms_b_read_shm(struct brcms_hardware *wlc_hw, uint offset)
 {
 	return brcms_b_read_objmem(wlc_hw, offset, OBJADDR_SHM_SEL);
 }
 
+/*
+ * Write a single u16 to shared memory.
+ * SHM 'offset' needs to be an even address
+ */
 void brcms_b_write_shm(struct brcms_hardware *wlc_hw, uint offset, u16 v)
 {
 	brcms_b_write_objmem(wlc_hw, offset, v, OBJADDR_SHM_SEL);
 }
 
-/* Copy a buffer to shared memory of specified type .
+/*
+ * Copy a buffer to shared memory of specified type .
  * SHM 'offset' needs to be an even address and
  * Buffer length 'len' must be an even number of bytes
  * 'sel' selects the type of memory
@@ -3136,7 +3145,8 @@ brcms_b_copyto_objmem(struct brcms_hardware *wlc_hw, uint offset,
 	}
 }
 
-/* Copy a piece of shared memory of specified type to a buffer .
+/*
+ * Copy a piece of shared memory of specified type to a buffer .
  * SHM 'offset' needs to be an even address and
  * Buffer length 'len' must be an even number of bytes
  * 'sel' selects the type of memory
@@ -3627,7 +3637,8 @@ static void brcms_c_ucode_mac_upd(struct brcms_c_info *wlc)
 			 * inits to populate a bogus beacon.
 			 */
 			if (BRCMS_PHY_11N_CAP(wlc->band))
-				brcms_c_write_shm(wlc, M_BCN_TXTSF_OFFSET, 0);
+				brcms_b_write_shm(wlc->hw,
+						M_BCN_TXTSF_OFFSET, 0);
 		}
 	} else {
 		/* disable an active IBSS if we are not on the home channel */
@@ -3673,7 +3684,7 @@ brcms_c_duty_cycle_set(struct brcms_c_info *wlc, int duty_cycle, bool isOFDM,
 		idle_busy_ratio_x_16 = (100 - duty_cycle) * 16 / duty_cycle;
 	/* Only write to shared memory  when wl is up */
 	if (writeToShm)
-		brcms_c_write_shm(wlc, offset, (u16) idle_busy_ratio_x_16);
+		brcms_b_write_shm(wlc->hw, offset, (u16) idle_busy_ratio_x_16);
 
 	if (isOFDM)
 		wlc->tx_duty_cycle_ofdm = (u16) duty_cycle;
@@ -3766,10 +3777,10 @@ void brcms_c_init(struct brcms_c_info *wlc)
 	brcms_c_bandinit_ordered(wlc, chanspec);
 
 	/* init probe response timeout */
-	brcms_c_write_shm(wlc, M_PRS_MAXTIME, wlc->prb_resp_timeout);
+	brcms_b_write_shm(wlc->hw, M_PRS_MAXTIME, wlc->prb_resp_timeout);
 
 	/* init max burst txop (framebursting) */
-	brcms_c_write_shm(wlc, M_MBURST_TXOP,
+	brcms_b_write_shm(wlc->hw, M_MBURST_TXOP,
 		      (wlc->
 		       _rifs ? (EDCF_AC_VO_TXOP_AP << 5) : MAXFRAMEBURST_TXOP));
 
@@ -3796,8 +3807,8 @@ void brcms_c_init(struct brcms_c_info *wlc)
 	/* read the ucode version if we have not yet done so */
 	if (wlc->ucode_rev == 0) {
 		wlc->ucode_rev =
-		    brcms_c_read_shm(wlc, M_BOM_REV_MAJOR) << NBITS(u16);
-		wlc->ucode_rev |= brcms_c_read_shm(wlc, M_BOM_REV_MINOR);
+		    brcms_b_read_shm(wlc->hw, M_BOM_REV_MAJOR) << NBITS(u16);
+		wlc->ucode_rev |= brcms_b_read_shm(wlc->hw, M_BOM_REV_MINOR);
 	}
 
 	/* ..now really unleash hell (allow the MAC out of suspend) */
@@ -3822,7 +3833,7 @@ void brcms_c_init(struct brcms_c_info *wlc)
 
 		for (ac = 0; ac < AC_COUNT; ac++)
 			wlc->wme_retries[ac] =
-			    brcms_c_read_shm(wlc, M_AC_TXLMT_ADDR(ac));
+			    brcms_b_read_shm(wlc->hw, M_AC_TXLMT_ADDR(ac));
 	}
 }
 
@@ -4110,9 +4121,9 @@ void brcms_c_beacon_phytxctl_txant_upd(struct brcms_c_info *wlc,
 	if (BRCMS_PHY_11N_CAP(wlc->band))
 		phytxant = brcms_c_stf_phytxchain_sel(wlc, bcn_rspec);
 
-	phyctl = brcms_c_read_shm(wlc, M_BCN_PCTLWD);
+	phyctl = brcms_b_read_shm(wlc->hw, M_BCN_PCTLWD);
 	phyctl = (phyctl & ~mask) | phytxant;
-	brcms_c_write_shm(wlc, M_BCN_PCTLWD, phyctl);
+	brcms_b_write_shm(wlc->hw, M_BCN_PCTLWD, phyctl);
 }
 
 /*
@@ -4223,7 +4234,7 @@ void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci,
 		    R_REG(&wlc->regs->tsf_random) & acp_shm.cwcur;
 		acp_shm.reggap = acp_shm.bslots + acp_shm.aifs;
 		/* Indicate the new params to the ucode */
-		acp_shm.status = brcms_c_read_shm(wlc, (M_EDCF_QINFO +
+		acp_shm.status = brcms_b_read_shm(wlc->hw, (M_EDCF_QINFO +
 						  wme_ac2fifo[aci] *
 						  M_EDCF_QLEN +
 						  M_EDCF_STATUS_OFF));
@@ -4232,7 +4243,7 @@ void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci,
 		/* Fill in shm acparam table */
 		shm_entry = (u16 *) &acp_shm;
 		for (i = 0; i < (int)sizeof(struct shm_acparams); i += 2)
-			brcms_c_write_shm(wlc,
+			brcms_b_write_shm(wlc->hw,
 					  M_EDCF_QINFO +
 					  wme_ac2fifo[aci] * M_EDCF_QLEN + i,
 					  *shm_entry++);
@@ -5642,7 +5653,7 @@ static void brcms_c_wme_retries_write(struct brcms_c_info *wlc)
 		return;
 
 	for (ac = 0; ac < AC_COUNT; ac++)
-		brcms_c_write_shm(wlc, M_AC_TXLMT_ADDR(ac),
+		brcms_b_write_shm(wlc->hw, M_AC_TXLMT_ADDR(ac),
 				  wlc->wme_retries[ac]);
 }
 
@@ -7955,9 +7966,9 @@ void brcms_c_bcn_li_upd(struct brcms_c_info *wlc)
 {
 	/* wake up every DTIM is the default */
 	if (wlc->bcn_li_dtim == 1)
-		brcms_c_write_shm(wlc, M_BCN_LI, 0);
+		brcms_b_write_shm(wlc->hw, M_BCN_LI, 0);
 	else
-		brcms_c_write_shm(wlc, M_BCN_LI,
+		brcms_b_write_shm(wlc->hw, M_BCN_LI,
 			      (wlc->bcn_li_dtim << 8) | wlc->bcn_li_bcn);
 }
 
@@ -8453,12 +8464,12 @@ static void brcms_c_write_rate_shm(struct brcms_c_info *wlc, u8 rate,
 	/* Find the SHM pointer to the ACK rate entry by looking in the
 	 * Direct-map Table
 	 */
-	basic_ptr = brcms_c_read_shm(wlc, (dir_table + basic_index * 2));
+	basic_ptr = brcms_b_read_shm(wlc->hw, (dir_table + basic_index * 2));
 
 	/* Update the SHM BSS-basic-rate-set mapping table with the pointer
 	 * to the correct basic rate for the given incoming rate
 	 */
-	brcms_c_write_shm(wlc, (basic_table + index * 2), basic_ptr);
+	brcms_b_write_shm(wlc->hw, (basic_table + index * 2), basic_ptr);
 }
 
 static const struct brcms_c_rateset *
@@ -8584,11 +8595,11 @@ void brcms_c_mod_prb_rsp_rate_table(struct brcms_c_info *wlc, uint frame_len)
 		dur += sifs;
 
 		/* Update the SHM Rate Table entry Probe Response values */
-		brcms_c_write_shm(wlc, entry_ptr + M_RT_PRS_PLCP_POS,
+		brcms_b_write_shm(wlc->hw, entry_ptr + M_RT_PRS_PLCP_POS,
 			      (u16) (plcp[0] + (plcp[1] << 8)));
-		brcms_c_write_shm(wlc, entry_ptr + M_RT_PRS_PLCP_POS + 2,
+		brcms_b_write_shm(wlc->hw, entry_ptr + M_RT_PRS_PLCP_POS + 2,
 			      (u16) (plcp[2] + (plcp[3] << 8)));
-		brcms_c_write_shm(wlc, entry_ptr + M_RT_PRS_DUR_POS, dur);
+		brcms_b_write_shm(wlc->hw, entry_ptr + M_RT_PRS_DUR_POS, dur);
 	}
 }
 
@@ -8684,7 +8695,7 @@ void brcms_c_shm_ssid_upd(struct brcms_c_info *wlc, struct brcms_bss_cfg *cfg)
 	memcpy(ssidbuf, ssidptr, cfg->SSID_len);
 
 	brcms_c_copyto_shm(wlc, base, ssidbuf, IEEE80211_MAX_SSID_LEN);
-	brcms_c_write_shm(wlc, M_SSIDLEN, (u16) cfg->SSID_len);
+	brcms_b_write_shm(wlc->hw, M_SSIDLEN, (u16) cfg->SSID_len);
 }
 
 void brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend)
@@ -8721,7 +8732,7 @@ brcms_c_bss_update_probe_resp(struct brcms_c_info *wlc,
 				    (len + 3) & ~3, prb_resp);
 
 	/* write the length of the probe response frame (+PLCP/-FCS) */
-	brcms_c_write_shm(wlc, M_PRB_RESP_FRM_LEN, (u16) len);
+	brcms_b_write_shm(wlc->hw, M_PRB_RESP_FRM_LEN, (u16) len);
 
 	/* write the SSID and SSID length */
 	brcms_c_shm_ssid_upd(wlc, cfg);
@@ -8777,22 +8788,6 @@ void brcms_default_rateset(struct brcms_c_info *wlc, struct brcms_c_rateset *rs)
 		wlc->stf->txstreams);
 }
 
-/* Read a single u16 from shared memory.
- * SHM 'offset' needs to be an even address
- */
-u16 brcms_c_read_shm(struct brcms_c_info *wlc, uint offset)
-{
-	return brcms_b_read_shm(wlc->hw, offset);
-}
-
-/* Write a single u16 to shared memory.
- * SHM 'offset' needs to be an even address
- */
-void brcms_c_write_shm(struct brcms_c_info *wlc, uint offset, u16 v)
-{
-	brcms_b_write_shm(wlc->hw, offset, v);
-}
-
 /* Copy a buffer to shared memory.
  * SHM 'offset' needs to be an even address and
  * Buffer length 'len' must be an even number of bytes
@@ -8800,12 +8795,7 @@ void brcms_c_write_shm(struct brcms_c_info *wlc, uint offset, u16 v)
 void brcms_c_copyto_shm(struct brcms_c_info *wlc, uint offset, const void *buf,
 			int len)
 {
-	/* offset and len need to be even */
-	if (len <= 0 || (offset & 1) || (len & 1))
-		return;
-
 	brcms_b_copyto_objmem(wlc->hw, offset, buf, len, OBJADDR_SHM_SEL);
-
 }
 
 /* wrapper BMAC functions to for HIGH driver access */
diff --git a/drivers/staging/brcm80211/brcmsmac/main.h b/drivers/staging/brcm80211/brcmsmac/main.h
index 5a2ec53..6512e7a 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.h
+++ b/drivers/staging/brcm80211/brcmsmac/main.h
@@ -732,8 +732,6 @@ extern void brcms_c_inval_dma_pkts(struct brcms_hardware *hw,
 			       void (*dma_callback_fn));
 
 /* Shared memory access */
-extern void brcms_c_write_shm(struct brcms_c_info *wlc, uint offset, u16 v);
-extern u16 brcms_c_read_shm(struct brcms_c_info *wlc, uint offset);
 extern void brcms_c_copyto_shm(struct brcms_c_info *wlc, uint offset,
 			       const void *buf, int len);
 
-- 
1.7.4.1



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

* [PATCH 18/26] staging: brcm80211: cleanup of transmit buffer size related wrapper function
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (16 preceding siblings ...)
  2011-10-04 21:19 ` [PATCH 17/26] staging: brcm80211: cleanup of shared memory related wrapper functions Arend van Spriel
@ 2011-10-04 21:19 ` Arend van Spriel
  2011-10-04 21:19 ` [PATCH 19/26] staging: brcm80211: cleanup of several wrapper functions Arend van Spriel
                   ` (8 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:19 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Alwin Beukers, Arend van Spriel

From: Alwin Beukers <alwin@broadcom.com>

Removed brcms_c_xmtfifo_sz_get function.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/ampdu.c |    2 +-
 drivers/staging/brcm80211/brcmsmac/main.c  |    7 +------
 drivers/staging/brcm80211/brcmsmac/main.h  |    4 ++--
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/ampdu.c b/drivers/staging/brcm80211/brcmsmac/ampdu.c
index 506c392..fc49900 100644
--- a/drivers/staging/brcm80211/brcmsmac/ampdu.c
+++ b/drivers/staging/brcm80211/brcmsmac/ampdu.c
@@ -383,7 +383,7 @@ static int brcms_c_ffpld_check_txfunfl(struct brcms_c_info *wlc, int fid)
 		return 1;
 
 	/* check if fifo is big enough */
-	if (brcms_c_xmtfifo_sz_get(wlc, fid, &xmtfifo_sz))
+	if (brcms_b_xmtfifo_sz_get(wlc->hw, fid, &xmtfifo_sz))
 		return -1;
 
 	if ((TXFIFO_SIZE_UNIT * (u32) xmtfifo_sz) <= ampdu->ffpld_rsvd)
diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 5d3bfda..cbed10c 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -8809,7 +8809,7 @@ void brcms_c_mhf(struct brcms_c_info *wlc, u8 idx, u16 mask, u16 val, int bands)
 	brcms_b_mhf(wlc->hw, idx, mask, val, bands);
 }
 
-static int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo,
+int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo,
 			   uint *blocks)
 {
 	if (fifo >= NFIFO)
@@ -8820,11 +8820,6 @@ static int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo,
 	return 0;
 }
 
-int brcms_c_xmtfifo_sz_get(struct brcms_c_info *wlc, uint fifo, uint *blocks)
-{
-	return brcms_b_xmtfifo_sz_get(wlc->hw, fifo, blocks);
-}
-
 void brcms_c_write_template_ram(struct brcms_c_info *wlc, int offset, int len,
 			    void *buf)
 {
diff --git a/drivers/staging/brcm80211/brcmsmac/main.h b/drivers/staging/brcm80211/brcmsmac/main.h
index 6512e7a..a71c509 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.h
+++ b/drivers/staging/brcm80211/brcmsmac/main.h
@@ -672,8 +672,8 @@ extern void brcms_c_txq_enq(struct brcms_c_info *wlc, struct scb *scb,
 			    struct sk_buff *sdu, uint prec);
 extern void brcms_c_info_init(struct brcms_c_info *wlc, int unit);
 extern void brcms_c_print_txstatus(struct tx_status *txs);
-extern int brcms_c_xmtfifo_sz_get(struct brcms_c_info *wlc, uint fifo,
-				  uint *blocks);
+extern int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo,
+		   uint *blocks);
 extern void brcms_c_write_template_ram(struct brcms_c_info *wlc, int offset,
 				       int len, void *buf);
 extern void brcms_c_pllreq(struct brcms_c_info *wlc, bool set, u32 req_bit);
-- 
1.7.4.1



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

* [PATCH 19/26] staging: brcm80211: cleanup of several wrapper functions
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (17 preceding siblings ...)
  2011-10-04 21:19 ` [PATCH 18/26] staging: brcm80211: cleanup of transmit buffer size related wrapper function Arend van Spriel
@ 2011-10-04 21:19 ` Arend van Spriel
  2011-10-04 21:19 ` [PATCH 20/26] staging: brcm80211: removed unneeded call to brcms_b_tx_fifo_suspended Arend van Spriel
                   ` (7 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:19 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Alwin Beukers, Arend van Spriel

From: Alwin Beukers <alwin@broadcom.com>

- removed brcms_c_write_template_ram function.
- removed brcms_c_mctrl function.
- removed brcms_c_pllreq function.
- removed brcms_c_mhf function.
- removed brcms_c_rate_shm_offset function.
- removed brcms_c_write_hw_bcntemplates function.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
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/brcmsmac/ampdu.c |    2 +-
 drivers/staging/brcm80211/brcmsmac/main.c  |   51 ++++++---------------------
 drivers/staging/brcm80211/brcmsmac/main.h  |    3 --
 3 files changed, 13 insertions(+), 43 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/ampdu.c b/drivers/staging/brcm80211/brcmsmac/ampdu.c
index fc49900..7f27dbd 100644
--- a/drivers/staging/brcm80211/brcmsmac/ampdu.c
+++ b/drivers/staging/brcm80211/brcmsmac/ampdu.c
@@ -1162,7 +1162,7 @@ void brcms_c_ampdu_macaddr_upd(struct brcms_c_info *wlc)
 	/* driver needs to write the ta in the template; ta is at offset 16 */
 	memset(template, 0, sizeof(template));
 	memcpy(template, wlc->pub->cur_etheraddr, ETH_ALEN);
-	brcms_c_write_template_ram(wlc, (T_BA_TPL_BASE + 16),
+	brcms_b_write_template_ram(wlc->hw, (T_BA_TPL_BASE + 16),
 				  (T_RAM_ACCESS_SZ * 2),
 				  template);
 }
diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index cbed10c..bd38f33 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -3846,9 +3846,9 @@ void brcms_c_mac_bcn_promisc_change(struct brcms_c_info *wlc, bool promisc)
 void brcms_c_mac_bcn_promisc(struct brcms_c_info *wlc)
 {
 	if (wlc->bcnmisc_monitor)
-		brcms_c_mctrl(wlc, MCTL_BCNS_PROMISC, MCTL_BCNS_PROMISC);
+		brcms_b_mctrl(wlc->hw, MCTL_BCNS_PROMISC, MCTL_BCNS_PROMISC);
 	else
-		brcms_c_mctrl(wlc, MCTL_BCNS_PROMISC, 0);
+		brcms_b_mctrl(wlc->hw, MCTL_BCNS_PROMISC, 0);
 }
 
 /* set or clear maccontrol bits MCTL_PROMISC and MCTL_KEEPCONTROL */
@@ -3872,7 +3872,7 @@ void brcms_c_mac_promisc(struct brcms_c_info *wlc)
 	if (wlc->monitor)
 		promisc_bits |= MCTL_PROMISC | MCTL_KEEPCONTROL;
 
-	brcms_c_mctrl(wlc, MCTL_PROMISC | MCTL_KEEPCONTROL, promisc_bits);
+	brcms_b_mctrl(wlc->hw, MCTL_PROMISC | MCTL_KEEPCONTROL, promisc_bits);
 }
 
 /* push sw hps and wake state through hardware */
@@ -3891,7 +3891,7 @@ void brcms_c_set_ps_ctrl(struct brcms_c_info *wlc)
 	if (hps)
 		v2 |= MCTL_HPS;
 
-	brcms_c_mctrl(wlc, MCTL_WAKE | MCTL_HPS, v2);
+	brcms_b_mctrl(wlc->hw, MCTL_WAKE | MCTL_HPS, v2);
 
 	awake_before = ((v1 & MCTL_WAKE) || ((v1 & MCTL_HPS) == 0));
 
@@ -4301,8 +4301,8 @@ static void brcms_c_down_led_upd(struct brcms_c_info *wlc)
 	 * maintain LEDs while in down state, turn on sbclk if
 	 * not available yet. Turn on sbclk if necessary
 	 */
-	brcms_c_pllreq(wlc, true, BRCMS_PLLREQ_FLIP);
-	brcms_c_pllreq(wlc, false, BRCMS_PLLREQ_FLIP);
+	brcms_b_pllreq(wlc->hw, true, BRCMS_PLLREQ_FLIP);
+	brcms_b_pllreq(wlc->hw, false, BRCMS_PLLREQ_FLIP);
 }
 
 static void brcms_c_radio_monitor_start(struct brcms_c_info *wlc)
@@ -4312,7 +4312,7 @@ static void brcms_c_radio_monitor_start(struct brcms_c_info *wlc)
 		return;
 
 	wlc->radio_monitor = true;
-	brcms_c_pllreq(wlc, true, BRCMS_PLLREQ_RADIO_MON);
+	brcms_b_pllreq(wlc->hw, true, BRCMS_PLLREQ_RADIO_MON);
 	brcms_add_timer(wlc->wl, wlc->radio_timer, TIMER_INTERVAL_RADIOCHK,
 			true);
 }
@@ -4345,7 +4345,7 @@ bool brcms_c_radio_monitor_stop(struct brcms_c_info *wlc)
 		return true;
 
 	wlc->radio_monitor = false;
-	brcms_c_pllreq(wlc, false, BRCMS_PLLREQ_RADIO_MON);
+	brcms_b_pllreq(wlc->hw, false, BRCMS_PLLREQ_RADIO_MON);
 	return brcms_del_timer(wlc->wl, wlc->radio_timer);
 }
 
@@ -5675,10 +5675,10 @@ int brcms_c_up(struct brcms_c_info *wlc)
 	    && (wlc->pub->sih->chip == BCM4313_CHIP_ID)) {
 		if (wlc->pub->boardrev >= 0x1250
 		    && (wlc->pub->boardflags & BFL_FEM_BT))
-			brcms_c_mhf(wlc, MHF5, MHF5_4313_GPIOCTRL,
+			brcms_b_mhf(wlc->hw, MHF5, MHF5_4313_GPIOCTRL,
 				MHF5_4313_GPIOCTRL, BRCM_BAND_ALL);
 		else
-			brcms_c_mhf(wlc, MHF4, MHF4_EXTPA_ENABLE,
+			brcms_b_mhf(wlc->hw, MHF4, MHF4_EXTPA_ENABLE,
 				    MHF4_EXTPA_ENABLE, BRCM_BAND_ALL);
 	}
 
@@ -5720,7 +5720,7 @@ int brcms_c_up(struct brcms_c_info *wlc)
 	brcms_c_radio_monitor_stop(wlc);
 
 	/* Set EDCF hostflags */
-	brcms_c_mhf(wlc, MHF1, MHF1_EDCF, MHF1_EDCF, BRCM_BAND_ALL);
+	brcms_b_mhf(wlc->hw, MHF1, MHF1_EDCF, MHF1_EDCF, BRCM_BAND_ALL);
 
 	brcms_init(wlc->wl);
 	wlc->pub->up = true;
@@ -6578,11 +6578,6 @@ u16 brcms_b_rate_shm_offset(struct brcms_hardware *wlc_hw, u8 rate)
 	return 2 * brcms_b_read_shm(wlc_hw, table_ptr + (index * 2));
 }
 
-static u16 brcms_c_rate_shm_offset(struct brcms_c_info *wlc, u8 rate)
-{
-	return brcms_b_rate_shm_offset(wlc->hw, rate);
-}
-
 /* Callback for device removed */
 
 /*
@@ -8581,7 +8576,7 @@ void brcms_c_mod_prb_rsp_rate_table(struct brcms_c_info *wlc, uint frame_len)
 	for (i = 0; i < rs.count; i++) {
 		rate = rs.rates[i] & BRCMS_RATE_MASK;
 
-		entry_ptr = brcms_c_rate_shm_offset(wlc, rate);
+		entry_ptr = brcms_b_rate_shm_offset(wlc->hw, rate);
 
 		/* Calculate the Probe Response PLCP for the given rate */
 		brcms_c_compute_plcp(wlc, rate, frame_len, plcp);
@@ -8798,17 +8793,6 @@ void brcms_c_copyto_shm(struct brcms_c_info *wlc, uint offset, const void *buf,
 	brcms_b_copyto_objmem(wlc->hw, offset, buf, len, OBJADDR_SHM_SEL);
 }
 
-/* wrapper BMAC functions to for HIGH driver access */
-void brcms_c_mctrl(struct brcms_c_info *wlc, u32 mask, u32 val)
-{
-	brcms_b_mctrl(wlc->hw, mask, val);
-}
-
-void brcms_c_mhf(struct brcms_c_info *wlc, u8 idx, u16 mask, u16 val, int bands)
-{
-	brcms_b_mhf(wlc->hw, idx, mask, val, bands);
-}
-
 int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo,
 			   uint *blocks)
 {
@@ -8820,12 +8804,6 @@ int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo,
 	return 0;
 }
 
-void brcms_c_write_template_ram(struct brcms_c_info *wlc, int offset, int len,
-			    void *buf)
-{
-	brcms_b_write_template_ram(wlc->hw, offset, len, buf);
-}
-
 void
 brcms_c_set_addrmatch(struct brcms_c_info *wlc, int match_reg_offset,
 		  const u8 *addr)
@@ -8835,11 +8813,6 @@ brcms_c_set_addrmatch(struct brcms_c_info *wlc, int match_reg_offset,
 		memcpy(wlc->bsscfg->BSSID, addr, ETH_ALEN);
 }
 
-void brcms_c_pllreq(struct brcms_c_info *wlc, bool set, u32 req_bit)
-{
-	brcms_b_pllreq(wlc->hw, set, req_bit);
-}
-
 /* check for the particular priority flow control bit being set */
 bool
 brcms_c_txflowcontrol_prio_isset(struct brcms_c_info *wlc,
diff --git a/drivers/staging/brcm80211/brcmsmac/main.h b/drivers/staging/brcm80211/brcmsmac/main.h
index a71c509..99d5c60 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.h
+++ b/drivers/staging/brcm80211/brcmsmac/main.h
@@ -674,9 +674,6 @@ extern void brcms_c_info_init(struct brcms_c_info *wlc, int unit);
 extern void brcms_c_print_txstatus(struct tx_status *txs);
 extern int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo,
 		   uint *blocks);
-extern void brcms_c_write_template_ram(struct brcms_c_info *wlc, int offset,
-				       int len, void *buf);
-extern void brcms_c_pllreq(struct brcms_c_info *wlc, bool set, u32 req_bit);
 
 #if defined(BCMDBG)
 extern void brcms_c_print_rxh(struct d11rxhdr *rxh);
-- 
1.7.4.1



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

* [PATCH 20/26] staging: brcm80211: removed unneeded call to brcms_b_tx_fifo_suspended
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (18 preceding siblings ...)
  2011-10-04 21:19 ` [PATCH 19/26] staging: brcm80211: cleanup of several wrapper functions Arend van Spriel
@ 2011-10-04 21:19 ` Arend van Spriel
  2011-10-04 21:19 ` [PATCH 21/26] staging: brcm80211: removed synchronisation of wlc->machwcap field Arend van Spriel
                   ` (6 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:19 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Alwin Beukers, Arend van Spriel

From: Alwin Beukers <alwin@broadcom.com>

- removed call to brcms_b_tx_fifo_suspended on receipt of TX FIFO suspend/flush
  completion signal.
- removed brcms_b_tx_fifo_suspended function as it is not being used elsewhere.

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/brcmsmac/main.c |   34 -----------------------------
 1 files changed, 0 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index bd38f33..175d85e 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -1075,36 +1075,6 @@ brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal)
 	return morepending;
 }
 
-/* brcms_b_tx_fifo_suspended:
- * Check the MAC's tx suspend status for a tx fifo.
- *
- * When the MAC acknowledges a tx suspend, it indicates that no more
- * packets will be transmitted out the radio. This is independent of
- * DMA channel suspension---the DMA may have finished suspending, or may still
- * be pulling data into a tx fifo, by the time the MAC acks the suspend
- * request.
- */
-static bool brcms_b_tx_fifo_suspended(struct brcms_hardware *wlc_hw,
-				      uint tx_fifo)
-{
-	/* check that a suspend has been requested and is no longer pending */
-
-	/*
-	 * for DMA mode, the suspend request is set in xmtcontrol of the DMA
-	 * engine, and the tx fifo suspend at the lower end of the MAC is
-	 * acknowledged in the chnstatus register.
-	 *
-	 * The tx fifo suspend completion is independent of the DMA suspend
-	 * completion and may be acked before or after the DMA is suspended.
-	 */
-	if (dma_txsuspended(wlc_hw->di[tx_fifo]) &&
-	    (R_REG(&wlc_hw->regs->chnstatus) &
-	     (1 << tx_fifo)) == 0)
-		return true;
-
-	return false;
-}
-
 /* second-level interrupt processing
  *   Return true if another dpc needs to be re-scheduled. false otherwise.
  *   Param 'bounded' indicates if applicable loops should be bounded.
@@ -1161,10 +1131,6 @@ bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded)
 		if (brcms_b_recv(wlc_hw, RX_FIFO, bounded))
 			wlc->macintstatus |= MI_DMAINT;
 
-	/* TX FIFO suspend/flush completion */
-	if (macintstatus & MI_TXSTOP)
-		brcms_b_tx_fifo_suspended(wlc_hw, TX_DATA_FIFO);
-
 	/* noise sample collected */
 	if (macintstatus & MI_BG_NOISE)
 		wlc_phy_noise_sample_intr(wlc_hw->band->pi);
-- 
1.7.4.1



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

* [PATCH 21/26] staging: brcm80211: removed synchronisation of wlc->machwcap field
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (19 preceding siblings ...)
  2011-10-04 21:19 ` [PATCH 20/26] staging: brcm80211: removed unneeded call to brcms_b_tx_fifo_suspended Arend van Spriel
@ 2011-10-04 21:19 ` Arend van Spriel
  2011-10-04 21:19 ` [PATCH 22/26] staging: brcm80211: remove brcms_b_dotxstatus wrapper function Arend van Spriel
                   ` (5 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:19 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Alwin Beukers, Arend van Spriel

From: Alwin Beukers <alwin@broadcom.com>

- removed copying field wlc->machwcap from brcms_hardware to brcms_c_info
  during module attach.
- field wlc->machwcap was written but never read. Therefore it was removed.

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/brcmsmac/main.c |   39 +----------------------------
 drivers/staging/brcm80211/brcmsmac/main.h |    2 -
 2 files changed, 1 insertions(+), 40 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 175d85e..0656d99 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -390,13 +390,6 @@ static int brcms_chspec_bw(u16 chanspec)
 	return BRCMS_10_MHZ;
 }
 
-/* dup state between BMAC(struct brcms_hardware) and HIGH(struct brcms_c_info)
-   driver */
-struct brcms_b_state {
-	u32 machwcap;	/* mac hw capibility */
-	u32 preamble_ovr;	/* preamble override */
-};
-
 struct edcf_acparam {
 	u8 ACI;
 	u8 ECW;
@@ -1168,14 +1161,6 @@ bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded)
 	return wlc->macintstatus != 0;
 }
 
-static int brcms_b_state_get(struct brcms_hardware *wlc_hw,
-		      struct brcms_b_state *state)
-{
-	state->machwcap = wlc_hw->machwcap;
-
-	return 0;
-}
-
 /* set initial host flags value */
 static void
 brcms_c_mhfdef(struct brcms_c_info *wlc, u16 *mhfs, u16 mhf2_init)
@@ -4534,20 +4519,6 @@ void brcms_c_info_init(struct brcms_c_info *wlc, int unit)
 	wlc->mpc_delay_off = wlc->mpc_dlycnt = BRCMS_MPC_MIN_DELAYCNT;
 }
 
-static bool brcms_c_state_bmac_sync(struct brcms_c_info *wlc)
-{
-	struct brcms_b_state state_bmac = {0};
-
-	if (brcms_b_state_get(wlc->hw, &state_bmac) != 0)
-		return false;
-
-	wlc->machwcap = state_bmac.machwcap;
-	brcms_c_protection_upd(wlc, BRCMS_PROT_N_PAM_OVR,
-			   (s8) state_bmac.preamble_ovr);
-
-	return true;
-}
-
 static uint brcms_c_attach_module(struct brcms_c_info *wlc)
 {
 	uint err = 0;
@@ -5151,15 +5122,7 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
 	if (err)
 		goto fail;
 
-	/*
-	 * for some states, due to different info pointer(e,g, wlc, wlc_hw) or
-	 * master/slave split, HIGH driver(both monolithic and HIGH_ONLY) needs
-	 * to sync states FROM BMAC portion driver
-	 */
-	if (!brcms_c_state_bmac_sync(wlc)) {
-		err = 20;
-		goto fail;
-	}
+	brcms_c_protection_upd(wlc, BRCMS_PROT_N_PAM_OVR, OFF);
 
 	pub->phy_11ncapable = BRCMS_PHY_11N_CAP(wlc->band);
 
diff --git a/drivers/staging/brcm80211/brcmsmac/main.h b/drivers/staging/brcm80211/brcmsmac/main.h
index 99d5c60..441292a 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.h
+++ b/drivers/staging/brcm80211/brcmsmac/main.h
@@ -519,8 +519,6 @@ struct brcms_c_info {
 	u16 deviceid;
 	uint ucode_rev;
 
-	u32 machwcap;
-
 	u8 perm_etheraddr[ETH_ALEN];
 
 	bool bandlocked;
-- 
1.7.4.1



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

* [PATCH 22/26] staging: brcm80211: remove brcms_b_dotxstatus wrapper function
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (20 preceding siblings ...)
  2011-10-04 21:19 ` [PATCH 21/26] staging: brcm80211: removed synchronisation of wlc->machwcap field Arend van Spriel
@ 2011-10-04 21:19 ` Arend van Spriel
  2011-10-04 21:19 ` [PATCH 23/26] staging: brcm80211: combined if statements Arend van Spriel
                   ` (4 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:19 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Alwin Beukers, Arend van Spriel

From: Alwin Beukers <alwin@broadcom.com>

- removed brcms_b_dotxstatus
- changed 'fatal' argument of brcms_b_txstatus from INOUT to OUT.

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/brcmsmac/main.c |   22 ++++------------------
 1 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 0656d99..4e2226e 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -995,21 +995,6 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs)
 
 }
 
-static bool
-brcms_b_dotxstatus(struct brcms_hardware *wlc_hw, struct tx_status *txs)
-{
-	/* discard intermediate indications for ucode with one legitimate case:
-	 *   e.g. if "useRTS" is set. ucode did a successful rts/cts exchange,
-	 *   but the subsequent tx of DATA failed. so it will start rts/cts from
-	 *   the beginning (resetting the rts transmission count)
-	 */
-	if (!(txs->status & TX_STATUS_AMPDU)
-	    && (txs->status & TX_STATUS_INTERMEDIATE))
-		return false;
-
-	return brcms_c_dotxstatus(wlc_hw->wlc, txs);
-}
-
 /* process tx completion events in BMAC
  * Return true if more tx status need to be processed. false otherwise.
  */
@@ -1032,6 +1017,7 @@ brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal)
 
 	txs = &txstatus;
 	regs = wlc_hw->regs;
+	*fatal = false;
 	while (!(*fatal)
 	       && (s1 = R_REG(&regs->frmtxstatus)) & TXS_V) {
 
@@ -1041,7 +1027,7 @@ brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal)
 			return morepending;
 		}
 
-			s2 = R_REG(&regs->frmtxstatus2);
+		s2 = R_REG(&regs->frmtxstatus2);
 
 		txs->status = s1 & TXS_STATUS_MASK;
 		txs->frameid = (s1 & TXS_FID_MASK) >> TXS_FID_SHIFT;
@@ -1049,7 +1035,7 @@ brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal)
 		txs->phyerr = (s2 & TXS_PTX_MASK) >> TXS_PTX_SHIFT;
 		txs->lasttxtime = 0;
 
-		*fatal = brcms_b_dotxstatus(wlc_hw, txs);
+		*fatal = brcms_c_dotxstatus(wlc_hw->wlc, txs);
 
 		/* !give others some time to run! */
 		if (++n >= max_tx_num)
@@ -1077,7 +1063,6 @@ bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded)
 	u32 macintstatus;
 	struct brcms_hardware *wlc_hw = wlc->hw;
 	struct d11regs __iomem *regs = wlc_hw->regs;
-	bool fatal = false;
 	struct wiphy *wiphy = wlc->wiphy;
 
 	if (brcms_deviceremoved(wlc)) {
@@ -1098,6 +1083,7 @@ bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded)
 
 	/* tx status */
 	if (macintstatus & MI_TFS) {
+		bool fatal;
 		if (brcms_b_txstatus(wlc->hw, bounded, &fatal))
 			wlc->macintstatus |= MI_TFS;
 		if (fatal) {
-- 
1.7.4.1



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

* [PATCH 23/26] staging: brcm80211: combined if statements
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (21 preceding siblings ...)
  2011-10-04 21:19 ` [PATCH 22/26] staging: brcm80211: remove brcms_b_dotxstatus wrapper function Arend van Spriel
@ 2011-10-04 21:19 ` Arend van Spriel
  2011-10-04 21:19 ` [PATCH 24/26] staging: brcm80211: remove N mode validation function Arend van Spriel
                   ` (3 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:19 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Alwin Beukers, Arend van Spriel

From: Alwin Beukers <alwin@broadcom.com>

Combined if statements in brcms_c_edcf_setparams and brcms_c_wme_setparams functions.

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/brcmsmac/main.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 4e2226e..30c5573 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -4186,12 +4186,10 @@ void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci,
 					  *shm_entry++);
 	}
 
-	if (suspend)
+	if (suspend) {
 		brcms_c_suspend_mac_and_wait(wlc);
-
-	if (suspend)
 		brcms_c_enable_mac(wlc);
-
+	}
 }
 
 void brcms_c_edcf_setparams(struct brcms_c_info *wlc, bool suspend)
@@ -4223,12 +4221,10 @@ void brcms_c_edcf_setparams(struct brcms_c_info *wlc, bool suspend)
 		brcms_c_wme_setparams(wlc, aci, &txq_pars, suspend);
 	}
 
-	if (suspend)
+	if (suspend) {
 		brcms_c_suspend_mac_and_wait(wlc);
-
-	if (suspend)
 		brcms_c_enable_mac(wlc);
-
+	}
 }
 
 /* maintain LED behavior in down state */
-- 
1.7.4.1



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

* [PATCH 24/26] staging: brcm80211: remove N mode validation function
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (22 preceding siblings ...)
  2011-10-04 21:19 ` [PATCH 23/26] staging: brcm80211: combined if statements Arend van Spriel
@ 2011-10-04 21:19 ` Arend van Spriel
  2011-10-04 21:19 ` [PATCH 25/26] staging: brcm80211: softmac: added event tracing Arend van Spriel
                   ` (2 subsequent siblings)
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:19 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Alwin Beukers, Arend van Spriel

From: Alwin Beukers <alwin@broadcom.com>

Removed the brcms_c_nmode_validate function as it only checks N-mode
capability, which should always be true.

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/brcmsmac/main.c |   29 -----------------------------
 1 files changed, 0 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 30c5573..9fa8485 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -5912,40 +5912,11 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)
 	return ret;
 }
 
-static int brcms_c_nmode_validate(struct brcms_c_info *wlc, s32 nmode)
-{
-	int err = 0;
-
-	switch (nmode) {
-
-	case OFF:
-		break;
-
-	case AUTO:
-	case WL_11N_2x2:
-	case WL_11N_3x3:
-		if (!(BRCMS_PHY_11N_CAP(wlc->band)))
-			err = -EINVAL;
-		break;
-
-	default:
-		err = -EINVAL;
-		break;
-	}
-
-	return err;
-}
-
 int brcms_c_set_nmode(struct brcms_c_info *wlc)
 {
 	uint i;
-	int err;
 	s32 nmode = AUTO;
 
-	err = brcms_c_nmode_validate(wlc, nmode);
-	if (err)
-		return err;
-
 	if (wlc->stf->txstreams == WL_11N_3x3)
 		nmode = WL_11N_3x3;
 	else
-- 
1.7.4.1



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

* [PATCH 25/26] staging: brcm80211: softmac: added event tracing
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (23 preceding siblings ...)
  2011-10-04 21:19 ` [PATCH 24/26] staging: brcm80211: remove N mode validation function Arend van Spriel
@ 2011-10-04 21:19 ` Arend van Spriel
  2011-10-04 21:19 ` [PATCH 26/26] staging: brcm80211: smac: fix for 64 bit systems Arend van Spriel
  2011-10-05 20:40 ` [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Greg KH
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:19 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Roland Vossen, Arend van Spriel

From: Roland Vossen <rvossen@broadcom.com>

Dpc and timer events can now be traced. Combined with Mac80211
driver callback tracing, all entry points into the driver can now
be traced.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Alwin Beukers <alwin@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/Makefile        |    3 +-
 .../brcm80211/brcmsmac/brcms_trace_events.c        |   23 +++++
 .../brcm80211/brcmsmac/brcms_trace_events.h        |   92 ++++++++++++++++++++
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c   |   10 +-
 drivers/staging/brcm80211/brcmsmac/mac80211_if.h   |    2 +
 5 files changed, 124 insertions(+), 6 deletions(-)
 create mode 100644 drivers/staging/brcm80211/brcmsmac/brcms_trace_events.c
 create mode 100644 drivers/staging/brcm80211/brcmsmac/brcms_trace_events.h

diff --git a/drivers/staging/brcm80211/brcmsmac/Makefile b/drivers/staging/brcm80211/brcmsmac/Makefile
index e44859d..a8a152b 100644
--- a/drivers/staging/brcm80211/brcmsmac/Makefile
+++ b/drivers/staging/brcm80211/brcmsmac/Makefile
@@ -42,7 +42,8 @@ BRCMSMAC_OFILES := \
 	otp.o \
 	srom.o \
 	dma.o \
-	nicpci.o
+	nicpci.o \
+	brcms_trace_events.o
 
 MODULEPFX := brcmsmac
 
diff --git a/drivers/staging/brcm80211/brcmsmac/brcms_trace_events.c b/drivers/staging/brcm80211/brcmsmac/brcms_trace_events.c
new file mode 100644
index 0000000..52fc9ee
--- /dev/null
+++ b/drivers/staging/brcm80211/brcmsmac/brcms_trace_events.c
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2011 Broadcom Corporation
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <linux/module.h> /* bug in tracepoint.h, it should include this */
+
+#ifndef __CHECKER__
+#include "mac80211_if.h"
+#define CREATE_TRACE_POINTS
+#include "brcms_trace_events.h"
+#endif
diff --git a/drivers/staging/brcm80211/brcmsmac/brcms_trace_events.h b/drivers/staging/brcm80211/brcmsmac/brcms_trace_events.h
new file mode 100644
index 0000000..27dd73e
--- /dev/null
+++ b/drivers/staging/brcm80211/brcmsmac/brcms_trace_events.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2011 Broadcom Corporation
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM brcmsmac
+
+#if !defined(__TRACE_BRCMSMAC_H) || defined(TRACE_HEADER_MULTI_READ)
+
+#define __TRACE_BRCMSMAC_H
+
+#include <linux/tracepoint.h>
+#include "mac80211_if.h"
+
+#ifndef CONFIG_BRCMDBG
+#undef TRACE_EVENT
+#define TRACE_EVENT(name, proto, ...) \
+static inline void trace_ ## name(proto) {}
+#endif
+
+/*
+ * We define a tracepoint, its arguments, its printk format and its
+ * 'fast binary record' layout.
+ */
+TRACE_EVENT(brcms_timer,
+	/* TPPROTO is the prototype of the function called by this tracepoint */
+	TP_PROTO(struct brcms_timer *t),
+	/*
+	 * TPARGS(firstarg, p) are the parameters names, same as found in the
+	 * prototype.
+	 */
+	TP_ARGS(t),
+	/*
+	 * Fast binary tracing: define the trace record via TP_STRUCT__entry().
+	 * You can think about it like a regular C structure local variable
+	 * definition.
+	 */
+	TP_STRUCT__entry(
+		__field(uint, ms)
+		__field(uint, set)
+		__field(uint, periodic)
+	),
+	TP_fast_assign(
+		__entry->ms = t->ms;
+		__entry->set = t->set;
+		__entry->periodic = t->periodic;
+	),
+	TP_printk(
+		"ms=%u set=%u periodic=%u",
+		__entry->ms, __entry->set, __entry->periodic
+	)
+);
+
+TRACE_EVENT(brcms_dpc,
+	TP_PROTO(unsigned long data),
+	TP_ARGS(data),
+	TP_STRUCT__entry(
+		__field(unsigned long, data)
+	),
+	TP_fast_assign(
+		__entry->data = data;
+	),
+	TP_printk(
+		"data=%p",
+		(void *)__entry->data
+	)
+);
+
+#endif /* __TRACE_BRCMSMAC_H */
+
+#ifdef CONFIG_BRCMDBG
+
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+#undef TRACE_INCLUDE_FILE
+#define TRACE_INCLUDE_FILE brcms_trace_events
+
+#include <trace/define_trace.h>
+
+#endif /* CONFIG_BRCMDBG */
diff --git a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
index c5afeaf..fa00ab3 100644
--- a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
@@ -750,7 +750,7 @@ static int brcms_set_hint(struct brcms_info *wl, char *abbrev)
 	return regulatory_hint(wl->pub->ieee_hw->wiphy, abbrev);
 }
 
-static void brcms_dpc(unsigned long data)
+void brcms_dpc(unsigned long data)
 {
 	struct brcms_info *wl;
 
@@ -1430,7 +1430,7 @@ void brcms_down(struct brcms_info *wl)
 /*
 * precondition: perimeter lock is not acquired
  */
-static void _brcms_timer(struct brcms_timer *t)
+void brcms_timer(struct brcms_timer *t)
 {
 	LOCK(t->wl);
 
@@ -1454,9 +1454,9 @@ static void _brcms_timer(struct brcms_timer *t)
 /*
  * is called by the kernel from software irq context
  */
-static void brcms_timer(unsigned long data)
+static void _brcms_timer(unsigned long data)
 {
-	_brcms_timer((struct brcms_timer *) data);
+	brcms_timer((struct brcms_timer *) data);
 }
 
 /*
@@ -1477,7 +1477,7 @@ struct brcms_timer *brcms_init_timer(struct brcms_info *wl,
 
 	init_timer(&t->timer);
 	t->timer.data = (unsigned long) t;
-	t->timer.function = brcms_timer;
+	t->timer.function = _brcms_timer;
 	t->wl = wl;
 	t->fn = fn;
 	t->arg = arg;
diff --git a/drivers/staging/brcm80211/brcmsmac/mac80211_if.h b/drivers/staging/brcm80211/brcmsmac/mac80211_if.h
index 2bdcd4c..92256d0 100644
--- a/drivers/staging/brcm80211/brcmsmac/mac80211_if.h
+++ b/drivers/staging/brcm80211/brcmsmac/mac80211_if.h
@@ -101,5 +101,7 @@ extern void brcms_add_timer(struct brcms_info *wl, struct brcms_timer *timer,
 			    uint ms, int periodic);
 extern bool brcms_del_timer(struct brcms_info *wl, struct brcms_timer *timer);
 extern void brcms_msleep(struct brcms_info *wl, uint ms);
+extern void brcms_dpc(unsigned long data);
+extern void brcms_timer(struct brcms_timer *t);
 
 #endif				/* _BRCM_MAC80211_IF_H_ */
-- 
1.7.4.1



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

* [PATCH 26/26] staging: brcm80211: smac: fix for 64 bit systems
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (24 preceding siblings ...)
  2011-10-04 21:19 ` [PATCH 25/26] staging: brcm80211: softmac: added event tracing Arend van Spriel
@ 2011-10-04 21:19 ` Arend van Spriel
  2011-10-05 20:40 ` [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Greg KH
  26 siblings, 0 replies; 28+ messages in thread
From: Arend van Spriel @ 2011-10-04 21:19 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-wireless, Roland Vossen, Arend van Spriel

From: Roland Vossen <rvossen@broadcom.com>

A bug was introduced by the following commit (Sep 13):

    staging: brcm80211: use endian annotated structures in brcmsmac

Result was that 64 bits systems will not be able to acquire an IP address.
Also the rmmod crashed. This has been fixed and retested on a Sparc64.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Alwin Beukers <alwin@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c  |    4 ++--
 drivers/staging/brcm80211/brcmsmac/ucode_loader.h |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
index fa00ab3..ac78052 100644
--- a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
@@ -1606,7 +1606,7 @@ fail:
  * Precondition: Since this function is called in brcms_pci_probe() context,
  * no locking is required.
  */
-int brcms_ucode_init_uint(struct brcms_info *wl, u32 *data, u32 idx)
+int brcms_ucode_init_uint(struct brcms_info *wl, size_t *n_bytes, u32 idx)
 {
 	int i, entry;
 	const u8 *pdata;
@@ -1623,7 +1623,7 @@ int brcms_ucode_init_uint(struct brcms_info *wl, u32 *data, u32 idx)
 						  "ERROR: fw hdr len\n");
 					return -ENOMSG;
 				}
-				*data = le32_to_cpu(*((__le32 *) pdata));
+				*n_bytes = le32_to_cpu(*((__le32 *) pdata));
 				return 0;
 			}
 		}
diff --git a/drivers/staging/brcm80211/brcmsmac/ucode_loader.h b/drivers/staging/brcm80211/brcmsmac/ucode_loader.h
index 49d5b7e..18750a8 100644
--- a/drivers/staging/brcm80211/brcmsmac/ucode_loader.h
+++ b/drivers/staging/brcm80211/brcmsmac/ucode_loader.h
@@ -50,8 +50,8 @@ extern void brcms_ucode_data_free(struct brcms_ucode *ucode);
 
 extern int brcms_ucode_init_buf(struct brcms_info *wl, void **pbuf,
 				unsigned int idx);
-extern int brcms_ucode_init_uint(struct brcms_info *wl, unsigned *data,
-			      unsigned int idx);
+extern int brcms_ucode_init_uint(struct brcms_info *wl, size_t *n_bytes,
+				 unsigned int idx);
 extern void brcms_ucode_free_buf(void *);
 extern int  brcms_check_firmwares(struct brcms_info *wl);
 
-- 
1.7.4.1



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

* Re: [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac
  2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
                   ` (25 preceding siblings ...)
  2011-10-04 21:19 ` [PATCH 26/26] staging: brcm80211: smac: fix for 64 bit systems Arend van Spriel
@ 2011-10-05 20:40 ` Greg KH
  26 siblings, 0 replies; 28+ messages in thread
From: Greg KH @ 2011-10-05 20:40 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: gregkh, devel, linux-wireless

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	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2011-10-05 20:48 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-04 21:18 [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Arend van Spriel
2011-10-04 21:18 ` [PATCH 01/26] staging: brcm80211: cleaned up struct brcms_bss_cfg Arend van Spriel
2011-10-04 21:18 ` [PATCH 02/26] staging: brcm80211: remove setting ssn to zero upon AMPDU_TX_START Arend van Spriel
2011-10-04 21:18 ` [PATCH 03/26] staging: brcm80211: remove filtering of received frames Arend van Spriel
2011-10-04 21:18 ` [PATCH 04/26] staging: brcm80211: remove brcmu_bprintf and related functions Arend van Spriel
2011-10-04 21:18 ` [PATCH 05/26] staging: brcm80211: replace brcmu_bitcount with hweight8 Arend van Spriel
2011-10-04 21:18 ` [PATCH 06/26] staging: brcm80211: fullmac: fixed double #include Arend van Spriel
2011-10-04 21:18 ` [PATCH 07/26] staging: brcm80211: clean up rtnl_lock in fullmac Arend van Spriel
2011-10-04 21:18 ` [PATCH 08/26] staging: brcm80211: remove fullmac module_param for intr/poll mode Arend van Spriel
2011-10-04 21:18 ` [PATCH 09/26] staging: brcm80211: stop using assigned thread priority in fullmac Arend van Spriel
2011-10-04 21:18 ` [PATCH 10/26] staging: brcm80211: fixed checkpatch warnings Arend van Spriel
2011-10-04 21:18 ` [PATCH 11/26] staging: brcm80211: removed accessor functions for band type and etheraddress Arend van Spriel
2011-10-04 21:18 ` [PATCH 12/26] staging: brcm80211: fixed function returns Arend van Spriel
2011-10-04 21:18 ` [PATCH 13/26] staging: brcm80211: made NULL ethernet address const Arend van Spriel
2011-10-04 21:19 ` [PATCH 14/26] staging: brcm80211: removed empty brcms_c_reset_bmac_done callback function Arend van Spriel
2011-10-04 21:19 ` [PATCH 15/26] staging: brcm80211: decreased indentation level of brcms_c_wme_setparams function Arend van Spriel
2011-10-04 21:19 ` [PATCH 16/26] staging: brcm80211: removed redundant code from brcms_c_set_gmode Arend van Spriel
2011-10-04 21:19 ` [PATCH 17/26] staging: brcm80211: cleanup of shared memory related wrapper functions Arend van Spriel
2011-10-04 21:19 ` [PATCH 18/26] staging: brcm80211: cleanup of transmit buffer size related wrapper function Arend van Spriel
2011-10-04 21:19 ` [PATCH 19/26] staging: brcm80211: cleanup of several wrapper functions Arend van Spriel
2011-10-04 21:19 ` [PATCH 20/26] staging: brcm80211: removed unneeded call to brcms_b_tx_fifo_suspended Arend van Spriel
2011-10-04 21:19 ` [PATCH 21/26] staging: brcm80211: removed synchronisation of wlc->machwcap field Arend van Spriel
2011-10-04 21:19 ` [PATCH 22/26] staging: brcm80211: remove brcms_b_dotxstatus wrapper function Arend van Spriel
2011-10-04 21:19 ` [PATCH 23/26] staging: brcm80211: combined if statements Arend van Spriel
2011-10-04 21:19 ` [PATCH 24/26] staging: brcm80211: remove N mode validation function Arend van Spriel
2011-10-04 21:19 ` [PATCH 25/26] staging: brcm80211: softmac: added event tracing Arend van Spriel
2011-10-04 21:19 ` [PATCH 26/26] staging: brcm80211: smac: fix for 64 bit systems Arend van Spriel
2011-10-05 20:40 ` [PATCH 00/26] various cleanup changes for brcmfmac and brcmsmac Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).