Skip to contentSkip to conversation

staging: brcm80211: code clean up

PATCH In review Franky Lin 4 participants 24 messages Oct 2, 2011 – Oct 10, 2011 Staging

lore
Share & tools
lore
author
#1 lore raw

PATCH 1/20 staging: brmc80211: removed some unused fmac variable declarations

In reply to Franky Lin

From: Roland Vossen <[email protected]>

---
 drivers/staging/brcm80211/brcmfmac/dhd.h |   29 -----------------------------
 1 files changed, 0 insertions(+), 29 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +0 -29
index 514f779..be6c620 100644
@@ -683,36 +683,7 @@ struct bcmevent_name {
 	const char *name;
 };
 
-/* Override to force tx queueing all the time */
-extern uint brcmf_force_tx_queueing;
-
 extern const struct bcmevent_name bcmevent_names[];
-extern const int bcmevent_names_size;
-
-
-static inline void MUTEX_LOCK_INIT(struct brcmf_pub *drvr)
-{
-}
-
-static inline void MUTEX_LOCK(struct brcmf_pub *drvr)
-{
-}
-
-static inline void MUTEX_UNLOCK(struct brcmf_pub *drvr)
-{
-}
-
-static inline void MUTEX_LOCK_WL_SCAN_SET_INIT(void)
-{
-}
-
-static inline void MUTEX_LOCK_WL_SCAN_SET(void)
-{
-}
-
-static inline void MUTEX_UNLOCK_WL_SCAN_SET(void)
-{
-}
 
 /* Indication from bus module regarding presence/insertion of dongle.
  * Return struct brcmf_pub pointer, used as handle to OS module in later calls.
Signature · 1 line
1.7.1
author
#2 lore raw

PATCH 2/20 staging: brcm80211: removed unused smac tx ampdu packet queue

In reply to Franky Lin

From: Roland Vossen <[email protected]>

A remnant of the past.

---
 drivers/staging/brcm80211/brcmsmac/main.c |    2 --
 drivers/staging/brcm80211/brcmsmac/scb.h  |    1 -
 2 files changed, 0 insertions(+), 3 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +0 -2
index 4f79a42..e6bd3cf 100644
@@ -3358,8 +3358,6 @@ void brcms_c_init_scb(struct scb *scb)
 
 	scb->seqctl_nonqos = 0xFFFF;
 	scb->magic = SCB_MAGIC;
-	brcmu_pktq_init(&scb->scb_ampdu.txq, AMPDU_MAX_SCB_TID,
-		  AMPDU_MAX_SCB_TID * PKTQ_LEN_DEFAULT);
 }
 
 /* d11 core init
drivers/staging/brcm80211/brcmsmac/scb.h +0 -1
index 122d3c3..51c79c7 100644
@@ -51,7 +51,6 @@ struct scb_ampdu {
 	u8 release;		/* # of mpdus released at a time */
 	u16 min_len;		/* min mpdu len to support the density */
 	u32 max_rx_ampdu_bytes;	/* max ampdu rcv length; 8k, 16k, 32k, 64k */
-	struct pktq txq;	/* sdu transmit queue pending aggregation */
 
 	/*
 	 * This could easily be a ini[] pointer and we keep this info in wl
Signature · 1 line
1.7.1
author
#3 lore raw

PATCH 3/20 staging: brcm80211: cleaning up tx rate control code in softmac

In reply to Franky Lin

From: Roland Vossen <[email protected]>

Code cleanup. Code was unnecessarily complex.

---
 drivers/staging/brcm80211/brcmsmac/main.c |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +7 -12
index e6bd3cf..10f1de2 100644
@@ -7066,7 +7066,6 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
 	struct ieee80211_rts *rts = NULL;
 	bool qos;
 	uint ac;
-	u32 rate_val[2];
 	bool hwtkmic = false;
 	u16 mimo_ctlchbw = PHY_TXC1_BW_20MHZ;
 #define ANTCFG_NONE 0xFF
@@ -7077,7 +7076,7 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
 	struct ieee80211_tx_rate *txrate[2];
 	int k;
 	struct ieee80211_tx_info *tx_info;
-	bool is_mcs[2];
+	bool is_mcs;
 	u16 mimo_txbw;
 	u8 mimo_preamble_type;
 
@@ -7137,13 +7136,12 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
 		txrate[1] = txrate[0];
 
 	for (k = 0; k < hw->max_rates; k++) {
-		is_mcs[k] =
-		    txrate[k]->flags & IEEE80211_TX_RC_MCS ? true : false;
-		if (!is_mcs[k]) {
+		is_mcs = txrate[k]->flags & IEEE80211_TX_RC_MCS ? true : false;
+		if (!is_mcs) {
 			if ((txrate[k]->idx >= 0)
 			    && (txrate[k]->idx <
 				hw->wiphy->bands[tx_info->band]->n_bitrates)) {
-				rate_val[k] =
+				rspec[k] =
 				    hw->wiphy->bands[tx_info->band]->
 				    bitrates[txrate[k]->idx].hw_value;
 				short_preamble[k] =
@@ -7151,10 +7149,11 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
 				    flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE ?
 				    true : false;
 			} else {
-				rate_val[k] = BRCM_RATE_1M;
+				rspec[k] = BRCM_RATE_1M;
 			}
 		} else {
-			rate_val[k] = txrate[k]->idx;
+			rspec[k] = mac80211_wlc_set_nrate(wlc, wlc->band,
+					NRATE_MCS_INUSE | txrate[k]->idx);
 		}
 
 		/*
@@ -7169,10 +7168,6 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
 		    txrate[k]->
 		    flags & IEEE80211_TX_RC_USE_CTS_PROTECT ? true : false;
 
-		if (is_mcs[k])
-			rate_val[k] |= NRATE_MCS_INUSE;
-
-		rspec[k] = mac80211_wlc_set_nrate(wlc, wlc->band, rate_val[k]);
 
 		/*
 		 * (1) RATE:
Signature · 1 line
1.7.1
author
#8 lore raw

PATCH 6/20 staging: brcm80211: added __iomem qualifier to softmac main.c

In reply to Franky Lin

From: Roland Vossen <[email protected]>

Code cleanup. Makes it clear when an address is mapped IO space.

---
 drivers/staging/brcm80211/brcmsmac/main.c |   81 ++++++++++++++---------------
 drivers/staging/brcm80211/brcmsmac/main.h |    4 +-
 2 files changed, 42 insertions(+), 43 deletions(-)
drivers/staging/brcm80211/brcmsmac/main.c +40 -41
index ac5a52a..e4dd2d4 100644
@@ -638,7 +638,7 @@ brcms_c_attach_malloc(uint unit, uint *err, uint devid)
 static void brcms_b_update_slot_timing(struct brcms_hardware *wlc_hw,
 					bool shortslot)
 {
-	struct d11regs *regs;
+	struct d11regs __iomem *regs;
 
 	regs = wlc_hw->regs;
 
@@ -657,23 +657,23 @@ static void brcms_c_write_inits(struct brcms_hardware *wlc_hw,
 				const struct d11init *inits)
 {
 	int i;
-	u8 *base;
-	u8 *addr;
+	u8 __iomem *base;
+	u8 __iomem *addr;
 	u16 size;
 	u32 value;
 
 	BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit);
 
-	base = (u8 *)wlc_hw->regs;
+	base = (u8 __iomem *)wlc_hw->regs;
 
 	for (i = 0; inits[i].addr != cpu_to_le16(0xffff); i++) {
 		size = le16_to_cpu(inits[i].size);
 		addr = base + le16_to_cpu(inits[i].addr);
 		value = le32_to_cpu(inits[i].value);
 		if (size == 2)
-			W_REG((u16 *)addr, value);
+			W_REG((u16 __iomem *)addr, value);
 		else if (size == 4)
-			W_REG((u32 *)addr, value);
+			W_REG((u32 __iomem *)addr, value);
 		else
 			break;
 	}
@@ -1025,7 +1025,7 @@ brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal)
 {
 	bool morepending = false;
 	struct brcms_c_info *wlc = wlc_hw->wlc;
-	struct d11regs *regs;
+	struct d11regs __iomem *regs;
 	struct tx_status txstatus, *txs;
 	u32 s1, s2;
 	uint n = 0;
@@ -1113,7 +1113,7 @@ bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded)
 {
 	u32 macintstatus;
 	struct brcms_hardware *wlc_hw = wlc->hw;
-	struct d11regs *regs = wlc_hw->regs;
+	struct d11regs __iomem *regs = wlc_hw->regs;
 	bool fatal = false;
 	struct wiphy *wiphy = wlc->wiphy;
 
@@ -1230,7 +1230,7 @@ brcms_c_mhfdef(struct brcms_c_info *wlc, u16 *mhfs, u16 mhf2_init)
 	}
 }
 
-static struct dma64regs *
+static struct dma64regs __iomem *
 dmareg(struct brcms_hardware *hw, uint direction, uint fifonum)
 {
 	if (direction == DMA_TX)
@@ -1645,7 +1645,7 @@ static void
 brcms_b_set_addrmatch(struct brcms_hardware *wlc_hw, int match_reg_offset,
 		       const u8 *addr)
 {
-	struct d11regs *regs;
+	struct d11regs __iomem *regs;
 	u16 mac_l;
 	u16 mac_m;
 	u16 mac_h;
@@ -1670,7 +1670,7 @@ void
 brcms_b_write_template_ram(struct brcms_hardware *wlc_hw, int offset, int len,
 			    void *buf)
 {
-	struct d11regs *regs;
+	struct d11regs __iomem *regs;
 	u32 word;
 	__le32 word_le;
 	__be32 word_be;
@@ -1745,7 +1745,7 @@ static void
 brcms_c_write_hw_bcntemplate0(struct brcms_hardware *wlc_hw, u16 bcn[],
 			      int len)
 {
-	struct d11regs *regs = wlc_hw->regs;
+	struct d11regs __iomem *regs = wlc_hw->regs;
 
 	brcms_b_write_template_ram(wlc_hw, T_BCN0_TPL_BASE, (len + 3) & ~3,
 				    bcn);
@@ -1759,7 +1759,7 @@ static void
 brcms_c_write_hw_bcntemplate1(struct brcms_hardware *wlc_hw, u16 bcn[],
 			      int len)
 {
-	struct d11regs *regs = wlc_hw->regs;
+	struct d11regs __iomem *regs = wlc_hw->regs;
 
 	brcms_b_write_template_ram(wlc_hw, T_BCN1_TPL_BASE, (len + 3) & ~3,
 				    bcn);
@@ -2168,7 +2168,7 @@ static bool brcms_b_radio_read_hwdisabled(struct brcms_hardware *wlc_hw)
 		 */
 		if ((wlc_hw->sih->chip == BCM43224_CHIP_ID) ||
 		    (wlc_hw->sih->chip == BCM43225_CHIP_ID))
-			wlc_hw->regs = (struct d11regs *)
+			wlc_hw->regs = (struct d11regs __iomem *)
 					ai_setcore(wlc_hw->sih, D11_CORE_ID, 0);
 		ai_core_reset(wlc_hw->sih, flags, resetbits);
 		brcms_c_mctrl_reset(wlc_hw);
@@ -2202,7 +2202,7 @@ static bool wlc_dma_rxreset(struct brcms_hardware *wlc_hw, uint fifo)
  */
 void brcms_b_corereset(struct brcms_hardware *wlc_hw, u32 flags)
 {
-	struct d11regs *regs;
+	struct d11regs __iomem *regs;
 	uint i;
 	bool fastclk;
 	u32 resetbits = 0;
@@ -2286,7 +2286,7 @@ void brcms_b_corereset(struct brcms_hardware *wlc_hw, u32 flags)
  */
 static void brcms_b_corerev_fifofixup(struct brcms_hardware *wlc_hw)
 {
-	struct d11regs *regs = wlc_hw->regs;
+	struct d11regs __iomem *regs = wlc_hw->regs;
 	u16 fifo_nu;
 	u16 txfifo_startblk = TXFIFO_START_BLK, txfifo_endblk;
 	u16 txfifo_def, txfifo_def1;
@@ -2346,8 +2346,7 @@ static void brcms_b_corerev_fifofixup(struct brcms_hardware *wlc_hw)
 
 void brcms_b_switch_macfreq(struct brcms_hardware *wlc_hw, u8 spurmode)
 {
-	struct d11regs *regs;
-	regs = wlc_hw->regs;
+	struct d11regs __iomem *regs = wlc_hw->regs;
 
 	if ((wlc_hw->sih->chip == BCM43224_CHIP_ID) ||
 	    (wlc_hw->sih->chip == BCM43225_CHIP_ID)) {
@@ -2376,7 +2375,7 @@ void brcms_b_switch_macfreq(struct brcms_hardware *wlc_hw, u8 spurmode)
 static void brcms_c_gpio_init(struct brcms_c_info *wlc)
 {
 	struct brcms_hardware *wlc_hw = wlc->hw;
-	struct d11regs *regs;
+	struct d11regs __iomem *regs;
 	u32 gc, gm;
 
 	regs = wlc_hw->regs;
@@ -2441,7 +2440,7 @@ static void brcms_c_gpio_init(struct brcms_c_info *wlc)
 static void brcms_ucode_write(struct brcms_hardware *wlc_hw,
 			      const __le32 ucode[], const size_t nbytes)
 {
-	struct d11regs *regs = wlc_hw->regs;
+	struct d11regs __iomem *regs = wlc_hw->regs;
 	uint i;
 	uint count;
 
@@ -2518,7 +2517,7 @@ static void brcms_b_fifoerrors(struct brcms_hardware *wlc_hw)
 	bool fatal = false;
 	uint unit;
 	uint intstatus, idx;
-	struct d11regs *regs = wlc_hw->regs;
+	struct d11regs __iomem *regs = wlc_hw->regs;
 	struct wiphy *wiphy = wlc_hw->wlc->wiphy;
 
 	unit = wlc_hw->unit;
@@ -2734,7 +2733,7 @@ static void brcms_b_mute(struct brcms_hardware *wlc_hw, bool on, u32 flags)
 static inline u32 wlc_intstatus(struct brcms_c_info *wlc, bool in_isr)
 {
 	struct brcms_hardware *wlc_hw = wlc->hw;
-	struct d11regs *regs = wlc_hw->regs;
+	struct d11regs __iomem *regs = wlc_hw->regs;
 	u32 macintstatus;
 
 	/* macintstatus includes a DMA interrupt summary bit */
@@ -2843,7 +2842,7 @@ bool brcms_c_isr(struct brcms_c_info *wlc, bool *wantdpc)
 void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc)
 {
 	struct brcms_hardware *wlc_hw = wlc->hw;
-	struct d11regs *regs = wlc_hw->regs;
+	struct d11regs __iomem *regs = wlc_hw->regs;
 	u32 mc, mi;
 	struct wiphy *wiphy = wlc->wiphy;
 
@@ -2912,7 +2911,7 @@ void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc)
 void brcms_c_enable_mac(struct brcms_c_info *wlc)
 {
 	struct brcms_hardware *wlc_hw = wlc->hw;
-	struct d11regs *regs = wlc_hw->regs;
+	struct d11regs __iomem *regs = wlc_hw->regs;
 	u32 mc, mi;
 
 	BCMMSG(wlc->wiphy, "wl%d: bandunit %d\n", wlc_hw->unit,
@@ -2955,7 +2954,7 @@ void brcms_b_band_stf_ss_set(struct brcms_hardware *wlc_hw, u8 stf_mode)
 
 static bool brcms_b_validate_chip_access(struct brcms_hardware *wlc_hw)
 {
-	struct d11regs *regs;
+	struct d11regs __iomem *regs;
 	u32 w, val;
 	struct wiphy *wiphy = wlc_hw->wlc->wiphy;
 
@@ -3020,7 +3019,7 @@ static bool brcms_b_validate_chip_access(struct brcms_hardware *wlc_hw)
 
 void brcms_b_core_phypll_ctl(struct brcms_hardware *wlc_hw, bool on)
 {
-	struct d11regs *regs;
+	struct d11regs __iomem *regs;
 	u32 tmp;
 
 	BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit);
@@ -3118,9 +3117,9 @@ static void brcms_c_flushqueues(struct brcms_c_info *wlc)
 static u16
 brcms_b_read_objmem(struct brcms_hardware *wlc_hw, uint offset, u32 sel)
 {
-	struct d11regs *regs = wlc_hw->regs;
-	u16 *objdata_lo = (u16 *)&regs->objdata;
-	u16 *objdata_hi = objdata_lo + 1;
+	struct d11regs __iomem *regs = wlc_hw->regs;
+	u16 __iomem *objdata_lo = (u16 __iomem *)&regs->objdata;
+	u16 __iomem *objdata_hi = objdata_lo + 1;
 	u16 v;
 
 	W_REG(&regs->objaddr, sel | (offset >> 2));
@@ -3137,9 +3136,9 @@ static void
 brcms_b_write_objmem(struct brcms_hardware *wlc_hw, uint offset, u16 v,
 		     u32 sel)
 {
-	struct d11regs *regs = wlc_hw->regs;
-	u16 *objdata_lo = (u16 *)&regs->objdata;
-	u16 *objdata_hi = objdata_lo + 1;
+	struct d11regs __iomem *regs = wlc_hw->regs;
+	u16 __iomem *objdata_lo = (u16 __iomem *)&regs->objdata;
+	u16 __iomem *objdata_hi = objdata_lo + 1;
 
 	W_REG(&regs->objaddr, sel | (offset >> 2));
 	(void)R_REG(&regs->objaddr);
@@ -3371,7 +3370,7 @@ void brcms_c_init_scb(struct scb *scb)
 static void brcms_b_coreinit(struct brcms_c_info *wlc)
 {
 	struct brcms_hardware *wlc_hw = wlc->hw;
-	struct d11regs *regs;
+	struct d11regs __iomem *regs;
 	u32 sflags;
 	uint bcnint_us;
 	uint i = 0;
@@ -3769,7 +3768,7 @@ static void brcms_c_txflowcontrol_reset(struct brcms_c_info *wlc)
 
 void brcms_c_init(struct brcms_c_info *wlc)
 {
-	struct d11regs *regs;
+	struct d11regs __iomem *regs;
 	u16 chanspec;
 	bool mute = false;
 
@@ -4682,7 +4681,7 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,
 			  struct pci_dev *btparam)
 {
 	struct brcms_hardware *wlc_hw;
-	struct d11regs *regs;
+	struct d11regs __iomem *regs;
 	char *macaddr = NULL;
 	char *vars;
 	uint err = 0;
@@ -4755,8 +4754,8 @@ static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,
 	wlc_hw->deviceid = device;
 
 	/* set bar0 window to point at D11 core */
-	wlc_hw->regs = (struct d11regs *) ai_setcore(wlc_hw->sih, D11_CORE_ID,
-						     0);
+	wlc_hw->regs = (struct d11regs __iomem *)
+				ai_setcore(wlc_hw->sih, D11_CORE_ID, 0);
 	wlc_hw->corerev = ai_corerev(wlc_hw->sih);
 
 	regs = wlc_hw->regs;
@@ -5641,7 +5640,7 @@ static void brcms_b_hw_up(struct brcms_hardware *wlc_hw)
 	 */
 	if ((wlc_hw->sih->chip == BCM43224_CHIP_ID) ||
 	    (wlc_hw->sih->chip == BCM43225_CHIP_ID))
-		wlc_hw->regs = (struct d11regs *)
+		wlc_hw->regs = (struct d11regs __iomem *)
 				ai_setcore(wlc_hw->sih, D11_CORE_ID, 0);
 
 	/*
@@ -8084,7 +8083,7 @@ static void
 brcms_b_read_tsf(struct brcms_hardware *wlc_hw, u32 *tsf_l_ptr,
 		  u32 *tsf_h_ptr)
 {
-	struct d11regs *regs = wlc_hw->regs;
+	struct d11regs __iomem *regs = wlc_hw->regs;
 
 	/* read the tsf timer low, then high to get an atomic read */
 	*tsf_l_ptr = R_REG(&regs->tsf_timerlow);
@@ -8810,7 +8809,7 @@ static void
 brcms_b_write_hw_bcntemplates(struct brcms_hardware *wlc_hw, u16 bcn[],
 			      int len, bool both)
 {
-	struct d11regs *regs = wlc_hw->regs;
+	struct d11regs __iomem *regs = wlc_hw->regs;
 
 	if (both) {
 		brcms_c_write_hw_bcntemplate0(wlc_hw, bcn, len);
@@ -8855,7 +8854,7 @@ void brcms_c_bss_update_beacon(struct brcms_c_info *wlc,
 		/* Hardware beaconing for this config */
 		u16 bcn[BCN_TMPL_LEN / 2];
 		u32 both_valid = MCMD_BCN0VLD | MCMD_BCN1VLD;
-		struct d11regs *regs = wlc->regs;
+		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
drivers/staging/brcm80211/brcmsmac/main.h +2 -2
index c938add..045356a 100644
@@ -340,7 +340,7 @@ struct brcms_hardware {
 	struct si_pub *sih;	/* SI handle (cookie for siutils calls) */
 	char *vars;		/* "environment" name=value */
 	uint vars_size;		/* size of vars, free vars on detach */
-	struct d11regs *regs;	/* pointer to device registers */
+	struct d11regs __iomem *regs;	/* pointer to device registers */
 	struct phy_shim_info *physhim; /* phy shim layer handler */
 	struct shared_phy *phy_sh;	/* pointer to shared phy state */
 	struct brcms_hw_band *band;/* pointer to active per-band state */
@@ -489,7 +489,7 @@ struct brcms_txq_info {
 struct brcms_c_info {
 	struct brcms_pub *pub;
 	struct brcms_info *wl;
-	struct d11regs *regs;
+	struct d11regs __iomem *regs;
 	struct brcms_hardware *hw;
 
 	/* clock */
Signature · 1 line
1.7.1
author
#13 lore raw

PATCH 11/20 staging: brcm80211: reduce indentation level in dhd_sdio.c #2

In reply to Franky Lin

From: Roland Vossen <[email protected]>

By introducing 1 new function.

---
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c |  103 ++++++++++++++-----------
 1 files changed, 58 insertions(+), 45 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +58 -45
index 169c6b2..cabf912 100644
@@ -1797,6 +1797,62 @@ brcmf_alloc_pkt_and_read(struct brcmf_bus *bus, u16 rdlen,
 	}
 }
 
+/* Checks the header */
+static int
+brcmf_check_rxbuf(struct brcmf_bus *bus, struct sk_buff *pkt, u8 *rxbuf,
+		  u8 rxseq, u16 nextlen, u16 *len)
+{
+	u16 check;
+	bool len_consistent;	/* Result of comparing readahead len and
+				   len from hw-hdr */
+
+	memcpy(bus->rxhdr, rxbuf, SDPCM_HDRLEN);
+
+	/* Extract hardware header fields */
+	*len = get_unaligned_le16(bus->rxhdr);
+	check = get_unaligned_le16(bus->rxhdr + sizeof(u16));
+
+	/* All zeros means readahead info was bad */
+	if (!(*len | check)) {
+		brcmf_dbg(INFO, "(nextlen): read zeros in HW header???\n");
+		goto fail;
+	}
+
+	/* Validate check bytes */
+	if ((u16)~(*len ^ check)) {
+		brcmf_dbg(ERROR, "(nextlen): HW hdr error: nextlen/len/check 0x%04x/0x%04x/0x%04x\n",
+			  nextlen, *len, check);
+		bus->rx_badhdr++;
+		brcmf_sdbrcm_rxfail(bus, false, false);
+		goto fail;
+	}
+
+	/* Validate frame length */
+	if (*len < SDPCM_HDRLEN) {
+		brcmf_dbg(ERROR, "(nextlen): HW hdr length invalid: %d\n",
+			  *len);
+		goto fail;
+	}
+
+	/* Check for consistency with readahead info */
+	len_consistent = (nextlen != (roundup(*len, 16) >> 4));
+	if (len_consistent) {
+		/* Mismatch, force retry w/normal
+			header (may be >4K) */
+		brcmf_dbg(ERROR, "(nextlen): mismatch, nextlen %d len %d rnd %d; expected rxseq %d\n",
+			  nextlen, *len, roundup(*len, 16),
+			  rxseq);
+		brcmf_sdbrcm_rxfail(bus, true, true);
+		goto fail;
+	}
+
+	return 0;
+
+fail:
+	brcmf_sdbrcm_pktfree2(bus, pkt);
+	return -EINVAL;
+}
+
 /* Return true if there may be more frames to read */
 static uint
 brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
@@ -1812,8 +1868,6 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
 	uint rxleft = 0;	/* Remaining number of frames allowed */
 	int sdret;		/* Return code from calls */
 	u8 txmax;		/* Maximum tx sequence offered */
-	bool len_consistent;	/* Result of comparing readahead len and
-					 len from hw-hdr */
 	u8 *rxbuf;
 	int ifidx = 0;
 	uint rxcount = 0;	/* Total frames read */
@@ -1860,50 +1914,9 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
 				continue;
 			}
 
-			/* Now check the header */
-			memcpy(bus->rxhdr, rxbuf, SDPCM_HDRLEN);
-
-			/* Extract hardware header fields */
-			len = get_unaligned_le16(bus->rxhdr);
-			check = get_unaligned_le16(bus->rxhdr + sizeof(u16));
-
-			/* All zeros means readahead info was bad */
-			if (!(len | check)) {
-				brcmf_dbg(INFO, "(nextlen): read zeros in HW header???\n");
-				brcmf_sdbrcm_pktfree2(bus, pkt);
-				continue;
-			}
-
-			/* Validate check bytes */
-			if ((u16)~(len ^ check)) {
-				brcmf_dbg(ERROR, "(nextlen): HW hdr error: nextlen/len/check 0x%04x/0x%04x/0x%04x\n",
-					  nextlen, len, check);
-				bus->rx_badhdr++;
-				brcmf_sdbrcm_rxfail(bus, false, false);
-				brcmf_sdbrcm_pktfree2(bus, pkt);
-				continue;
-			}
-
-			/* Validate frame length */
-			if (len < SDPCM_HDRLEN) {
-				brcmf_dbg(ERROR, "(nextlen): HW hdr length invalid: %d\n",
-					  len);
-				brcmf_sdbrcm_pktfree2(bus, pkt);
+			if (brcmf_check_rxbuf(bus, pkt, rxbuf, rxseq, nextlen,
+					      &len) < 0)
 				continue;
-			}
-
-			/* Check for consistency withreadahead info */
-			len_consistent = (nextlen != (roundup(len, 16) >> 4));
-			if (len_consistent) {
-				/* Mismatch, force retry w/normal
-					header (may be >4K) */
-				brcmf_dbg(ERROR, "(nextlen): mismatch, nextlen %d len %d rnd %d; expected rxseq %d\n",
-					  nextlen, len, roundup(len, 16),
-					  rxseq);
-				brcmf_sdbrcm_rxfail(bus, true, true);
-				brcmf_sdbrcm_pktfree2(bus, pkt);
-				continue;
-			}
 
 			/* Extract software header fields */
 			chan = SDPCM_PACKET_CHANNEL(
Signature · 1 line
1.7.1
author
#14 lore raw

PATCH 12/20 staging: brcm80211: reduce indentation level in dhd_sdio.c #3

In reply to Franky Lin

From: Roland Vossen <[email protected]>

By introducing 1 new function.

---
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c |   85 +++++++++++++------------
 1 files changed, 44 insertions(+), 41 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +44 -41
index cabf912..0def6e3 100644
@@ -2960,6 +2960,48 @@ break2:
 }
 #endif				/* BCMDBG */
 
+static int brcmf_tx_frame(struct brcmf_bus *bus, u8 *frame, u16 len)
+{
+	int i;
+	int ret;
+
+	bus->ctrl_frame_stat = false;
+	ret = brcmf_sdbrcm_send_buf(bus, bus->sdiodev->sbwad,
+				    SDIO_FUNC_2, F2SYNC, frame, len, NULL);
+
+	if (ret < 0) {
+		/* On failure, abort the command and terminate the frame */
+		brcmf_dbg(INFO, "sdio error %d, abort command and terminate frame\n",
+			  ret);
+		bus->tx_sderrs++;
+
+		brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2);
+
+		brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
+				       SBSDIO_FUNC1_FRAMECTRL,
+				       SFC_WF_TERM, NULL);
+		bus->f1regdata++;
+
+		for (i = 0; i < 3; i++) {
+			u8 hi, lo;
+			hi = brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1,
+						   SBSDIO_FUNC1_WFRAMEBCHI,
+						   NULL);
+			lo = brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1,
+						   SBSDIO_FUNC1_WFRAMEBCLO,
+						   NULL);
+			bus->f1regdata += 2;
+			if (hi == 0 && lo == 0)
+				break;
+		}
+		return ret;
+	}
+
+	bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQUENCE_WRAP;
+
+	return ret;
+}
+
 int
 brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
 {
@@ -2969,7 +3011,6 @@ brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
 	uint retries = 0;
 	u8 doff = 0;
 	int ret = -1;
-	int i;
 
 	brcmf_dbg(TRACE, "Enter\n");
 
@@ -3060,46 +3101,8 @@ brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
 #endif
 
 		do {
-			bus->ctrl_frame_stat = false;
-			ret = brcmf_sdbrcm_send_buf(bus, bus->sdiodev->sbwad,
-					SDIO_FUNC_2, F2SYNC, frame, len, NULL);
-
-			if (ret < 0) {
-				/* On failure, abort the command and
-				 terminate the frame */
-				brcmf_dbg(INFO, "sdio error %d, abort command and terminate frame\n",
-					  ret);
-				bus->tx_sderrs++;
-
-				brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2);
-
-				brcmf_sdcard_cfg_write(bus->sdiodev,
-						 SDIO_FUNC_1,
-						 SBSDIO_FUNC1_FRAMECTRL,
-						 SFC_WF_TERM, NULL);
-				bus->f1regdata++;
-
-				for (i = 0; i < 3; i++) {
-					u8 hi, lo;
-					hi = brcmf_sdcard_cfg_read(bus->sdiodev,
-					     SDIO_FUNC_1,
-					     SBSDIO_FUNC1_WFRAMEBCHI,
-					     NULL);
-					lo = brcmf_sdcard_cfg_read(bus->sdiodev,
-					     SDIO_FUNC_1,
-					     SBSDIO_FUNC1_WFRAMEBCLO,
-					     NULL);
-					bus->f1regdata += 2;
-					if ((hi == 0) && (lo == 0))
-						break;
-				}
-
-			}
-			if (ret == 0)
-				bus->tx_seq =
-				    (bus->tx_seq + 1) % SDPCM_SEQUENCE_WRAP;
-
-		} while ((ret < 0) && retries++ < TXRETRIES);
+			ret = brcmf_tx_frame(bus, frame, len);
+		} while (ret < 0 && retries++ < TXRETRIES);
 	}
 
 	if ((bus->idletime == BRCMF_IDLE_IMMEDIATE) && !bus->dpc_sched) {
Signature · 1 line
1.7.1
author
#15 lore raw

PATCH 13/20 staging: brcm80211: reducing indentation levels in bcmsdh_sdmmc.c

In reply to Franky Lin

From: Arend van Spriel <[email protected]>

Some functions in the source file had a lot of indentation levels forcing statements to be spread over multiple lines impairing the readability of the code.

---
 drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c |  140 +++++++++-----------
 1 files changed, 63 insertions(+), 77 deletions(-)
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c +63 -77
index 1cbdb80..fc95bb2 100644
@@ -70,6 +70,54 @@ brcmf_pm_resume_wait(struct brcmf_sdio_dev *sdiodev, wait_queue_head_t *wq)
 #endif
 }
 
+static inline int brcmf_sdioh_f0_write_byte(struct brcmf_sdio_dev *sdiodev,
+					    uint regaddr, u8 *byte)
+{
+	struct sdio_func *sdfunc = sdiodev->func[0];
+	int err_ret;
+
+	/*
+	 * Can only directly write to some F0 registers.
+	 * Handle F2 enable/disable and Abort command
+	 * as a special case.
+	 */
+	if (regaddr == SDIO_CCCR_IOEx) {
+		sdfunc = sdiodev->func[2];
+		if (sdfunc) {
+			sdio_claim_host(sdfunc);
+			if (*byte & SDIO_FUNC_ENABLE_2) {
+				/* Enable Function 2 */
+				err_ret = sdio_enable_func(sdfunc);
+				if (err_ret)
+					brcmf_dbg(ERROR,
+						  "enable F2 failed:%d\n",
+						  err_ret);
+			} else {
+				/* Disable Function 2 */
+				err_ret = sdio_disable_func(sdfunc);
+				if (err_ret)
+					brcmf_dbg(ERROR,
+						  "Disable F2 failed:%d\n",
+						  err_ret);
+			}
+			sdio_release_host(sdfunc);
+		}
+	} else if (regaddr == SDIO_CCCR_ABORT) {
+		sdio_claim_host(sdfunc);
+		sdio_writeb(sdfunc, *byte, regaddr, &err_ret);
+		sdio_release_host(sdfunc);
+	} else if (regaddr < 0xF0) {
+		brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n", regaddr);
+		err_ret = -EPERM;
+	} else {
+		sdio_claim_host(sdfunc);
+		sdio_f0_writeb(sdfunc, *byte, regaddr, &err_ret);
+		sdio_release_host(sdfunc);
+	}
+
+	return err_ret;
+}
+
 int brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, uint func,
 			     uint regaddr, u8 *byte)
 {
@@ -80,82 +128,22 @@ int brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, uint func,
 	brcmf_pm_resume_wait(sdiodev, &sdiodev->request_byte_wait);
 	if (brcmf_pm_resume_error(sdiodev))
 		return -EIO;
-	if (rw) {		/* CMD52 Write */
-		if (func == 0) {
-			/* Can only directly write to some F0 registers.
-			 * Handle F2 enable
-			 * as a special case.
-			 */
-			if (regaddr == SDIO_CCCR_IOEx) {
-				if (sdiodev->func[2]) {
-					sdio_claim_host(sdiodev->func[2]);
-					if (*byte & SDIO_FUNC_ENABLE_2) {
-						/* Enable Function 2 */
-						err_ret =
-						    sdio_enable_func
-						    (sdiodev->func[2]);
-						if (err_ret)
-							brcmf_dbg(ERROR,
-								  "enable F2 failed:%d\n",
-								  err_ret);
-					} else {
-						/* Disable Function 2 */
-						err_ret =
-						    sdio_disable_func
-						    (sdiodev->func[2]);
-						if (err_ret)
-							brcmf_dbg(ERROR,
-								  "Disable F2 failed:%d\n",
-								  err_ret);
-					}
-					sdio_release_host(sdiodev->func[2]);
-				}
-			}
-			/* to allow abort command through F1 */
-			else if (regaddr == SDIO_CCCR_ABORT) {
-				sdio_claim_host(sdiodev->func[func]);
-				/*
-				 * this sdio_f0_writeb() can be replaced
-				 * with another api
-				 * depending upon MMC driver change.
-				 * As of this time, this is temporaray one
-				 */
-				sdio_writeb(sdiodev->func[func], *byte,
-					    regaddr, &err_ret);
-				sdio_release_host(sdiodev->func[func]);
-			} else if (regaddr < 0xF0) {
-				brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n",
-					  regaddr);
-			} else {
-				/* Claim host controller, perform F0 write,
-				 and release */
-				sdio_claim_host(sdiodev->func[func]);
-				sdio_f0_writeb(sdiodev->func[func], *byte,
-					       regaddr, &err_ret);
-				sdio_release_host(sdiodev->func[func]);
-			}
-		} else {
-			/* Claim host controller, perform Fn write,
-			 and release */
-			sdio_claim_host(sdiodev->func[func]);
+
+	if (rw && func == 0) {
+		/* handle F0 separately */
+		err_ret = brcmf_sdioh_f0_write_byte(sdiodev, regaddr, byte);
+	} else {
+		sdio_claim_host(sdiodev->func[func]);
+		if (rw) /* CMD52 Write */
 			sdio_writeb(sdiodev->func[func], *byte, regaddr,
 				    &err_ret);
-			sdio_release_host(sdiodev->func[func]);
-		}
-	} else {		/* CMD52 Read */
-		/* Claim host controller, perform Fn read, and release */
-		sdio_claim_host(sdiodev->func[func]);
-
-		if (func == 0) {
-			*byte =
-			    sdio_f0_readb(sdiodev->func[func], regaddr,
-					  &err_ret);
+		else if (func == 0) {
+			*byte = sdio_f0_readb(sdiodev->func[func], regaddr,
+					      &err_ret);
 		} else {
-			*byte =
-			    sdio_readb(sdiodev->func[func], regaddr,
-				       &err_ret);
+			*byte = sdio_readb(sdiodev->func[func], regaddr,
+					   &err_ret);
 		}
-
 		sdio_release_host(sdiodev->func[func]);
 	}
 
@@ -197,12 +185,10 @@ int brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev,
 			brcmf_dbg(ERROR, "Invalid nbytes: %d\n", nbytes);
 	} else {		/* CMD52 Read */
 		if (nbytes == 4)
-			*word =
-			    sdio_readl(sdiodev->func[func], addr, &err_ret);
+			*word = sdio_readl(sdiodev->func[func], addr, &err_ret);
 		else if (nbytes == 2)
-			*word =
-			    sdio_readw(sdiodev->func[func], addr,
-				       &err_ret) & 0xFFFF;
+			*word = sdio_readw(sdiodev->func[func], addr,
+					   &err_ret) & 0xFFFF;
 		else
 			brcmf_dbg(ERROR, "Invalid nbytes: %d\n", nbytes);
 	}
Signature · 1 line
1.7.1

Franky Lin

author
#0 lore raw

cover staging: brcm80211: code clean up

Code clean up for both brcmfmac and brcmsmac

This series applies to staging-next and depends on the following patch set:
Message-ID: <[email protected]>

Arend van Spriel (2):
staging: brcm80211: only allow one call to add_interface callback
staging: brcm80211: reducing indentation levels in bcmsdh_sdmmc.c

Roland Vossen (18):
staging: brmc80211: removed some unused fmac variable declarations
staging: brcm80211: removed unused smac tx ampdu packet queue
staging: brcm80211: cleaning up tx rate control code in softmac
staging: brcm80211: various __iomem additions to softmac.
staging: brcm80211: reduced softmac sparse warnings
staging: brcm80211: added __iomem qualifier to softmac main.c
staging: brcm80211: added __iomem qualifier to softmac dma.c
staging: brcm80211: added __iomem qualifier to softmac phy
staging: brcm80211: reduce indentation level in dhd_sdio.c #1
staging: brcm80211: reduce indentation level in dhd_sdio.c #2
staging: brcm80211: reduce indentation level in dhd_sdio.c #3
staging: brcm80211: removed unused fullmac spinlock
staging: brcm80211: removed unused softmac mimo disable code
staging: brcm80211: removed fullmac function brcmf_bus_devreset()
staging: brcm80211: removed 'enforce_mutex' parameter in fullmac
staging: brcm80211: renamed ioctl functions/structs to dcmd
staging: brcm80211: cleaned up buffer len defines in fullmac
staging: brcm80211: removed functionality to disable N mode

 drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c  |  140 +++----
 drivers/staging/brcm80211/brcmfmac/dhd.h           |   63 +---
 drivers/staging/brcm80211/brcmfmac/dhd_bus.h       |    4 +-
 drivers/staging/brcm80211/brcmfmac/dhd_cdc.c       |  118 +++---
 drivers/staging/brcm80211/brcmfmac/dhd_common.c    |   32 +-
 drivers/staging/brcm80211/brcmfmac/dhd_linux.c     |  122 +++---
 drivers/staging/brcm80211/brcmfmac/dhd_proto.h     |   13 +-
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c      |  477 ++++++++------------
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c   |  126 +++---
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h   |   10 +-
 drivers/staging/brcm80211/brcmsmac/aiutils.c       |  107 +++--
 drivers/staging/brcm80211/brcmsmac/aiutils.h       |   16 +-
 drivers/staging/brcm80211/brcmsmac/channel.c       |   19 +-
 drivers/staging/brcm80211/brcmsmac/dma.c           |   17 +-
 drivers/staging/brcm80211/brcmsmac/dma.h           |    5 +-
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c   |    5 +-
 drivers/staging/brcm80211/brcmsmac/main.c          |  191 +++-----
 drivers/staging/brcm80211/brcmsmac/main.h          |    8 +-
 drivers/staging/brcm80211/brcmsmac/nicpci.c        |   45 +-
 drivers/staging/brcm80211/brcmsmac/nicpci.h        |    9 +-
 drivers/staging/brcm80211/brcmsmac/otp.c           |    9 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c   |   19 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h   |    2 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_int.h   |    2 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_n.c     |   57 ++--
 .../staging/brcm80211/brcmsmac/phy/phytbl_lcn.c    |    4 -
 drivers/staging/brcm80211/brcmsmac/pmu.c           |   16 +-
 drivers/staging/brcm80211/brcmsmac/scb.h           |    1 -
 drivers/staging/brcm80211/brcmsmac/srom.c          |   20 +-
 drivers/staging/brcm80211/brcmsmac/srom.h          |    2 +-
 drivers/staging/brcm80211/brcmsmac/stf.c           |   14 +-
 31 files changed, 745 insertions(+), 928 deletions(-)
author
#4 lore raw

PATCH 4/20 staging: brcm80211: various __iomem additions to softmac.

From: Roland Vossen <[email protected]>

So it is clear to the reader what memory is IO mapped

---
 drivers/staging/brcm80211/brcmsmac/aiutils.c |  107 ++++++++++++++------------
 drivers/staging/brcm80211/brcmsmac/aiutils.h |   16 ++--
 drivers/staging/brcm80211/brcmsmac/main.c    |    2 +-
 drivers/staging/brcm80211/brcmsmac/nicpci.c  |   45 ++++++-----
 drivers/staging/brcm80211/brcmsmac/nicpci.h  |    9 +-
 drivers/staging/brcm80211/brcmsmac/otp.c     |    9 +-
 drivers/staging/brcm80211/brcmsmac/pmu.c     |   16 ++--
 drivers/staging/brcm80211/brcmsmac/srom.c    |   20 +++--
 drivers/staging/brcm80211/brcmsmac/srom.h    |    2 +-
 9 files changed, 123 insertions(+), 103 deletions(-)
drivers/staging/brcm80211/brcmsmac/aiutils.c +58 -49
index 790fdce..0b3ba6a 100644
@@ -323,7 +323,8 @@
 		     (((si)->pub.buscoretype == PCI_CORE_ID) && \
 		      (si)->pub.buscorerev >= 13))
 
-#define CCREGS_FAST(si) (((char *)((si)->curmap) + PCI_16KB0_CCREGS_OFFSET))
+#define CCREGS_FAST(si) (((char __iomem *)((si)->curmap) + \
+			  PCI_16KB0_CCREGS_OFFSET))
 
 #define	IS_SIM(chippkg)	\
 	((chippkg == HDLSIM_PKG_ID) || (chippkg == HWSIM_PKG_ID))
@@ -357,7 +358,8 @@
 	(((x) >= (b)) && ((x) < ((b) + SI_MAXCORES * SI_CORE_SIZE)) && \
 		IS_ALIGNED((x), SI_CORE_SIZE))
 
-#define PCIEREGS(si) (((char *)((si)->curmap) + PCI_16KB0_PCIREGS_OFFSET))
+#define PCIEREGS(si) ((__iomem char *)((si)->curmap) + \
+			PCI_16KB0_PCIREGS_OFFSET)
 
 struct aidmp {
 	u32 oobselina30;	/* 0x000 */
@@ -480,7 +482,7 @@ struct aidmp {
 /* EROM parsing */
 
 static u32
-get_erom_ent(struct si_pub *sih, u32 **eromptr, u32 mask, u32 match)
+get_erom_ent(struct si_pub *sih, u32 __iomem **eromptr, u32 mask, u32 match)
 {
 	u32 ent;
 	uint inv = 0, nom = 0;
@@ -510,7 +512,7 @@ get_erom_ent(struct si_pub *sih, u32 **eromptr, u32 mask, u32 match)
 }
 
 static u32
-get_asd(struct si_pub *sih, u32 **eromptr, uint sp, uint ad, uint st,
+get_asd(struct si_pub *sih, u32 __iomem **eromptr, uint sp, uint ad, uint st,
 	u32 *addrl, u32 *addrh, u32 *sizel, u32 *sizeh)
 {
 	u32 asd, sz, szd;
@@ -546,12 +548,13 @@ static void ai_hwfixup(struct si_info *sii)
 }
 
 /* parse the enumeration rom to identify all cores */
-static void ai_scan(struct si_pub *sih, struct chipcregs *cc)
+static void ai_scan(struct si_pub *sih, struct chipcregs __iomem *cc)
 {
 	struct si_info *sii = (struct si_info *)sih;
 
-	u32 erombase, *eromptr, *eromlim;
-	void *regs = cc;
+	u32 erombase;
+	u32 __iomem *eromptr, *eromlim;
+	void __iomem *regs = cc;
 
 	erombase = R_REG(&cc->eromptr);
 
@@ -566,7 +569,7 @@ static void ai_scan(struct si_pub *sih, struct chipcregs *cc)
 	while (eromptr < eromlim) {
 		u32 cia, cib, cid, mfg, crev, nmw, nsw, nmp, nsp;
 		u32 mpd, asd, addrl, addrh, sizel, sizeh;
-		u32 *base;
+		u32 __iomem *base;
 		uint i, j, idx;
 		bool br;
 
@@ -726,7 +729,7 @@ static void ai_scan(struct si_pub *sih, struct chipcregs *cc)
  * contains the first register of this 'common' register block (not to be
  * confused with 'common core').
  */
-void *ai_setcoreidx(struct si_pub *sih, uint coreidx)
+void __iomem *ai_setcoreidx(struct si_pub *sih, uint coreidx)
 {
 	struct si_info *sii = (struct si_info *)sih;
 	u32 addr = sii->coresba[coreidx];
@@ -914,7 +917,7 @@ ai_buscore_setup(struct si_info *sii, u32 savewin, uint *origidx)
 	bool pci, pcie;
 	uint i;
 	uint pciidx, pcieidx, pcirev, pcierev;
-	struct chipcregs *cc;
+	struct chipcregs __iomem *cc;
 
 	cc = ai_setcoreidx(&sii->pub, SI_CC_IDX);
 
@@ -990,7 +993,7 @@ ai_buscore_setup(struct si_info *sii, u32 savewin, uint *origidx)
 	if (SI_FAST(sii)) {
 		if (!sii->pch) {
 			sii->pch = pcicore_init(&sii->pub, sii->pbus,
-						(void *)PCIEREGS(sii));
+						(__iomem void *)PCIEREGS(sii));
 			if (sii->pch == NULL)
 				return false;
 		}
@@ -1022,12 +1025,12 @@ static __used void ai_nvram_process(struct si_info *sii, char *pvars)
 }
 
 static struct si_info *ai_doattach(struct si_info *sii,
-				   void *regs, struct pci_dev *pbus,
+				   void __iomem *regs, struct pci_dev *pbus,
 				   char **vars, uint *varsz)
 {
 	struct si_pub *sih = &sii->pub;
 	u32 w, savewin;
-	struct chipcregs *cc;
+	struct chipcregs __iomem *cc;
 	char *pvars = NULL;
 	uint socitype;
 	uint origidx;
@@ -1048,7 +1051,7 @@ static struct si_info *ai_doattach(struct si_info *sii,
 
 	pci_write_config_dword(sii->pbus, PCI_BAR0_WIN,
 			       SI_ENUM_BASE);
-	cc = (struct chipcregs *) regs;
+	cc = (struct chipcregs __iomem *) regs;
 
 	/* bus/core/clk setup for register access */
 	if (!ai_buscore_prep(sii)) {
@@ -1098,7 +1101,7 @@ static struct si_info *ai_doattach(struct si_info *sii,
 	ai_nvram_process(sii, pvars);
 
 	/* === NVRAM, clock is ready === */
-	cc = (struct chipcregs *) ai_setcore(sih, CC_CORE_ID, 0);
+	cc = (struct chipcregs __iomem *) ai_setcore(sih, CC_CORE_ID, 0);
 	W_REG(&cc->gpiopullup, 0);
 	W_REG(&cc->gpiopulldown, 0);
 	ai_setcoreidx(sih, origidx);
@@ -1177,7 +1180,7 @@ static struct si_info *ai_doattach(struct si_info *sii,
  * varsz - pointer to int to return the size of the vars
  */
 struct si_pub *
-ai_attach(void *regs, struct pci_dev *sdh, char **vars, uint *varsz)
+ai_attach(void __iomem *regs, struct pci_dev *sdh, char **vars, uint *varsz)
 {
 	struct si_info *sii;
 
@@ -1291,7 +1294,7 @@ uint ai_findcoreidx(struct si_pub *sih, uint coreid, uint coreunit)
  * Moreover, callers should keep interrupts off during switching
  * out of and back to d11 core.
  */
-void *ai_setcore(struct si_pub *sih, uint coreid, uint coreunit)
+void __iomem *ai_setcore(struct si_pub *sih, uint coreid, uint coreunit)
 {
 	uint idx;
 
@@ -1303,10 +1306,10 @@ void *ai_setcore(struct si_pub *sih, uint coreid, uint coreunit)
 }
 
 /* Turn off interrupt as required by ai_setcore, before switch core */
-void *ai_switch_core(struct si_pub *sih, uint coreid, uint *origidx,
-		     uint *intr_val)
+void __iomem *ai_switch_core(struct si_pub *sih, uint coreid, uint *origidx,
+			     uint *intr_val)
 {
-	void *cc;
+	void __iomem *cc;
 	struct si_info *sii;
 
 	sii = (struct si_info *)sih;
@@ -1364,7 +1367,7 @@ uint ai_corereg(struct si_pub *sih, uint coreidx, uint regoff, uint mask,
 		uint val)
 {
 	uint origidx = 0;
-	u32 *r = NULL;
+	u32 __iomem *r = NULL;
 	uint w;
 	uint intr_val = 0;
 	bool fast = false;
@@ -1382,8 +1385,8 @@ uint ai_corereg(struct si_pub *sih, uint coreidx, uint regoff, uint mask,
 	if ((sii->coreid[coreidx] == CC_CORE_ID) && SI_FAST(sii)) {
 		/* Chipc registers are mapped at 12KB */
 		fast = true;
-		r = (u32 *)((char *)sii->curmap +
-			    PCI_16KB0_CCREGS_OFFSET + regoff);
+		r = (u32 __iomem *)((__iomem char *)sii->curmap +
+				    PCI_16KB0_CCREGS_OFFSET + regoff);
 	} else if (sii->pub.buscoreidx == coreidx) {
 		/*
 		 * pci registers are at either in the last 2KB of
@@ -1391,10 +1394,10 @@ uint ai_corereg(struct si_pub *sih, uint coreidx, uint regoff, uint mask,
 		 */
 		fast = true;
 		if (SI_FAST(sii))
-			r = (u32 *)((char *)sii->curmap +
+			r = (u32 __iomem *)((__iomem char *)sii->curmap +
 				    PCI_16KB0_PCIREGS_OFFSET + regoff);
 		else
-			r = (u32 *)((char *)sii->curmap +
+			r = (u32 __iomem *)((__iomem char *)sii->curmap +
 				    ((regoff >= SBCONFIGOFF) ?
 				      PCI_BAR0_PCISBR_OFFSET :
 				      PCI_BAR0_PCIREGS_OFFSET) + regoff);
@@ -1407,8 +1410,8 @@ uint ai_corereg(struct si_pub *sih, uint coreidx, uint regoff, uint mask,
 		origidx = ai_coreidx(&sii->pub);
 
 		/* switch core */
-		r = (u32 *) ((unsigned char *) ai_setcoreidx(&sii->pub, coreidx)
-				+ regoff);
+		r = (u32 __iomem *) ((unsigned char __iomem *)
+			ai_setcoreidx(&sii->pub, coreidx) + regoff);
 	}
 
 	/* mask and set */
@@ -1489,7 +1492,7 @@ void ai_core_reset(struct si_pub *sih, u32 bits, u32 resetbits)
 /* return the slow clock source - LPO, XTAL, or PCI */
 static uint ai_slowclk_src(struct si_info *sii)
 {
-	struct chipcregs *cc;
+	struct chipcregs __iomem *cc;
 	u32 val;
 
 	if (sii->pub.ccrev < 6) {
@@ -1499,7 +1502,8 @@ static uint ai_slowclk_src(struct si_info *sii)
 			return SCC_SS_PCI;
 		return SCC_SS_XTAL;
 	} else if (sii->pub.ccrev < 10) {
-		cc = (struct chipcregs *) ai_setcoreidx(&sii->pub, sii->curidx);
+		cc = (struct chipcregs __iomem *)
+			ai_setcoreidx(&sii->pub, sii->curidx);
 		return R_REG(&cc->slow_clk_ctl) & SCC_SS_MASK;
 	} else			/* Insta-clock */
 		return SCC_SS_XTAL;
@@ -1509,8 +1513,8 @@ static uint ai_slowclk_src(struct si_info *sii)
 * return the ILP (slowclock) min or max frequency
 * precondition: we've established the chip has dynamic clk control
 */
-static uint
-ai_slowclk_freq(struct si_info *sii, bool max_freq, struct chipcregs *cc)
+static uint ai_slowclk_freq(struct si_info *sii, bool max_freq,
+			    struct chipcregs __iomem *cc)
 {
 	u32 slowclk;
 	uint div;
@@ -1544,7 +1548,8 @@ ai_slowclk_freq(struct si_info *sii, bool max_freq, struct chipcregs *cc)
 	return 0;
 }
 
-static void ai_clkctl_setdelay(struct si_info *sii, struct chipcregs *cc)
+static void
+ai_clkctl_setdelay(struct si_info *sii, struct chipcregs __iomem *cc)
 {
 	uint slowmaxfreq, pll_delay, slowclk;
 	uint pll_on_delay, fref_sel_delay;
@@ -1577,7 +1582,7 @@ void ai_clkctl_init(struct si_pub *sih)
 {
 	struct si_info *sii;
 	uint origidx = 0;
-	struct chipcregs *cc;
+	struct chipcregs __iomem *cc;
 	bool fast;
 
 	if (!(sih->cccaps & CC_CAP_PWR_CTL))
@@ -1587,11 +1592,12 @@ void ai_clkctl_init(struct si_pub *sih)
 	fast = SI_FAST(sii);
 	if (!fast) {
 		origidx = sii->curidx;
-		cc = (struct chipcregs *) ai_setcore(sih, CC_CORE_ID, 0);
+		cc = (struct chipcregs __iomem *)
+			ai_setcore(sih, CC_CORE_ID, 0);
 		if (cc == NULL)
 			return;
 	} else {
-		cc = (struct chipcregs *) CCREGS_FAST(sii);
+		cc = (struct chipcregs __iomem *) CCREGS_FAST(sii);
 		if (cc == NULL)
 			return;
 	}
@@ -1615,7 +1621,7 @@ u16 ai_clkctl_fast_pwrup_delay(struct si_pub *sih)
 {
 	struct si_info *sii;
 	uint origidx = 0;
-	struct chipcregs *cc;
+	struct chipcregs __iomem *cc;
 	uint slowminfreq;
 	u16 fpdelay;
 	uint intr_val = 0;
@@ -1637,11 +1643,12 @@ u16 ai_clkctl_fast_pwrup_delay(struct si_pub *sih)
 	if (!fast) {
 		origidx = sii->curidx;
 		INTR_OFF(sii, intr_val);
-		cc = (struct chipcregs *) ai_setcore(sih, CC_CORE_ID, 0);
+		cc = (struct chipcregs __iomem *)
+			ai_setcore(sih, CC_CORE_ID, 0);
 		if (cc == NULL)
 			goto done;
 	} else {
-		cc = (struct chipcregs *) CCREGS_FAST(sii);
+		cc = (struct chipcregs __iomem *) CCREGS_FAST(sii);
 		if (cc == NULL)
 			goto done;
 	}
@@ -1725,7 +1732,7 @@ int ai_clkctl_xtal(struct si_pub *sih, uint what, bool on)
 static bool _ai_clkctl_cc(struct si_info *sii, uint mode)
 {
 	uint origidx = 0;
-	struct chipcregs *cc;
+	struct chipcregs __iomem *cc;
 	u32 scc;
 	uint intr_val = 0;
 	bool fast = SI_FAST(sii);
@@ -1737,9 +1744,10 @@ static bool _ai_clkctl_cc(struct si_info *sii, uint mode)
 	if (!fast) {
 		INTR_OFF(sii, intr_val);
 		origidx = sii->curidx;
-		cc = (struct chipcregs *) ai_setcore(&sii->pub, CC_CORE_ID, 0);
+		cc = (struct chipcregs __iomem *)
+					ai_setcore(&sii->pub, CC_CORE_ID, 0);
 	} else {
-		cc = (struct chipcregs *) CCREGS_FAST(sii);
+		cc = (struct chipcregs __iomem *) CCREGS_FAST(sii);
 		if (cc == NULL)
 			goto done;
 	}
@@ -1897,7 +1905,7 @@ void ai_pci_down(struct si_pub *sih)
 void ai_pci_setup(struct si_pub *sih, uint coremask)
 {
 	struct si_info *sii;
-	struct sbpciregs *regs = NULL;
+	struct sbpciregs __iomem *regs = NULL;
 	u32 siflag = 0, w;
 	uint idx = 0;
 
@@ -1943,7 +1951,7 @@ void ai_pci_setup(struct si_pub *sih, uint coremask)
 int ai_pci_fixcfg(struct si_pub *sih)
 {
 	uint origidx;
-	void *regs = NULL;
+	void __iomem *regs = NULL;
 	struct si_info *sii = (struct si_info *)sih;
 
 	/* Fixup PI in SROM shadow area to enable the correct PCI core access */
@@ -1953,9 +1961,10 @@ int ai_pci_fixcfg(struct si_pub *sih)
 	/* check 'pi' is correct and fix it if not */
 	regs = ai_setcore(&sii->pub, sii->pub.buscoretype, 0);
 	if (sii->pub.buscoretype == PCIE_CORE_ID)
-		pcicore_fixcfg_pcie(sii->pch, (struct sbpcieregs *)regs);
+		pcicore_fixcfg_pcie(sii->pch,
+				    (struct sbpcieregs __iomem *)regs);
 	else if (sii->pub.buscoretype == PCI_CORE_ID)
-		pcicore_fixcfg_pci(sii->pch, (struct sbpciregs *)regs);
+		pcicore_fixcfg_pci(sii->pch, (struct sbpciregs __iomem *)regs);
 
 	/* restore the original index */
 	ai_setcoreidx(&sii->pub, origidx);
@@ -1976,14 +1985,14 @@ u32 ai_gpiocontrol(struct si_pub *sih, u32 mask, u32 val, u8 priority)
 void ai_chipcontrl_epa4331(struct si_pub *sih, bool on)
 {
 	struct si_info *sii;
-	struct chipcregs *cc;
+	struct chipcregs __iomem *cc;
 	uint origidx;
 	u32 val;
 
 	sii = (struct si_info *)sih;
 	origidx = ai_coreidx(sih);
 
-	cc = (struct chipcregs *) ai_setcore(sih, CC_CORE_ID, 0);
+	cc = (struct chipcregs __iomem *) ai_setcore(sih, CC_CORE_ID, 0);
 
 	val = R_REG(&cc->chipcontrol);
 
@@ -2009,7 +2018,7 @@ void ai_chipcontrl_epa4331(struct si_pub *sih, bool on)
 void ai_epa_4313war(struct si_pub *sih)
 {
 	struct si_info *sii;
-	struct chipcregs *cc;
+	struct chipcregs __iomem *cc;
 	uint origidx;
 
 	sii = (struct si_info *)sih;
@@ -2044,7 +2053,7 @@ bool ai_is_sprom_available(struct si_pub *sih)
 	if (sih->ccrev >= 31) {
 		struct si_info *sii;
 		uint origidx;
-		struct chipcregs *cc;
+		struct chipcregs __iomem *cc;
 		u32 sromctrl;
 
 		if ((sih->cccaps & CC_CAP_SROM) == 0)
drivers/staging/brcm80211/brcmsmac/aiutils.h +8 -8
index 3917192..4a3f98e 100644
@@ -269,8 +269,8 @@ struct si_info {
 	char *vars;
 	uint varsz;
 
-	void *curmap;		/* current regs va */
-	void *regs[SI_MAXCORES];	/* other regs va */
+	void __iomem *curmap;			/* current regs va */
+	void __iomem *regs[SI_MAXCORES];	/* other regs va */
 
 	uint curidx;		/* current core index */
 	uint numcores;		/* # discovered cores */
@@ -319,8 +319,8 @@ extern u32 ai_addrspacesize(struct si_pub *sih, uint asidx);
 extern void ai_write_wrap_reg(struct si_pub *sih, u32 offset, u32 val);
 
 /* === exported functions === */
-extern struct si_pub *ai_attach(void *regs, struct pci_dev *sdh, char **vars,
-				uint *varsz);
+extern struct si_pub *ai_attach(void __iomem *regs, struct pci_dev *sdh,
+				char **vars, uint *varsz);
 extern void ai_detach(struct si_pub *sih);
 extern uint ai_coreid(struct si_pub *sih);
 extern uint ai_corerev(struct si_pub *sih);
@@ -331,10 +331,10 @@ extern u32 ai_core_cflags(struct si_pub *sih, u32 mask, u32 val);
 extern u32 ai_core_sflags(struct si_pub *sih, u32 mask, u32 val);
 extern bool ai_iscoreup(struct si_pub *sih);
 extern uint ai_findcoreidx(struct si_pub *sih, uint coreid, uint coreunit);
-extern void *ai_setcoreidx(struct si_pub *sih, uint coreidx);
-extern void *ai_setcore(struct si_pub *sih, uint coreid, uint coreunit);
-extern void *ai_switch_core(struct si_pub *sih, uint coreid, uint *origidx,
-			    uint *intr_val);
+extern void __iomem *ai_setcoreidx(struct si_pub *sih, uint coreidx);
+extern void __iomem *ai_setcore(struct si_pub *sih, uint coreid, uint coreunit);
+extern void __iomem *ai_switch_core(struct si_pub *sih, uint coreid,
+				    uint *origidx, uint *intr_val);
 extern void ai_restore_core(struct si_pub *sih, uint coreid, uint intr_val);
 extern void ai_core_reset(struct si_pub *sih, u32 bits, u32 resetbits);
 extern void ai_core_disable(struct si_pub *sih, u32 bits);
drivers/staging/brcm80211/brcmsmac/main.c +1 -1
index 10f1de2..f8bc42f 100644
@@ -4678,7 +4678,7 @@ struct brcms_pub *brcms_c_pub(struct brcms_c_info *wlc)
  *    put the whole chip in reset(driver down state), no clock
  */
 static int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device,
-			  uint unit, bool piomode, void *regsva,
+			  uint unit, bool piomode, void __iomem *regsva,
 			  struct pci_dev *btparam)
 {
 	struct brcms_hardware *wlc_hw;
drivers/staging/brcm80211/brcmsmac/nicpci.c +25 -20

133 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/nicpci.h +5 -4
index 4995203..2d41aab 100644
@@ -62,7 +62,8 @@ struct sbpciregs;
 struct sbpcieregs;
 
 extern struct pcicore_info *pcicore_init(struct si_pub *sih,
-					 struct pci_dev *pdev, void *regs);
+					 struct pci_dev *pdev,
+					 void __iomem *regs);
 extern void pcicore_deinit(struct pcicore_info *pch);
 extern void pcicore_attach(struct pcicore_info *pch, char *pvars, int state);
 extern void pcicore_hwup(struct pcicore_info *pch);
@@ -72,10 +73,10 @@ extern void pcicore_down(struct pcicore_info *pch, int state);
 extern u8 pcicore_find_pci_capability(struct pci_dev *dev, u8 req_cap_id,
 				      unsigned char *buf, u32 *buflen);
 extern void pcicore_fixcfg_pci(struct pcicore_info *pch,
-			       struct sbpciregs *pciregs);
+			       struct sbpciregs __iomem *pciregs);
 extern void pcicore_fixcfg_pcie(struct pcicore_info *pch,
-				struct sbpcieregs *pciregs);
+				struct sbpcieregs __iomem *pciregs);
 extern void pcicore_pci_setup(struct pcicore_info *pch,
-			      struct sbpciregs *pciregs);
+			      struct sbpciregs __iomem *pciregs);
 
 #endif /* _BRCM_NICPCI_H_ */
drivers/staging/brcm80211/brcmsmac/otp.c +5 -4
index f15e8be..edf5515 100644
@@ -132,7 +132,8 @@ struct otpinfo {
 #define OTP4315_SWREG_SZ	178	/* 178 bytes */
 #define OTP_SZ_FU_144		(144/8)	/* 144 bits */
 
-static u16 ipxotp_otpr(struct otpinfo *oi, struct chipcregs *cc, uint wn)
+static u16
+ipxotp_otpr(struct otpinfo *oi, struct chipcregs __iomem *cc, uint wn)
 {
 	return R_REG(&cc->sromotp[wn]);
 }
@@ -160,7 +161,7 @@ static int ipxotp_max_rgnsz(struct si_pub *sih, int osizew)
 	return ret;
 }
 
-static void _ipxotp_init(struct otpinfo *oi, struct chipcregs *cc)
+static void _ipxotp_init(struct otpinfo *oi, struct chipcregs __iomem *cc)
 {
 	uint k;
 	u32 otpp, st;
@@ -240,7 +241,7 @@ static void _ipxotp_init(struct otpinfo *oi, struct chipcregs *cc)
 static int ipxotp_init(struct si_pub *sih, struct otpinfo *oi)
 {
 	uint idx;
-	struct chipcregs *cc;
+	struct chipcregs __iomem *cc;
 
 	/* Make sure we're running IPX OTP */
 	if (!OTPTYPE_IPX(sih->ccrev))
@@ -295,7 +296,7 @@ static int
 ipxotp_read_region(struct otpinfo *oi, int region, u16 *data, uint *wlen)
 {
 	uint idx;
-	struct chipcregs *cc;
+	struct chipcregs __iomem *cc;
 	uint base, i, sz;
 
 	/* Validate region selection */
drivers/staging/brcm80211/brcmsmac/pmu.c +8 -8
index 6d4cd9f..3b36e3a 100644
@@ -139,7 +139,7 @@ static void si_pmu_res_masks(struct si_pub *sih, u32 * pmin, u32 * pmax)
 }
 
 static void
-si_pmu_spuravoid_pllupdate(struct si_pub *sih, struct chipcregs *cc,
+si_pmu_spuravoid_pllupdate(struct si_pub *sih, struct chipcregs __iomem *cc,
 			   u8 spuravoid)
 {
 	u32 tmp = 0;
@@ -221,7 +221,7 @@ u16 si_pmu_fast_pwrup_delay(struct si_pub *sih)
 
 void si_pmu_sprom_enable(struct si_pub *sih, bool enable)
 {
-	struct chipcregs *cc;
+	struct chipcregs __iomem *cc;
 	uint origidx;
 
 	/* Remember original core before switch to chipc */
@@ -294,11 +294,11 @@ u32 si_pmu_alp_clock(struct si_pub *sih)
 
 void si_pmu_spuravoid(struct si_pub *sih, u8 spuravoid)
 {
-	struct chipcregs *cc;
+	struct chipcregs __iomem *cc;
 	uint origidx, intr_val;
 
 	/* Remember original core before switch to chipc */
-	cc = (struct chipcregs *)
+	cc = (struct chipcregs __iomem *)
 			ai_switch_core(sih, CC_CORE_ID, &origidx, &intr_val);
 
 	/* update the pll changes */
@@ -311,7 +311,7 @@ void si_pmu_spuravoid(struct si_pub *sih, u8 spuravoid)
 /* initialize PMU */
 void si_pmu_init(struct si_pub *sih)
 {
-	struct chipcregs *cc;
+	struct chipcregs __iomem *cc;
 	uint origidx;
 
 	/* Remember original core before switch to chipc */
@@ -350,7 +350,7 @@ void si_pmu_swreg_init(struct si_pub *sih)
 /* initialize PLL */
 void si_pmu_pll_init(struct si_pub *sih, uint xtalfreq)
 {
-	struct chipcregs *cc;
+	struct chipcregs __iomem *cc;
 	uint origidx;
 
 	/* Remember original core before switch to chipc */
@@ -374,7 +374,7 @@ void si_pmu_pll_init(struct si_pub *sih, uint xtalfreq)
 /* initialize PMU resources */
 void si_pmu_res_init(struct si_pub *sih)
 {
-	struct chipcregs *cc;
+	struct chipcregs __iomem *cc;
 	uint origidx;
 	u32 min_mask = 0, max_mask = 0;
 
@@ -406,7 +406,7 @@ void si_pmu_res_init(struct si_pub *sih)
 
 u32 si_pmu_measure_alpclk(struct si_pub *sih)
 {
-	struct chipcregs *cc;
+	struct chipcregs __iomem *cc;
 	uint origidx;
 	u32 alp_khz;
 
drivers/staging/brcm80211/brcmsmac/srom.c +12 -8
index 0105306..6f3b12c 100644
@@ -782,12 +782,14 @@ static const struct brcms_sromvar perpath_pci_sromvars[] = {
  * shared between devices. */
 static u8 brcms_srom_crc8_table[CRC8_TABLE_SIZE];
 
-static u16 *srom_window_address(struct si_pub *sih, u8 *curmap)
+static u16 __iomem *
+srom_window_address(struct si_pub *sih, u8 __iomem *curmap)
 {
 	if (sih->ccrev < 32)
-		return (u16 *)(curmap + PCI_BAR0_SPROM_OFFSET);
+		return (u16 __iomem *)(curmap + PCI_BAR0_SPROM_OFFSET);
 	if (sih->cccaps & CC_CAP_SROM)
-		return (u16 *)(curmap + PCI_16KB0_CCREGS_OFFSET + CC_SROM_OTP);
+		return (u16 __iomem *)
+		       (curmap + PCI_16KB0_CCREGS_OFFSET + CC_SROM_OTP);
 
 	return NULL;
 }
@@ -1032,7 +1034,7 @@ _initvars_srom_pci(u8 sromrev, u16 *srom, uint off, struct brcms_varbuf *b)
  * Return 0 on success, nonzero on error.
  */
 static int
-sprom_read_pci(struct si_pub *sih, u16 *sprom, uint wordoff,
+sprom_read_pci(struct si_pub *sih, u16 __iomem *sprom, uint wordoff,
 	       u16 *buf, uint nwords, bool check_crc)
 {
 	int err = 0;
@@ -1131,10 +1133,11 @@ static int initvars_table(char *start, char *end,
  * Initialize nonvolatile variable table from sprom.
  * Return 0 on success, nonzero on error.
  */
-static int initvars_srom_pci(struct si_pub *sih, void *curmap, char **vars,
-			     uint *count)
+static int initvars_srom_pci(struct si_pub *sih, void __iomem *curmap,
+			     char **vars, uint *count)
 {
-	u16 *srom, *sromwindow;
+	u16 *srom;
+	u16 __iomem *sromwindow;
 	u8 sromrev = 0;
 	u32 sr;
 	struct brcms_varbuf b;
@@ -1222,7 +1225,8 @@ errout:
  * Initialize local vars from the right source for this platform.
  * Return 0 on success, nonzero on error.
  */
-int srom_var_init(struct si_pub *sih, void *curmap, char **vars, uint *count)
+int srom_var_init(struct si_pub *sih, void __iomem *curmap, char **vars,
+		  uint *count)
 {
 	uint len;
 
drivers/staging/brcm80211/brcmsmac/srom.h +1 -1
index dd51156..826c2cd 100644
@@ -20,7 +20,7 @@
 #include "types.h"
 
 /* Prototypes */
-extern int srom_var_init(struct si_pub *sih, void *curmap, char **vars,
+extern int srom_var_init(struct si_pub *sih, void __iomem *curmap, char **vars,
 			 uint *count);
 
 extern int srom_read(struct si_pub *sih, uint bus, void *curmap,
Signature · 1 line
1.7.1
author
#7 lore raw

PATCH 5/20 staging: brcm80211: reduced softmac sparse warnings

In reply to Franky Lin

From: Roland Vossen <[email protected]>

By declaring certain variables static. One unused array induced a warning, array was deleted.

---
 drivers/staging/brcm80211/brcmsmac/channel.c       |    4 +-
 drivers/staging/brcm80211/brcmsmac/main.c          |    2 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_n.c     |   48 ++++++++++----------
 .../staging/brcm80211/brcmsmac/phy/phytbl_lcn.c    |    4 --
 4 files changed, 27 insertions(+), 31 deletions(-)
drivers/staging/brcm80211/brcmsmac/channel.c +2 -2
index a9defe2..02bb795 100644
@@ -197,7 +197,7 @@ static const struct brcms_chanvec chanvec_none = {
 };
 
 /* All 2.4 GHz HW channels */
-const struct brcms_chanvec chanvec_all_2G = {
+static const struct brcms_chanvec chanvec_all_2G = {
 	{0xfe, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -205,7 +205,7 @@ const struct brcms_chanvec chanvec_all_2G = {
 };
 
 /* All 5 GHz HW channels */
-const struct brcms_chanvec chanvec_all_5G = {
+static const struct brcms_chanvec chanvec_all_5G = {
 	{0x00, 0x00, 0x00, 0x00, 0x54, 0x55, 0x11, 0x11,
 	 0x01, 0x00, 0x00, 0x00, 0x10, 0x11, 0x11, 0x11,
 	 0x11, 0x11, 0x20, 0x22, 0x22, 0x00, 0x00, 0x11,
drivers/staging/brcm80211/brcmsmac/main.c +1 -1
index f8bc42f..ac5a52a 100644
@@ -423,7 +423,7 @@ uint brcm_msg_level =
 #endif				/* BCMDBG */
 
 /* TX FIFO number to WME/802.1E Access Category */
-const u8 wme_fifo2ac[] = { AC_BK, AC_BE, AC_VI, AC_VO, AC_BE, AC_BE };
+static const u8 wme_fifo2ac[] = { AC_BK, AC_BE, AC_VI, AC_VO, AC_BE, AC_BE };
 
 /* WME/802.1E Access Category to TX FIFO number */
 static const u8 wme_ac2fifo[] = { 1, 0, 2, 3 };
drivers/staging/brcm80211/brcmsmac/phy/phy_n.c +24 -24

192 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/phy/phytbl_lcn.c +0 -4
index 15c5ffc..622c01c 100644
@@ -1611,10 +1611,6 @@ const u32 dot11lcnphytbl_rx_gain_info_sz_rev0 =
 	sizeof(dot11lcnphytbl_rx_gain_info_rev0) /
 	sizeof(dot11lcnphytbl_rx_gain_info_rev0[0]);
 
-static const u32 dot11lcnphytbl_rx_gain_info_sz_rev1 =
-	sizeof(dot11lcnphytbl_rx_gain_info_rev1) /
-	sizeof(dot11lcnphytbl_rx_gain_info_rev1[0]);
-
 const u32 dot11lcnphytbl_rx_gain_info_2G_rev2_sz =
 	sizeof(dot11lcnphytbl_rx_gain_info_2G_rev2) /
 	sizeof(dot11lcnphytbl_rx_gain_info_2G_rev2[0]);
Signature · 1 line
1.7.1
author
#9 lore raw

PATCH 7/20 staging: brcm80211: added __iomem qualifier to softmac dma.c

In reply to Franky Lin

From: Roland Vossen <[email protected]>

Code cleanup. Makes it clear when an address is mapped IO space.

---
 drivers/staging/brcm80211/brcmsmac/dma.c |   17 +++++++++--------
 drivers/staging/brcm80211/brcmsmac/dma.h |    5 +++--
 2 files changed, 12 insertions(+), 10 deletions(-)
drivers/staging/brcm80211/brcmsmac/dma.c +9 -8
index ef856ce..b56a302 100644
@@ -224,9 +224,9 @@ struct dma_info {
 	bool addrext;	/* this dma engine supports DmaExtendedAddrChanges */
 
 	/* 64-bit dma tx engine registers */
-	struct dma64regs *d64txregs;
+	struct dma64regs __iomem *d64txregs;
 	/* 64-bit dma rx engine registers */
-	struct dma64regs *d64rxregs;
+	struct dma64regs __iomem *d64rxregs;
 	/* pointer to dma64 tx descriptor ring */
 	struct dma64desc *txd64;
 	/* pointer to dma64 rx descriptor ring */
@@ -391,7 +391,7 @@ static uint _dma_ctrlflags(struct dma_info *di, uint mask, uint flags)
 	return dmactrlflags;
 }
 
-static bool _dma64_addrext(struct dma64regs *dma64regs)
+static bool _dma64_addrext(struct dma64regs __iomem *dma64regs)
 {
 	u32 w;
 	OR_REG(&dma64regs->control, D64_XC_AE);
@@ -553,8 +553,9 @@ static bool _dma_alloc(struct dma_info *di, uint direction)
 }
 
 struct dma_pub *dma_attach(char *name, struct si_pub *sih,
-		     void *dmaregstx, void *dmaregsrx, uint ntxd,
-		     uint nrxd, uint rxbufsize, int rxextheadroom,
+		     void __iomem *dmaregstx, void __iomem *dmaregsrx,
+		     uint ntxd, uint nrxd,
+		     uint rxbufsize, int rxextheadroom,
 		     uint nrxpost, uint rxoffset, uint *msg_level)
 {
 	struct dma_info *di;
@@ -571,8 +572,8 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,
 	di->dma64 = ((ai_core_sflags(sih, 0, 0) & SISF_DMA64) == SISF_DMA64);
 
 	/* init dma reg pointer */
-	di->d64txregs = (struct dma64regs *) dmaregstx;
-	di->d64rxregs = (struct dma64regs *) dmaregsrx;
+	di->d64txregs = (struct dma64regs __iomem *) dmaregstx;
+	di->d64rxregs = (struct dma64regs __iomem *) dmaregsrx;
 
 	/*
 	 * Default flags (which can be changed by the driver calling
@@ -1344,7 +1345,7 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range)
 	if (range == DMA_RANGE_ALL)
 		end = di->txout;
 	else {
-		struct dma64regs *dregs = di->d64txregs;
+		struct dma64regs __iomem *dregs = di->d64txregs;
 
 		end = (u16) (B2I(((R_REG(&dregs->status0) &
 				 D64_XS0_CD_MASK) -
drivers/staging/brcm80211/brcmsmac/dma.h +3 -2
index 4075dc9..ebc5bc5 100644
@@ -74,8 +74,9 @@ struct dma_pub {
 };
 
 extern struct dma_pub *dma_attach(char *name, struct si_pub *sih,
-			    void *dmaregstx, void *dmaregsrx, uint ntxd,
-			    uint nrxd, uint rxbufsize, int rxextheadroom,
+			    void __iomem *dmaregstx, void __iomem *dmaregsrx,
+			    uint ntxd, uint nrxd,
+			    uint rxbufsize, int rxextheadroom,
 			    uint nrxpost, uint rxoffset, uint *msg_level);
 
 void dma_rxinit(struct dma_pub *pub);
Signature · 1 line
1.7.1
author
#10 lore raw

PATCH 8/20 staging: brcm80211: added __iomem qualifier to softmac phy

In reply to Franky Lin

From: Roland Vossen <[email protected]>

Code cleanup. Makes it clear when an address is mapped IO space.

---
 drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c |   19 +++++++++----------
 drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h |    2 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_int.h |    2 +-
 drivers/staging/brcm80211/brcmsmac/phy/phy_n.c   |    9 +++++----
 4 files changed, 16 insertions(+), 16 deletions(-)
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c +9 -10
index 5b81480..45e3b4b 100644
@@ -323,7 +323,7 @@ void write_phy_channel_reg(struct brcms_phy *pi, uint val)
 
 u16 read_phy_reg(struct brcms_phy *pi, u16 addr)
 {
-	struct d11regs *regs;
+	struct d11regs __iomem *regs;
 
 	regs = pi->regs;
 
@@ -335,7 +335,7 @@ u16 read_phy_reg(struct brcms_phy *pi, u16 addr)
 
 void write_phy_reg(struct brcms_phy *pi, u16 addr, u16 val)
 {
-	struct d11regs *regs;
+	struct d11regs __iomem *regs;
 
 	regs = pi->regs;
 
@@ -345,8 +345,7 @@ void write_phy_reg(struct brcms_phy *pi, u16 addr, u16 val)
 	if (addr == 0x72)
 		(void)R_REG(&regs->phyregdata);
 #else
-	W_REG((u32 *)(&regs->phyregaddr),
-	      addr | (val << 16));
+	W_REG((u32 __iomem *)(&regs->phyregaddr), addr | (val << 16));
 	if (++pi->phy_wreg >= pi->phy_wreg_limit) {
 		pi->phy_wreg = 0;
 		(void)R_REG(&regs->phyversion);
@@ -356,7 +355,7 @@ void write_phy_reg(struct brcms_phy *pi, u16 addr, u16 val)
 
 void and_phy_reg(struct brcms_phy *pi, u16 addr, u16 val)
 {
-	struct d11regs *regs;
+	struct d11regs __iomem *regs;
 
 	regs = pi->regs;
 
@@ -368,7 +367,7 @@ void and_phy_reg(struct brcms_phy *pi, u16 addr, u16 val)
 
 void or_phy_reg(struct brcms_phy *pi, u16 addr, u16 val)
 {
-	struct d11regs *regs;
+	struct d11regs __iomem *regs;
 
 	regs = pi->regs;
 
@@ -380,7 +379,7 @@ void or_phy_reg(struct brcms_phy *pi, u16 addr, u16 val)
 
 void mod_phy_reg(struct brcms_phy *pi, u16 addr, u16 mask, u16 val)
 {
-	struct d11regs *regs;
+	struct d11regs __iomem *regs;
 
 	regs = pi->regs;
 
@@ -494,8 +493,8 @@ static u32 wlc_phy_get_radio_ver(struct brcms_phy *pi)
 }
 
 struct brcms_phy_pub *
-wlc_phy_attach(struct shared_phy *sh, struct d11regs *regs, int bandtype,
-	       char *vars, struct wiphy *wiphy)
+wlc_phy_attach(struct shared_phy *sh, struct d11regs __iomem *regs,
+	       int bandtype, char *vars, struct wiphy *wiphy)
 {
 	struct brcms_phy *pi;
 	u32 sflags = 0;
@@ -1065,7 +1064,7 @@ wlc_phy_init_radio_regs(struct brcms_phy *pi,
 void wlc_phy_do_dummy_tx(struct brcms_phy *pi, bool ofdm, bool pa_on)
 {
 #define DUMMY_PKT_LEN   20
-	struct d11regs *regs = pi->regs;
+	struct d11regs __iomem *regs = pi->regs;
 	int i, count;
 	u8 ofdmpkt[DUMMY_PKT_LEN] = {
 		0xcc, 0x01, 0x02, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00,
drivers/staging/brcm80211/brcmsmac/phy/phy_hal.h +1 -1
index 39c3c22..44818af 100644
@@ -184,7 +184,7 @@ struct shared_phy_params {
 
 extern struct shared_phy *wlc_phy_shared_attach(struct shared_phy_params *shp);
 extern struct brcms_phy_pub *wlc_phy_attach(struct shared_phy *sh,
-					    struct d11regs *regs,
+					    struct d11regs __iomem *regs,
 					    int bandtype, char *vars,
 					    struct wiphy *wiphy);
 extern void wlc_phy_detach(struct brcms_phy_pub *ppi);
drivers/staging/brcm80211/brcmsmac/phy/phy_int.h +1 -1
index 1611521..4468090 100644
@@ -559,7 +559,7 @@ struct brcms_phy {
 	} u;
 	bool user_txpwr_at_rfport;
 
-	struct d11regs *regs;
+	struct d11regs __iomem *regs;
 	struct brcms_phy *next;
 	char *vars;
 	struct brcms_phy_pub pubpi;
drivers/staging/brcm80211/brcmsmac/phy/phy_n.c +5 -4
index 4023af1..67cfcdd 100644
@@ -19363,7 +19363,7 @@ void wlc_phy_init_nphy(struct brcms_phy *pi)
 	bool do_nphy_cal = false;
 	uint core;
 	uint origidx, intr_val;
-	struct d11regs *regs;
+	struct d11regs __iomem *regs;
 	u32 d11_clk_ctl_st;
 	bool do_rssi_cal = false;
 
@@ -19385,9 +19385,10 @@ void wlc_phy_init_nphy(struct brcms_phy *pi)
 	if ((pi->nphy_gband_spurwar2_en) && CHSPEC_IS2G(pi->radio_chanspec) &&
 	    CHSPEC_IS40(pi->radio_chanspec)) {
 
-		regs = (struct d11regs *) ai_switch_core(pi->sh->sih,
-							 D11_CORE_ID, &origidx,
-							 &intr_val);
+		regs = (struct d11regs __iomem *)
+				ai_switch_core(pi->sh->sih,
+					       D11_CORE_ID, &origidx,
+					       &intr_val);
 		d11_clk_ctl_st = R_REG(&regs->clk_ctl_st);
 		AND_REG(&regs->clk_ctl_st,
 			~(CCS_FORCEHT | CCS_HTAREQ));
Signature · 1 line
1.7.1
author
#11 lore raw

PATCH 9/20 staging: brcm80211: only allow one call to add_interface callback

In reply to Franky Lin

From: Arend van Spriel <[email protected]>

The driver only supports one network interface to be associated with it. Only for the first call it does actually something. For subsequent calls it does return -ENODEV error code.

---
 drivers/staging/brcm80211/brcmsmac/mac80211_if.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +4 -1
index 1fa95d7..6787498 100644
@@ -341,7 +341,10 @@ brcms_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 
 	wl = hw->priv;
 	LOCK(wl);
-	err = brcms_up(wl);
+	if (!wl->pub->up)
+		err = brcms_up(wl);
+	else
+		err = -ENODEV;
 	UNLOCK(wl);
 
 	if (err != 0)
Signature · 1 line
1.7.1
author
#12 lore raw

PATCH 10/20 staging: brcm80211: reduce indentation level in dhd_sdio.c #1

In reply to Franky Lin

From: Roland Vossen <[email protected]>

By introducing two new functions.

---
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c |  108 ++++++++++++------------
 1 files changed, 54 insertions(+), 54 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +54 -54
index 4992d4d..169c6b2 100644
@@ -1335,11 +1335,10 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_bus *bus, u8 rxseq)
 		if (pnext) {
 			brcmf_dbg(GLOM, "allocated %d-byte packet chain for %d subframes\n",
 				  totlen, num);
-			if (BRCMF_GLOM_ON() && bus->nextlen) {
-				if (totlen != bus->nextlen) {
-					brcmf_dbg(GLOM, "glomdesc mismatch: nextlen %d glomdesc %d rxseq %d\n",
-						  bus->nextlen, totlen, rxseq);
-				}
+			if (BRCMF_GLOM_ON() && bus->nextlen &&
+			    totlen != bus->nextlen) {
+				brcmf_dbg(GLOM, "glomdesc mismatch: nextlen %d glomdesc %d rxseq %d\n",
+					  bus->nextlen, totlen, rxseq);
 			}
 			bus->glom = pfirst;
 			pfirst = pnext = NULL;
@@ -1753,6 +1752,51 @@ done:
 	brcmf_sdbrcm_ioctl_resp_wake(bus);
 }
 
+/* Pad read to blocksize for efficiency */
+static void brcmf_pad(struct brcmf_bus *bus, u16 *pad, u16 *rdlen)
+{
+	if (bus->roundup && bus->blocksize && *rdlen > bus->blocksize) {
+		*pad = bus->blocksize - (*rdlen % bus->blocksize);
+		if (*pad <= bus->roundup && *pad < bus->blocksize &&
+		    *rdlen + *pad + BRCMF_FIRSTREAD < MAX_RX_DATASZ)
+			*rdlen += *pad;
+	} else if (*rdlen % BRCMF_SDALIGN) {
+		*rdlen += BRCMF_SDALIGN - (*rdlen % BRCMF_SDALIGN);
+	}
+}
+
+static void
+brcmf_alloc_pkt_and_read(struct brcmf_bus *bus, u16 rdlen,
+			 struct sk_buff **pkt, u8 **rxbuf)
+{
+	int sdret;		/* Return code from calls */
+
+	*pkt = brcmu_pkt_buf_get_skb(rdlen + BRCMF_SDALIGN);
+	if (*pkt == NULL)
+		return;
+
+	pkt_align(*pkt, rdlen, BRCMF_SDALIGN);
+	*rxbuf = (u8 *) ((*pkt)->data);
+	/* Read the entire frame */
+	sdret = brcmf_sdcard_recv_buf(bus->sdiodev, bus->sdiodev->sbwad,
+				      SDIO_FUNC_2, F2SYNC,
+				      *rxbuf, rdlen, *pkt);
+	bus->f2rxdata++;
+
+	if (sdret < 0) {
+		brcmf_dbg(ERROR, "(nextlen): read %d bytes failed: %d\n",
+			  rdlen, sdret);
+		brcmu_pkt_buf_free_skb(*pkt);
+		bus->drvr->rx_errors++;
+		/* Force retry w/normal header read.
+		 * Don't attempt NAK for
+		 * gSPI
+		 */
+		brcmf_sdbrcm_rxfail(bus, true, true);
+		*pkt = NULL;
+	}
+}
+
 /* Return true if there may be more frames to read */
 static uint
 brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
@@ -1801,63 +1845,19 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
 			bus->nextlen = 0;
 
 			rdlen = len = nextlen << 4;
+			brcmf_pad(bus, &pad, &rdlen);
 
-			/* Pad read to blocksize for efficiency */
-			if (bus->roundup && bus->blocksize
-			    && (rdlen > bus->blocksize)) {
-				pad =
-				    bus->blocksize -
-				    (rdlen % bus->blocksize);
-				if ((pad <= bus->roundup)
-				    && (pad < bus->blocksize)
-				    && ((rdlen + pad + BRCMF_FIRSTREAD) <
-					MAX_RX_DATASZ))
-					rdlen += pad;
-			} else if (rdlen % BRCMF_SDALIGN) {
-				rdlen += BRCMF_SDALIGN -
-					 (rdlen % BRCMF_SDALIGN);
-			}
-
-			/* We use bus->rxctl buffer in WinXP for initial
-			 * control pkt receives.
-			 * Later we use buffer-poll for data as well
-			 * as control packets.
-			 * This is required because dhd receives full
-			 * frame in gSPI unlike SDIO.
+			/*
 			 * After the frame is received we have to
 			 * distinguish whether it is data
 			 * or non-data frame.
 			 */
-			/* Allocate a packet buffer */
-			pkt = brcmu_pkt_buf_get_skb(rdlen + BRCMF_SDALIGN);
-			if (!pkt) {
+			brcmf_alloc_pkt_and_read(bus, rdlen, &pkt, &rxbuf);
+			if (pkt == NULL) {
 				/* Give up on data, request rtx of events */
-				brcmf_dbg(ERROR, "(nextlen): brcmu_pkt_buf_get_skb failed: len %d rdlen %d expected rxseq %d\n",
+				brcmf_dbg(ERROR, "(nextlen): brcmf_alloc_pkt_and_read failed: len %d rdlen %d expected rxseq %d\n",
 					  len, rdlen, rxseq);
 				continue;
-			} else {
-				pkt_align(pkt, rdlen, BRCMF_SDALIGN);
-				rxbuf = (u8 *) (pkt->data);
-				/* Read the entire frame */
-				sdret = brcmf_sdcard_recv_buf(bus->sdiodev,
-						bus->sdiodev->sbwad,
-						SDIO_FUNC_2, F2SYNC,
-						rxbuf, rdlen,
-						pkt);
-				bus->f2rxdata++;
-
-				if (sdret < 0) {
-					brcmf_dbg(ERROR, "(nextlen): read %d bytes failed: %d\n",
-						  rdlen, sdret);
-					brcmu_pkt_buf_free_skb(pkt);
-					bus->drvr->rx_errors++;
-					/* Force retry w/normal header read.
-					 * Don't attempt NAK for
-					 * gSPI
-					 */
-					brcmf_sdbrcm_rxfail(bus, true, true);
-					continue;
-				}
 			}
 
 			/* Now check the header */
Signature · 1 line
1.7.1
author
#17 lore raw

PATCH 15/20 staging: brcm80211: removed unused softmac mimo disable code

In reply to Franky Lin

From: Roland Vossen <[email protected]>

No element in array locale_bn[] has the 'no mimo' flag bit set.

---
 drivers/staging/brcm80211/brcmsmac/channel.c |   15 +++------------
 drivers/staging/brcm80211/brcmsmac/main.h    |    2 --
 drivers/staging/brcm80211/brcmsmac/stf.c     |   14 ++++++--------
 3 files changed, 9 insertions(+), 22 deletions(-)
drivers/staging/brcm80211/brcmsmac/channel.c +3 -12
index 02bb795..7fe005a 100644
@@ -987,7 +987,6 @@ brcms_c_set_country_common(struct brcms_cm_info *wlc_cm,
 		       const char *ccode, uint regrev,
 		       const struct country_info *country)
 {
-	const struct locale_mimo_info *li_mimo;
 	const struct locale_info *locale;
 	struct brcms_c_info *wlc = wlc_cm->wlc;
 	char prev_country_abbrev[BRCM_CNTRY_BUF_SZ];
@@ -1003,17 +1002,9 @@ brcms_c_set_country_common(struct brcms_cm_info *wlc_cm,
 	strncpy(wlc_cm->ccode, ccode, BRCM_CNTRY_BUF_SZ - 1);
 	wlc_cm->regrev = regrev;
 
-	/* disable/restore nmode based on country regulations */
-	li_mimo = brcms_c_get_mimo_2g(country->locale_mimo_2G);
-	if (li_mimo && (li_mimo->flags & BRCMS_NO_MIMO)) {
-		brcms_c_set_nmode(wlc, OFF);
-		wlc->stf->no_cddstbc = true;
-	} else {
-		wlc->stf->no_cddstbc = false;
-		if ((wlc->pub->_n_enab & SUPPORT_11N) !=
-		    wlc->protection->nmode_user)
-			brcms_c_set_nmode(wlc, wlc->protection->nmode_user);
-	}
+	if ((wlc->pub->_n_enab & SUPPORT_11N) !=
+	    wlc->protection->nmode_user)
+		brcms_c_set_nmode(wlc, wlc->protection->nmode_user);
 
 	brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_2G_INDEX]);
 	brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]);
drivers/staging/brcm80211/brcmsmac/main.h +0 -2
index 045356a..8815042 100644
@@ -194,7 +194,6 @@ struct brcms_protection {
  * ss_algosel_auto: if true, use wlc->stf->ss_algo_channel;
  *			else use wlc->band->stf->ss_mode_band.
  * ss_algo_channel: ss based on per-channel algo: 0: SISO, 1: CDD 2: STBC.
- * no_cddstbc: stf override, 1: no CDD (or STBC) allowed.
  * rxchain_restore_delay: delay time to restore default rxchain.
  * ldpc: AUTO/ON/OFF ldpc cap supported.
  * txcore[MAX_STREAMS_SUPPORTED + 1]: bitmap of selected core for each Nsts.
@@ -213,7 +212,6 @@ struct brcms_stf {
 	u8 ss_opmode;
 	bool ss_algosel_auto;
 	u16 ss_algo_channel;
-	u8 no_cddstbc;
 	u8 rxchain_restore_delay;
 	s8 ldpc;
 	u8 txcore[MAX_STREAMS_SUPPORTED + 1];
drivers/staging/brcm80211/brcmsmac/stf.c +6 -8
index c77bab2..ba3c3ef 100644
@@ -319,17 +319,15 @@ int brcms_c_stf_ss_update(struct brcms_c_info *wlc, struct brcms_band *band)
 	if (BRCMS_STBC_CAP_PHY(wlc) &&
 	    wlc->stf->ss_algosel_auto
 	    && (wlc->stf->ss_algo_channel != (u16) -1)) {
-		upd_stf_ss = (wlc->stf->no_cddstbc || (wlc->stf->txstreams == 1)
-			      || isset(&wlc->stf->ss_algo_channel,
-				       PHY_TXC1_MODE_SISO)) ? PHY_TXC1_MODE_SISO
-		    : PHY_TXC1_MODE_CDD;
+		upd_stf_ss = (wlc->stf->txstreams == 1 ||
+			      isset(&wlc->stf->ss_algo_channel,
+				    PHY_TXC1_MODE_SISO)) ?
+				    PHY_TXC1_MODE_SISO : PHY_TXC1_MODE_CDD;
 	} else {
 		if (wlc->band != band)
 			return ret_code;
-		upd_stf_ss = (wlc->stf->no_cddstbc
-			      || (wlc->stf->txstreams ==
-				  1)) ? PHY_TXC1_MODE_SISO : band->
-		    band_stf_ss_mode;
+		upd_stf_ss = (wlc->stf->txstreams == 1) ?
+				PHY_TXC1_MODE_SISO : band->band_stf_ss_mode;
 	}
 	if (prev_stf_ss != upd_stf_ss) {
 		wlc->stf->ss_opmode = upd_stf_ss;
Signature · 1 line
1.7.1
author
#19 lore raw

PATCH 17/20 staging: brcm80211: removed 'enforce_mutex' parameter in fullmac

In reply to Franky Lin

From: Roland Vossen <[email protected]>

Parameter was always called with the value 'true'.

---
 drivers/staging/brcm80211/brcmfmac/dhd_bus.h   |    4 ++--
 drivers/staging/brcm80211/brcmfmac/dhd_linux.c |    4 ++--
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c  |   23 ++++++++++-------------
 3 files changed, 14 insertions(+), 17 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_bus.h +2 -2
index a5064f5..a249407 100644
@@ -35,10 +35,10 @@ extern void brcmf_bus_unregister(void);
 extern struct device *brcmf_bus_get_device(struct brcmf_bus *bus);
 
 /* Stop bus module: clear pending frames, disable data flow */
-extern void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus, bool enforce_mutex);
+extern void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus);
 
 /* Initialize bus module: prepare for communication w/dongle */
-extern int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex);
+extern int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr);
 
 /* Send a data frame to the dongle.  Callee disposes of txp. */
 extern int brcmf_sdbrcm_bus_txdata(struct brcmf_bus *bus, struct sk_buff *txp);
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +2 -2
index 3ae0d43..a31b8a3 100644
@@ -1093,7 +1093,7 @@ int brcmf_bus_start(struct brcmf_pub *drvr)
 	brcmf_dbg(TRACE, "\n");
 
 	/* Bring up the bus */
-	ret = brcmf_sdbrcm_bus_init(&drvr_priv->pub, true);
+	ret = brcmf_sdbrcm_bus_init(&drvr_priv->pub);
 	if (ret != 0) {
 		brcmf_dbg(ERROR, "brcmf_sdbrcm_bus_init failed %d\n", ret);
 		return ret;
@@ -1217,7 +1217,7 @@ static void brcmf_bus_detach(struct brcmf_pub *drvr)
 			brcmf_proto_stop(&drvr_priv->pub);
 
 			/* Stop the bus module */
-			brcmf_sdbrcm_bus_stop(drvr_priv->pub.bus, true);
+			brcmf_sdbrcm_bus_stop(drvr_priv->pub.bus);
 		}
 	}
 }
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +10 -13
index 655209d..aa05cc0 100644
@@ -2720,7 +2720,7 @@ static int brcmf_sdbrcm_dpc_thread(void *data)
 				if (brcmf_sdbrcm_dpc(bus))
 					complete(&bus->dpc_wait);
 			} else {
-				brcmf_sdbrcm_bus_stop(bus, true);
+				brcmf_sdbrcm_bus_stop(bus);
 			}
 		} else
 			break;
@@ -2736,8 +2736,9 @@ static void brcmf_sdbrcm_dpc_tasklet(unsigned long data)
 	if (bus->drvr->busstate != BRCMF_BUS_DOWN) {
 		if (brcmf_sdbrcm_dpc(bus))
 			tasklet_schedule(&bus->tasklet);
-	} else
-		brcmf_sdbrcm_bus_stop(bus, true);
+	} else {
+		brcmf_sdbrcm_bus_stop(bus);
+	}
 }
 
 static void brcmf_sdbrcm_sched_dpc(struct brcmf_bus *bus)
@@ -3639,7 +3640,7 @@ brcmf_sdbrcm_download_firmware(struct brcmf_bus *bus)
 	return ret;
 }
 
-void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus, bool enforce_mutex)
+void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus)
 {
 	u32 local_hostintmask;
 	u8 saveclk;
@@ -3648,8 +3649,7 @@ void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus, bool enforce_mutex)
 
 	brcmf_dbg(TRACE, "Enter\n");
 
-	if (enforce_mutex)
-		down(&bus->sdsem);
+	down(&bus->sdsem);
 
 	bus_wake(bus);
 
@@ -3720,11 +3720,10 @@ void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus, bool enforce_mutex)
 	bus->rxskip = false;
 	bus->tx_seq = bus->rx_seq = 0;
 
-	if (enforce_mutex)
-		up(&bus->sdsem);
+	up(&bus->sdsem);
 }
 
-int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex)
+int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr)
 {
 	struct brcmf_bus *bus = drvr->bus;
 	unsigned long timeout;
@@ -3748,8 +3747,7 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex)
 	bus->drvr->tickcnt = 0;
 	brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS);
 
-	if (enforce_mutex)
-		down(&bus->sdsem);
+	down(&bus->sdsem);
 
 	/* Make sure backplane clock is on, needed to generate F2 interrupt */
 	brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
@@ -3822,8 +3820,7 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex)
 		brcmf_sdbrcm_clkctl(bus, CLK_NONE, false);
 
 exit:
-	if (enforce_mutex)
-		up(&bus->sdsem);
+	up(&bus->sdsem);
 
 	return ret;
 }
Signature · 1 line
1.7.1
author
#20 lore raw

PATCH 18/20 staging: brcm80211: renamed ioctl functions/structs to dcmd

In reply to Franky Lin

From: Roland Vossen <[email protected]>

The fullmac dongle communicates with the driver using certain codes. These codes were named 'ioctls' in the code, but this term is confusing since it is used in kernel<->driver context. The term 'ioctl' has been replaced with 'dcmd' for 'dongle command'.

---
 drivers/staging/brcm80211/brcmfmac/dhd.h         |   32 ++----
 drivers/staging/brcm80211/brcmfmac/dhd_cdc.c     |  118 ++++++++++----------
 drivers/staging/brcm80211/brcmfmac/dhd_common.c  |   32 +++---
 drivers/staging/brcm80211/brcmfmac/dhd_linux.c   |  118 ++++++++++----------
 drivers/staging/brcm80211/brcmfmac/dhd_proto.h   |   13 +--
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c    |   26 +++--
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c |  126 +++++++++++-----------
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h |   10 +-
 8 files changed, 233 insertions(+), 242 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +11 -21
index d79bd79..501faed 100644
@@ -23,9 +23,9 @@
 
 #define BRCMF_VERSION_STR		"4.218.248.5"
 
-#define	BRCMF_C_IOCTL_SMLEN	256	/* "small" ioctl buffer required */
-#define BRCMF_C_IOCTL_MEDLEN	1536	/* "med" ioctl buffer required */
-#define	BRCMF_C_IOCTL_MAXLEN	8192
+#define	BRCMF_C_DCMD_SMLEN	256	/* "small" cmd buffer required */
+#define BRCMF_C_DCMD_MEDLEN	1536	/* "med" cmd buffer required */
+#define	BRCMF_C_DCMD_MAXLEN	8192
 
 /*******************************************************************************
  * IO codes that are interpreted by dongle firmware
@@ -572,12 +572,12 @@ struct brcmf_channel_info_le {
 	__le32 scan_channel;
 };
 
-/* Linux network driver ioctl encoding */
-struct brcmf_ioctl {
-	uint cmd;		/* common ioctl definition */
+/* Bus independent dongle command */
+struct brcmf_dcmd {
+	uint cmd;		/* common dongle cmd definition */
 	void *buf;		/* pointer to user buffer */
 	uint len;		/* length of user buffer */
-	u8 set;		/* get or set request (optional) */
+	u8 set;			/* get or set request (optional) */
 	uint used;		/* bytes read or written (optional) */
 	uint needed;		/* bytes needed (optional) */
 };
@@ -694,7 +694,7 @@ extern struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus,
 extern int brcmf_net_attach(struct brcmf_pub *drvr, int idx);
 extern int brcmf_netdev_wait_pend8021x(struct net_device *ndev);
 
-extern s32 brcmf_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len);
+extern s32 brcmf_exec_dcmd(struct net_device *dev, u32 cmd, void *arg, u32 len);
 
 /* Indication from bus module regarding removal/absence of dongle */
 extern void brcmf_detach(struct brcmf_pub *drvr);
@@ -716,8 +716,8 @@ extern char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
 extern void brcmf_txcomplete(struct brcmf_pub *drvr, struct sk_buff *txp,
 			     bool success);
 
-/* Query ioctl */
-extern int brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx,
+/* Query dongle */
+extern int brcmf_proto_cdc_query_dcmd(struct brcmf_pub *drvr, int ifidx,
 				       uint cmd, void *buf, uint len);
 
 /* OS independent layer functions */
@@ -749,17 +749,7 @@ extern void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg);
 extern void brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg,
 					     int enable, int master_mode);
 
-/* per-driver magic numbers */
-#define BRCMF_IOCTL_MAGIC		0x00444944
-
-/* bump this number if you change the ioctl interface */
-#define BRCMF_IOCTL_VERSION	1
-#define	BRCMF_IOCTL_MAXLEN	8192	/* max length ioctl buffer required */
-
-/* common ioctl definitions */
-#define BRCMF_GET_VERSION				1
-#define BRCMF_GET_VAR				2
-#define BRCMF_SET_VAR				3
+#define	BRCMF_DCMD_MAXLEN	8192	/* max length cmd buffer required */
 
 /* message levels */
 #define BRCMF_ERROR_VAL	0x0001
drivers/staging/brcm80211/brcmfmac/dhd_cdc.c +60 -58

274 lines not on this page · raw message

drivers/staging/brcm80211/brcmfmac/dhd_common.c +16 -16
index 963d1a9..4075fd7 100644
@@ -596,7 +596,7 @@ brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg, int enable,
 	memcpy((char *)pkt_filterp, &enable_parm, sizeof(enable_parm));
 
 	/* Enable/disable the specified filter. */
-	rc = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, buf, buf_len);
+	rc = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, buf, buf_len);
 	rc = rc >= 0 ? 0 : rc;
 	if (rc)
 		brcmf_dbg(TRACE, "failed to add pktfilter %s, retcode = %d\n",
@@ -607,7 +607,7 @@ brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg, int enable,
 	/* Contorl the master mode */
 	brcmu_mkiovar("pkt_filter_mode", (char *)&master_mode, 4, buf,
 		    sizeof(buf));
-	rc = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, buf,
+	rc = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, buf,
 				       sizeof(buf));
 	rc = rc >= 0 ? 0 : rc;
 	if (rc)
@@ -734,7 +734,7 @@ void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg)
 	       &pkt_filter,
 	       BRCMF_PKT_FILTER_FIXED_LEN + BRCMF_PKT_FILTER_PATTERN_FIXED_LEN);
 
-	rc = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, buf, buf_len);
+	rc = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, buf, buf_len);
 	rc = rc >= 0 ? 0 : rc;
 
 	if (rc)
@@ -755,7 +755,7 @@ static void brcmf_c_arp_offload_set(struct brcmf_pub *drvr, int arp_mode)
 	int retcode;
 
 	brcmu_mkiovar("arp_ol", (char *)&arp_mode, 4, iovbuf, sizeof(iovbuf));
-	retcode = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR,
+	retcode = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR,
 				   iovbuf, sizeof(iovbuf));
 	retcode = retcode >= 0 ? 0 : retcode;
 	if (retcode)
@@ -772,7 +772,7 @@ static void brcmf_c_arp_offload_enable(struct brcmf_pub *drvr, int arp_enable)
 	int retcode;
 
 	brcmu_mkiovar("arpoe", (char *)&arp_enable, 4, iovbuf, sizeof(iovbuf));
-	retcode = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR,
+	retcode = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR,
 				   iovbuf, sizeof(iovbuf));
 	retcode = retcode >= 0 ? 0 : retcode;
 	if (retcode)
@@ -783,7 +783,7 @@ static void brcmf_c_arp_offload_enable(struct brcmf_pub *drvr, int arp_enable)
 			  arp_enable);
 }
 
-int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr)
+int brcmf_c_preinit_dcmds(struct brcmf_pub *drvr)
 {
 	char iovbuf[BRCMF_EVENTING_MASK_LEN + 12];	/*  Room for
 				 "event_msgs" + '\0' + bitvec  */
@@ -801,7 +801,7 @@ int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr)
 
 	/* Set Country code */
 	if (drvr->country_code[0] != 0) {
-		if (brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_COUNTRY,
+		if (brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_COUNTRY,
 					      drvr->country_code,
 					      sizeof(drvr->country_code)) < 0)
 			brcmf_dbg(ERROR, "country code setting failed\n");
@@ -811,7 +811,7 @@ int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr)
 	memset(buf, 0, sizeof(buf));
 	ptr = buf;
 	brcmu_mkiovar("ver", NULL, 0, buf, sizeof(buf));
-	brcmf_proto_cdc_query_ioctl(drvr, 0, BRCMF_C_GET_VAR, buf, sizeof(buf));
+	brcmf_proto_cdc_query_dcmd(drvr, 0, BRCMF_C_GET_VAR, buf, sizeof(buf));
 	strsep(&ptr, "\n");
 	/* Print fw version info */
 	brcmf_dbg(ERROR, "Firmware version = %s\n", buf);
@@ -819,40 +819,40 @@ int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr)
 	/* Match Host and Dongle rx alignment */
 	brcmu_mkiovar("bus:txglomalign", (char *)&dongle_align, 4, iovbuf,
 		    sizeof(iovbuf));
-	brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
+	brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
 				  sizeof(iovbuf));
 
 	/* disable glom option per default */
 	brcmu_mkiovar("bus:txglom", (char *)&glom, 4, iovbuf, sizeof(iovbuf));
-	brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
+	brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
 				  sizeof(iovbuf));
 
 	/* Setup timeout if Beacons are lost and roam is off to report
 		 link down */
 	brcmu_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf,
 		    sizeof(iovbuf));
-	brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
+	brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
 				  sizeof(iovbuf));
 
 	/* Enable/Disable build-in roaming to allowed ext supplicant to take
 		 of romaing */
 	brcmu_mkiovar("roam_off", (char *)&roaming, 4,
 		      iovbuf, sizeof(iovbuf));
-	brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
+	brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
 				  sizeof(iovbuf));
 
 	/* Force STA UP */
-	brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_UP, (char *)&up, sizeof(up));
+	brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_UP, (char *)&up, sizeof(up));
 
 	/* Setup event_msgs */
 	brcmu_mkiovar("event_msgs", drvr->eventmask, BRCMF_EVENTING_MASK_LEN,
 		      iovbuf, sizeof(iovbuf));
-	brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
+	brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
 				  sizeof(iovbuf));
 
-	brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_SCAN_CHANNEL_TIME,
+	brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_SCAN_CHANNEL_TIME,
 			 (char *)&scan_assoc_time, sizeof(scan_assoc_time));
-	brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_SCAN_UNASSOC_TIME,
+	brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_SCAN_UNASSOC_TIME,
 			 (char *)&scan_unassoc_time, sizeof(scan_unassoc_time));
 
 	/* Set and enable ARP offload feature */
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +59 -59

224 lines not on this page · raw message

drivers/staging/brcm80211/brcmfmac/dhd_proto.h +5 -8
index 24b0f99..4ee1ea8 100644
@@ -17,9 +17,6 @@
 #ifndef _BRCMF_PROTO_H_
 #define _BRCMF_PROTO_H_
 
-#define IOCTL_RESP_TIMEOUT  2000	/* In milli second */
-#define IOCTL_CHIP_ACTIVE_TIMEOUT  10	/* In milli second */
-
 /*
  * Exported from the brcmf protocol module (brcmf_cdc)
  */
@@ -48,16 +45,16 @@ extern void brcmf_proto_hdrpush(struct brcmf_pub *, int ifidx,
 extern int brcmf_proto_hdrpull(struct brcmf_pub *, int *ifidx,
 			       struct sk_buff *rxp);
 
-/* Use protocol to issue ioctl to dongle */
-extern int brcmf_proto_ioctl(struct brcmf_pub *drvr, int ifidx,
-			     struct brcmf_ioctl *ioc, int len);
+/* Use protocol to issue command to dongle */
+extern int brcmf_proto_dcmd(struct brcmf_pub *drvr, int ifidx,
+				struct brcmf_dcmd *dcmd, int len);
 
 /* Update local copy of dongle statistics */
 extern void brcmf_proto_dstats(struct brcmf_pub *drvr);
 
-extern int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr);
+extern int brcmf_c_preinit_dcmds(struct brcmf_pub *drvr);
 
-extern int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *drvr, int ifidx,
+extern int brcmf_proto_cdc_set_dcmd(struct brcmf_pub *drvr, int ifidx,
 				     uint cmd, void *buf, uint len);
 
 #endif				/* _BRCMF_PROTO_H_ */
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +14 -12
index aa05cc0..5423280 100644
@@ -35,6 +35,8 @@
 #include <soc.h>
 #include "sdio_host.h"
 
+#define DCMD_RESP_TIMEOUT  2000	/* In milli second */
+
 #ifdef BCMDBG
 
 #define BRCMF_TRAP_INFO_SIZE	80
@@ -641,7 +643,7 @@ struct brcmf_bus {
 
 	spinlock_t txqlock;
 	wait_queue_head_t ctrl_wait;
-	wait_queue_head_t ioctl_resp_wait;
+	wait_queue_head_t dcmd_resp_wait;
 
 	struct timer_list timer;
 	struct completion watchdog_wait;
@@ -1616,14 +1618,14 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_bus *bus, u8 rxseq)
 	return num;
 }
 
-static int brcmf_sdbrcm_ioctl_resp_wait(struct brcmf_bus *bus, uint *condition,
+static int brcmf_sdbrcm_dcmd_resp_wait(struct brcmf_bus *bus, uint *condition,
 					bool *pending)
 {
 	DECLARE_WAITQUEUE(wait, current);
-	int timeout = msecs_to_jiffies(IOCTL_RESP_TIMEOUT);
+	int timeout = msecs_to_jiffies(DCMD_RESP_TIMEOUT);
 
 	/* Wait until control frame is available */
-	add_wait_queue(&bus->ioctl_resp_wait, &wait);
+	add_wait_queue(&bus->dcmd_resp_wait, &wait);
 	set_current_state(TASK_INTERRUPTIBLE);
 
 	while (!(*condition) && (!signal_pending(current) && timeout))
@@ -1633,15 +1635,15 @@ static int brcmf_sdbrcm_ioctl_resp_wait(struct brcmf_bus *bus, uint *condition,
 		*pending = true;
 
 	set_current_state(TASK_RUNNING);
-	remove_wait_queue(&bus->ioctl_resp_wait, &wait);
+	remove_wait_queue(&bus->dcmd_resp_wait, &wait);
 
 	return timeout;
 }
 
-static int brcmf_sdbrcm_ioctl_resp_wake(struct brcmf_bus *bus)
+static int brcmf_sdbrcm_dcmd_resp_wake(struct brcmf_bus *bus)
 {
-	if (waitqueue_active(&bus->ioctl_resp_wait))
-		wake_up_interruptible(&bus->ioctl_resp_wait);
+	if (waitqueue_active(&bus->dcmd_resp_wait))
+		wake_up_interruptible(&bus->dcmd_resp_wait);
 
 	return 0;
 }
@@ -1732,7 +1734,7 @@ gotpkt:
 
 done:
 	/* Awake any waiters */
-	brcmf_sdbrcm_ioctl_resp_wake(bus);
+	brcmf_sdbrcm_dcmd_resp_wake(bus);
 }
 
 /* Pad read to blocksize for efficiency */
@@ -3106,7 +3108,7 @@ brcmf_sdbrcm_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
 	brcmf_dbg(TRACE, "Enter\n");
 
 	/* Wait until control frame is available */
-	timeleft = brcmf_sdbrcm_ioctl_resp_wait(bus, &bus->rxlen, &pending);
+	timeleft = brcmf_sdbrcm_dcmd_resp_wait(bus, &bus->rxlen, &pending);
 
 	down(&bus->sdsem);
 	rxlen = bus->rxlen;
@@ -3714,7 +3716,7 @@ void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus)
 
 	/* Clear rx control and wake any waiters */
 	bus->rxlen = 0;
-	brcmf_sdbrcm_ioctl_resp_wake(bus);
+	brcmf_sdbrcm_dcmd_resp_wake(bus);
 
 	/* Reset some F2 state stuff */
 	bus->rxskip = false;
@@ -4508,7 +4510,7 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
 
 	spin_lock_init(&bus->txqlock);
 	init_waitqueue_head(&bus->ctrl_wait);
-	init_waitqueue_head(&bus->ioctl_resp_wait);
+	init_waitqueue_head(&bus->dcmd_resp_wait);
 
 	/* Set up the watchdog timer */
 	init_timer(&bus->timer);
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +63 -63

461 lines not on this page · raw message

drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h +5 -5
index afc60d9..21c8f8e 100644
@@ -103,10 +103,10 @@ do {								\
 				 * report it to cfg80211 through "connect"
 				 * event
 				 */
-#define WL_IOCTL_LEN_MAX	1024
+#define WL_DCMD_LEN_MAX	1024
 #define WL_EXTRA_BUF_MAX	2048
 #define WL_ISCAN_BUF_MAX	2048	/*
-				 * the buf length can be BRCMF_C_IOCTL_MAXLEN
+				 * the buf length can be BRCMF_C_DCMD_MAXLEN
 				 * to reduce iteration
 				 */
 #define WL_ISCAN_TIMER_INTERVAL_MS	3000
@@ -251,7 +251,7 @@ struct brcmf_cfg80211_iscan_ctrl {
 	struct work_struct work;
 	struct brcmf_cfg80211_iscan_eloop el;
 	void *data;
-	s8 ioctl_buf[BRCMF_C_IOCTL_SMLEN];
+	s8 dcmd_buf[BRCMF_C_DCMD_SMLEN];
 	s8 scan_buf[WL_ISCAN_BUF_MAX];
 };
 
@@ -312,8 +312,8 @@ struct brcmf_cfg80211_priv {
 	bool dongle_up;		/* indicate whether dongle up or not */
 	bool roam_on;		/* on/off switch for dongle self-roaming */
 	bool scan_tried;	/* indicates if first scan attempted */
-	u8 *ioctl_buf;	/* ioctl buffer */
-	u8 *extra_buf;	/* maily to grab assoc information */
+	u8 *dcmd_buf;		/* dcmd buffer */
+	u8 *extra_buf;		/* maily to grab assoc information */
 	struct dentry *debugfsdir;
 	u8 ci[0] __aligned(NETDEV_ALIGN);
 };
Signature · 1 line
1.7.1
author
#22 lore raw

PATCH 20/20 staging: brcm80211: removed functionality to disable N mode

In reply to Franky Lin

From: Roland Vossen <[email protected]>

NVRAM contains a parameter that can disable N mode. This functionality is not needed. As a consequence, brcms_c_protection_upd() could be simplified.

---
 drivers/staging/brcm80211/brcmsmac/channel.c |    2 +-
 drivers/staging/brcm80211/brcmsmac/main.c    |   85 +++++++-------------------
 drivers/staging/brcm80211/brcmsmac/main.h    |    2 +-
 3 files changed, 24 insertions(+), 65 deletions(-)
drivers/staging/brcm80211/brcmsmac/channel.c +1 -1
index 7fe005a..2127c27 100644
@@ -1004,7 +1004,7 @@ brcms_c_set_country_common(struct brcms_cm_info *wlc_cm,
 
 	if ((wlc->pub->_n_enab & SUPPORT_11N) !=
 	    wlc->protection->nmode_user)
-		brcms_c_set_nmode(wlc, wlc->protection->nmode_user);
+		brcms_c_set_nmode(wlc);
 
 	brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_2G_INDEX]);
 	brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]);
drivers/staging/brcm80211/brcmsmac/main.c +22 -63

128 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/main.h +1 -1
index 8815042..e458916 100644
@@ -799,7 +799,7 @@ extern void brcms_c_set_chanspec(struct brcms_c_info *wlc,
 
 extern bool brcms_c_timers_init(struct brcms_c_info *wlc, int unit);
 
-extern int brcms_c_set_nmode(struct brcms_c_info *wlc, s32 nmode);
+extern int brcms_c_set_nmode(struct brcms_c_info *wlc);
 extern void brcms_c_mimops_action_ht_send(struct brcms_c_info *wlc,
 				      struct brcms_bss_cfg *bsscfg,
 				      u8 mimops_mode);
Signature · 1 line
1.7.1
author
#16 lore raw

PATCH 14/20 staging: brcm80211: removed unused fullmac spinlock

In reply to Franky Lin

From: Roland Vossen <[email protected]>

Usage of spinlock depended on module parameters that are going to be removed in a subsequent patch. Parameter wlc->threads_only is always 'true'.

---
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c |   58 +++++++++----------------
 1 files changed, 20 insertions(+), 38 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +20 -38
index 0def6e3..198d544 100644
@@ -655,7 +655,6 @@ struct brcmf_bus {
 
 	bool threads_only;
 	struct semaphore sdsem;
-	spinlock_t sdlock;
 
 	const char *fw_name;
 	const struct firmware *firmware;
@@ -812,22 +811,6 @@ static void brcmf_sdbrcm_pktfree2(struct brcmf_bus *bus, struct sk_buff *pkt)
 		brcmu_pkt_buf_free_skb(pkt);
 }
 
-static void brcmf_sdbrcm_sdlock(struct brcmf_bus *bus)
-{
-	if (bus->threads_only)
-		down(&bus->sdsem);
-	else
-		spin_lock_bh(&bus->sdlock);
-}
-
-static void brcmf_sdbrcm_sdunlock(struct brcmf_bus *bus)
-{
-	if (bus->threads_only)
-		up(&bus->sdsem);
-	else
-		spin_unlock_bh(&bus->sdlock);
-}
-
 /* Turn backplane clock on or off */
 static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok)
 {
@@ -1622,9 +1605,9 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_bus *bus, u8 rxseq)
 #endif				/* BCMDBG */
 		}
 		if (num) {
-			brcmf_sdbrcm_sdunlock(bus);
+			up(&bus->sdsem);
 			brcmf_rx_frame(bus->drvr, ifidx, save_pfirst, num);
-			brcmf_sdbrcm_sdlock(bus);
+			down(&bus->sdsem);
 		}
 
 		bus->rxglomframes++;
@@ -2225,9 +2208,9 @@ deliver:
 		}
 
 		/* Unlock during rx call */
-		brcmf_sdbrcm_sdunlock(bus);
+		up(&bus->sdsem);
 		brcmf_rx_frame(bus->drvr, ifidx, pkt, 1);
-		brcmf_sdbrcm_sdlock(bus);
+		down(&bus->sdsem);
 	}
 	rxcount = maxframes - rxleft;
 #ifdef BCMDBG
@@ -2257,10 +2240,10 @@ brcmf_sdbrcm_send_buf(struct brcmf_bus *bus, u32 addr, uint fn, uint flags,
 static void
 brcmf_sdbrcm_wait_for_event(struct brcmf_bus *bus, bool *lockvar)
 {
-	brcmf_sdbrcm_sdunlock(bus);
+	up(&bus->sdsem);
 	wait_event_interruptible_timeout(bus->ctrl_wait,
 					 (*lockvar == false), HZ * 2);
-	brcmf_sdbrcm_sdlock(bus);
+	down(&bus->sdsem);
 	return;
 }
 
@@ -2407,9 +2390,9 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_bus *bus, struct sk_buff *pkt,
 done:
 	/* restore pkt buffer pointer before calling tx complete routine */
 	skb_pull(pkt, SDPCM_HDRLEN + pad);
-	brcmf_sdbrcm_sdunlock(bus);
+	up(&bus->sdsem);
 	brcmf_txcomplete(bus->drvr, pkt, ret != 0);
-	brcmf_sdbrcm_sdlock(bus);
+	down(&bus->sdsem);
 
 	if (free_pkt)
 		brcmu_pkt_buf_free_skb(pkt);
@@ -2487,7 +2470,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus)
 	/* Start with leftover status bits */
 	intstatus = bus->intstatus;
 
-	brcmf_sdbrcm_sdlock(bus);
+	down(&bus->sdsem);
 
 	/* If waiting for HTAVAIL, check status */
 	if (bus->clkstate == CLK_PENDING) {
@@ -2711,7 +2694,7 @@ clkwait:
 		brcmf_sdbrcm_clkctl(bus, CLK_NONE, false);
 	}
 
-	brcmf_sdbrcm_sdunlock(bus);
+	up(&bus->sdsem);
 
 	return resched;
 }
@@ -3048,7 +3031,7 @@ brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
 	/* precondition: IS_ALIGNED((unsigned long)frame, 2) */
 
 	/* Need to lock here to protect txseq and SDIO tx calls */
-	brcmf_sdbrcm_sdlock(bus);
+	down(&bus->sdsem);
 
 	bus_wake(bus);
 
@@ -3110,7 +3093,7 @@ brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
 		brcmf_sdbrcm_clkctl(bus, CLK_NONE, true);
 	}
 
-	brcmf_sdbrcm_sdunlock(bus);
+	up(&bus->sdsem);
 
 	if (ret)
 		bus->drvr->tx_ctlerrs++;
@@ -3135,11 +3118,11 @@ brcmf_sdbrcm_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
 	/* Wait until control frame is available */
 	timeleft = brcmf_sdbrcm_ioctl_resp_wait(bus, &bus->rxlen, &pending);
 
-	brcmf_sdbrcm_sdlock(bus);
+	down(&bus->sdsem);
 	rxlen = bus->rxlen;
 	memcpy(msg, bus->rxctl, min(msglen, rxlen));
 	bus->rxlen = 0;
-	brcmf_sdbrcm_sdunlock(bus);
+	up(&bus->sdsem);
 
 	if (rxlen) {
 		brcmf_dbg(CTL, "resumed on rxctl frame, got %d expected %d\n",
@@ -3677,7 +3660,7 @@ void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus, bool enforce_mutex)
 	brcmf_dbg(TRACE, "Enter\n");
 
 	if (enforce_mutex)
-		brcmf_sdbrcm_sdlock(bus);
+		down(&bus->sdsem);
 
 	bus_wake(bus);
 
@@ -3749,7 +3732,7 @@ void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus, bool enforce_mutex)
 	bus->tx_seq = bus->rx_seq = 0;
 
 	if (enforce_mutex)
-		brcmf_sdbrcm_sdunlock(bus);
+		up(&bus->sdsem);
 }
 
 int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex)
@@ -3777,7 +3760,7 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex)
 	brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS);
 
 	if (enforce_mutex)
-		brcmf_sdbrcm_sdlock(bus);
+		down(&bus->sdsem);
 
 	/* Make sure backplane clock is on, needed to generate F2 interrupt */
 	brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
@@ -3851,7 +3834,7 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex)
 
 exit:
 	if (enforce_mutex)
-		brcmf_sdbrcm_sdunlock(bus);
+		up(&bus->sdsem);
 
 	return ret;
 }
@@ -3904,7 +3887,7 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_pub *drvr)
 	if (bus->sleeping)
 		return false;
 
-	brcmf_sdbrcm_sdlock(bus);
+	down(&bus->sdsem);
 
 	/* Poll period: check device if appropriate. */
 	if (bus->poll && (++bus->polltick >= bus->pollrate)) {
@@ -3969,7 +3952,7 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_pub *drvr)
 		}
 	}
 
-	brcmf_sdbrcm_sdunlock(bus);
+	up(&bus->sdsem);
 
 	return bus->ipend;
 }
@@ -4562,7 +4545,6 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
 		sema_init(&bus->sdsem, 1);
 	} else {
 		bus->threads_only = false;
-		spin_lock_init(&bus->sdlock);
 	}
 
 	if (brcmf_dpc_prio >= 0) {
Signature · 1 line
1.7.1
author
#18 lore raw

PATCH 16/20 staging: brcm80211: removed fullmac function brcmf_bus_devreset()

In reply to Franky Lin

From: Roland Vossen <[email protected]>

Function is not called anymore.

---
 drivers/staging/brcm80211/brcmfmac/dhd.h      |    2 -
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c |   82 +------------------------
 2 files changed, 1 insertions(+), 83 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +0 -2
index be6c620..d79bd79 100644
@@ -599,7 +599,6 @@ struct brcmf_pub {
 	/* Internal brcmf items */
 	bool up;		/* Driver up/down (to OS) */
 	bool txoff;		/* Transmit flow-controlled */
-	bool dongle_reset;	/* true = DEVRESET put dongle into reset */
 	enum brcmf_bus_state busstate;
 	uint hdrlen;		/* Total BRCMF header length (proto + bus) */
 	uint maxctl;		/* Max size rxctl request from proto to bus */
@@ -744,7 +743,6 @@ extern void brcmf_del_if(struct brcmf_info *drvr_priv, int ifidx);
 extern int brcmf_sendpkt(struct brcmf_pub *drvr, int ifidx,\
 			 struct sk_buff *pkt);
 
-extern int brcmf_bus_devreset(struct brcmf_pub *drvr, u8 flag);
 extern int brcmf_bus_start(struct brcmf_pub *drvr);
 
 extern void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg);
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +1 -81

130 lines not on this page · raw message

Signature · 1 line
1.7.1
author
#21 lore raw

PATCH 19/20 staging: brcm80211: cleaned up buffer len defines in fullmac

In reply to Franky Lin

From: Roland Vossen <[email protected]>

Code cleanup. Replaced identical definition BRCMF_C_DCMD_MAXLEN by BRCMF_DCMD_MAXLEN. Renamed related buffer len definitions.

---
 drivers/staging/brcm80211/brcmfmac/dhd.h         |    6 ++----
 drivers/staging/brcm80211/brcmfmac/dhd_cdc.c     |    6 +++---
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c |    8 ++++----
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h |    4 ++--
 4 files changed, 11 insertions(+), 13 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +2 -4
index 501faed..3ec7477 100644
@@ -23,10 +23,6 @@
 
 #define BRCMF_VERSION_STR		"4.218.248.5"
 
-#define	BRCMF_C_DCMD_SMLEN	256	/* "small" cmd buffer required */
-#define BRCMF_C_DCMD_MEDLEN	1536	/* "med" cmd buffer required */
-#define	BRCMF_C_DCMD_MAXLEN	8192
-
 /*******************************************************************************
  * IO codes that are interpreted by dongle firmware
  ******************************************************************************/
@@ -749,6 +745,8 @@ extern void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg);
 extern void brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg,
 					     int enable, int master_mode);
 
+#define	BRCMF_DCMD_SMLEN	256	/* "small" cmd buffer required */
+#define BRCMF_DCMD_MEDLEN	1536	/* "med" cmd buffer required */
 #define	BRCMF_DCMD_MAXLEN	8192	/* max length cmd buffer required */
 
 /* message levels */
drivers/staging/brcm80211/brcmfmac/dhd_cdc.c +3 -3
index ec0a057..e34c5c3 100644
@@ -97,7 +97,7 @@ struct brcmf_proto {
 	u32 lastcmd;
 	u8 bus_header[BUS_HEADER_LEN];
 	struct brcmf_proto_cdc_dcmd msg;
-	unsigned char buf[BRCMF_C_DCMD_MAXLEN + ROUND_UP_MARGIN];
+	unsigned char buf[BRCMF_DCMD_MAXLEN + ROUND_UP_MARGIN];
 };
 
 static int brcmf_proto_cdc_msg(struct brcmf_pub *drvr)
@@ -288,7 +288,7 @@ brcmf_proto_dcmd(struct brcmf_pub *drvr, int ifidx, struct brcmf_dcmd *dcmd,
 
 	brcmf_dbg(TRACE, "Enter\n");
 
-	if (len > BRCMF_C_DCMD_MAXLEN)
+	if (len > BRCMF_DCMD_MAXLEN)
 		goto done;
 
 	if (prot->pending == true) {
@@ -435,7 +435,7 @@ int brcmf_proto_attach(struct brcmf_pub *drvr)
 
 	drvr->prot = cdc;
 	drvr->hdrlen += BDC_HEADER_LEN;
-	drvr->maxctl = BRCMF_C_DCMD_MAXLEN +
+	drvr->maxctl = BRCMF_DCMD_MAXLEN +
 			sizeof(struct brcmf_proto_cdc_dcmd) + ROUND_UP_MARGIN;
 	return 0;
 
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +4 -4
index 42e7642..d12aa75 100644
@@ -342,7 +342,7 @@ done:
 
 static s32 brcmf_dev_intvar_set(struct net_device *ndev, s8 *name, s32 val)
 {
-	s8 buf[BRCMF_C_DCMD_SMLEN];
+	s8 buf[BRCMF_DCMD_SMLEN];
 	u32 len;
 	s32 err = 0;
 	__le32 val_le;
@@ -363,7 +363,7 @@ static s32
 brcmf_dev_intvar_get(struct net_device *ndev, s8 *name, s32 *retval)
 {
 	union {
-		s8 buf[BRCMF_C_DCMD_SMLEN];
+		s8 buf[BRCMF_DCMD_SMLEN];
 		__le32 val;
 	} var;
 	u32 len;
@@ -451,7 +451,7 @@ brcmf_run_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan,
 	params = kzalloc(params_size, GFP_KERNEL);
 	if (!params)
 		return -ENOMEM;
-	BUG_ON(params_size >= BRCMF_C_DCMD_SMLEN);
+	BUG_ON(params_size >= BRCMF_DCMD_SMLEN);
 
 	wl_iscan_prep(&params->params_le, ssid);
 
@@ -460,7 +460,7 @@ brcmf_run_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan,
 	params->scan_duration = cpu_to_le16(0);
 
 	err = brcmf_dev_iovar_setbuf(iscan->ndev, "iscan", params, params_size,
-				     iscan->dcmd_buf, BRCMF_C_DCMD_SMLEN);
+				     iscan->dcmd_buf, BRCMF_DCMD_SMLEN);
 	if (err) {
 		if (err == -EBUSY)
 			WL_INFO("system busy : iscan canceled\n");
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h +2 -2
index 21c8f8e..e69f4f6 100644
@@ -106,7 +106,7 @@ do {								\
 #define WL_DCMD_LEN_MAX	1024
 #define WL_EXTRA_BUF_MAX	2048
 #define WL_ISCAN_BUF_MAX	2048	/*
-				 * the buf length can be BRCMF_C_DCMD_MAXLEN
+				 * the buf length can be BRCMF_DCMD_MAXLEN
 				 * to reduce iteration
 				 */
 #define WL_ISCAN_TIMER_INTERVAL_MS	3000
@@ -251,7 +251,7 @@ struct brcmf_cfg80211_iscan_ctrl {
 	struct work_struct work;
 	struct brcmf_cfg80211_iscan_eloop el;
 	void *data;
-	s8 dcmd_buf[BRCMF_C_DCMD_SMLEN];
+	s8 dcmd_buf[BRCMF_DCMD_SMLEN];
 	s8 scan_buf[WL_ISCAN_BUF_MAX];
 };
 
Signature · 1 line
1.7.1
#5 lore raw

Re: [PATCH 04/20] staging: brcm80211: various __iomem additions to softmac.

In reply to Franky Lin

2011/10/2 Franky Lin <[email protected]>:

Quoted 24 lines

From: Roland Vossen <[email protected]>

So it is clear to the reader what memory is IO mapped

---
 drivers/staging/brcm80211/brcmsmac/aiutils.c |  107 ++++++++++++++------------ drivers/staging/brcm80211/brcmsmac/aiutils.h |   16 ++-- drivers/staging/brcm80211/brcmsmac/main.c    |    2 +- drivers/staging/brcm80211/brcmsmac/nicpci.c  |   45 ++++++----- drivers/staging/brcm80211/brcmsmac/nicpci.h  |    9 +-

 drivers/staging/brcm80211/brcmsmac/otp.c     |    9 +-
 drivers/staging/brcm80211/brcmsmac/pmu.c     |   16 ++--
 drivers/staging/brcm80211/brcmsmac/srom.c    |   20 +++--
 drivers/staging/brcm80211/brcmsmac/srom.h    |    2 +-
 9 files changed, 123 insertions(+), 103 deletions(-)
drivers/staging/brcm80211/brcmsmac/aiutils.c +0 -0
index 790fdce..0b3ba6a 100644

drivers/staging/brcm80211/brcmsmac/aiutils.c line 327

Quoted 6 lines
drivers/staging/brcm80211/brcmsmac/aiutils.c +2 -1
@@ -323,7 +323,8 @@
                     (((si)->pub.buscoretype == PCI_CORE_ID) && \
                      (si)->pub.buscorerev >= 13))
 
-#define CCREGS_FAST(si) (((char *)((si)->curmap) + PCI_16KB0_CCREGS_OFFSET))
+#define CCREGS_FAST(si) (((char __iomem *)((si)->curmap) + \
+                         PCI_16KB0_CCREGS_OFFSET))

I've a question (not to just you), should we prefer u8/u16/u32 types in code? If so, you could think to changing this since you already touch this code.

Signature · 1 line
Rafał
#6 lore raw

Re: [PATCH 04/20] staging: brcm80211: various __iomem additions to softmac.

Quoted 7 lines · Rafał Miłecki

drivers/staging/brcm80211/brcmsmac/aiutils.c line 327

Quoted 3 lines
drivers/staging/brcm80211/brcmsmac/aiutils.c +2 -1
-#define CCREGS_FAST(si) (((char *)((si)->curmap) + PCI_16KB0_CCREGS_OFFSET))
+#define CCREGS_FAST(si) (((char __iomem *)((si)->curmap) + \
+                         PCI_16KB0_CCREGS_OFFSET))

I've a question (not to just you), should we prefer u8/u16/u32 types in code? If so, you could think to changing this since you already touch this code.

The char is just so that the addition works, the caller will have to cast it again. It's up to the author to decide.

If you're going to be doing bitwise operations then you can run into signedness bugs using char.

	printf("0x%x\n", (int) 0 | (char) -1);       /* 0xffffffff */
	printf("0x%x\n", (int) 0 | (unsigned char) -1);    /* 0xff */

Also if you are going to save hex digits to it, then it should be u8. You occasionally see bugs like this:

	char x = 0xff;

	if (x == 0xff)
		printf("dead code here.\n");
	else
		printf("signed chars only reach up to 0x7f\n");

regards,
dan carpenter