2011-09-02 14:00:55

by Roland Vossen

[permalink] [raw]
Subject: [PATCH 00/12] staging: brcm80211: 3rd reaction to mainline patch #2

Code cleanup and reduction of sparse warnings.

This series applies to staging-next and depends on the following patch set:

Message-ID: <[email protected]>

Arend van Spriel (5):
staging: brcm80211: remove extern keyword from function definition
staging: brcm80211: replace 0 integer with NULL pointer
staging: brcm80211: use address space qualifier in brcmfmac
staging: brcm80211: remove sparse warning from main.c
staging: brcm80211: remove 'default n' from Kconfig

Roland Vossen (7):
staging: brcm80211: cleaned up softmac phy macro's affecting code
flow
staging: brcm80211: cleaned up softmac nicpci.c/nicpci.h macro's
staging: brcm80211: cleaned up more softmac macro's
staging: brcm80211: remove AP related code from softmac
staging: brcm80211: cleaned up softmac pub.h macro's
staging: brcm80211: cleaned up softmac scb.h macro's
staging: brcm80211: cleaned up softmac srom macro

drivers/staging/brcm80211/Kconfig | 4 -
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 25 ++--
drivers/staging/brcm80211/brcmfmac/dhd.h | 2 +-
drivers/staging/brcm80211/brcmfmac/dhd_common.c | 8 +-
drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 4 +-
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 2 +-
drivers/staging/brcm80211/brcmsmac/ampdu.c | 2 +-
drivers/staging/brcm80211/brcmsmac/channel.c | 6 +-
drivers/staging/brcm80211/brcmsmac/main.c | 191 ++++++++++++---------
drivers/staging/brcm80211/brcmsmac/main.h | 4 +-
drivers/staging/brcm80211/brcmsmac/nicpci.c | 42 +++--
drivers/staging/brcm80211/brcmsmac/nicpci.h | 12 --
drivers/staging/brcm80211/brcmsmac/otp.c | 5 +-
drivers/staging/brcm80211/brcmsmac/otp.h | 6 -
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 6 +-
drivers/staging/brcm80211/brcmsmac/pmu.h | 13 --
drivers/staging/brcm80211/brcmsmac/pub.h | 173 ++-----------------
drivers/staging/brcm80211/brcmsmac/rate.h | 16 --
drivers/staging/brcm80211/brcmsmac/scb.h | 24 +--
drivers/staging/brcm80211/brcmsmac/srom.c | 22 +--
drivers/staging/brcm80211/brcmsmac/types.h | 5 -
21 files changed, 205 insertions(+), 367 deletions(-)

--
1.7.4.1




2011-09-02 14:00:58

by Roland Vossen

[permalink] [raw]
Subject: [PATCH 10/12] staging: brcm80211: cleaned up softmac pub.h macro's

Substituted/removed macro's.

Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Roland Vossen <[email protected]>
---
drivers/staging/brcm80211/brcmsmac/ampdu.c | 2 +-
drivers/staging/brcm80211/brcmsmac/channel.c | 6 +-
drivers/staging/brcm80211/brcmsmac/main.c | 84 +++++++++++++++++----
drivers/staging/brcm80211/brcmsmac/pub.h | 108 ++++----------------------
drivers/staging/brcm80211/brcmsmac/scb.h | 4 +-
5 files changed, 92 insertions(+), 112 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/ampdu.c b/drivers/staging/brcm80211/brcmsmac/ampdu.c
index cbf6c6d..7c44598 100644
--- a/drivers/staging/brcm80211/brcmsmac/ampdu.c
+++ b/drivers/staging/brcm80211/brcmsmac/ampdu.c
@@ -180,7 +180,7 @@ static int brcms_c_ampdu_set(struct ampdu_info *ampdu, bool on)
wlc->pub->_ampdu = false;

if (on) {
- if (!N_ENAB(wlc->pub)) {
+ if (!(wlc->pub->_n_enab & SUPPORT_11N)) {
wiphy_err(ampdu->wlc->wiphy, "wl%d: driver not "
"nmode enabled\n", wlc->pub->unit);
return -ENOTSUPP;
diff --git a/drivers/staging/brcm80211/brcmsmac/channel.c b/drivers/staging/brcm80211/brcmsmac/channel.c
index e6afdc9..282adce 100644
--- a/drivers/staging/brcm80211/brcmsmac/channel.c
+++ b/drivers/staging/brcm80211/brcmsmac/channel.c
@@ -1010,7 +1010,8 @@ brcms_c_set_country_common(struct brcms_cm_info *wlc_cm,
wlc->stf->no_cddstbc = true;
} else {
wlc->stf->no_cddstbc = false;
- if (N_ENAB(wlc->pub) != wlc->protection->nmode_user)
+ if ((wlc->pub->_n_enab & SUPPORT_11N) !=
+ wlc->protection->nmode_user)
brcms_c_set_nmode(wlc, wlc->protection->nmode_user);
}

@@ -1137,7 +1138,8 @@ brcms_c_channel_locale_flags_in_band(struct brcms_cm_info *wlc_cm,
static bool
brcms_c_quiet_chanspec(struct brcms_cm_info *wlc_cm, u16 chspec)
{
- return N_ENAB(wlc_cm->wlc->pub) && CHSPEC_IS40(chspec) ?
+ return (wlc_cm->wlc->pub->_n_enab & SUPPORT_11N) &&
+ CHSPEC_IS40(chspec) ?
(isset(wlc_cm->quiet_channels.vec,
LOWER_20_SB(CHSPEC_CHANNEL(chspec))) ||
isset(wlc_cm->quiet_channels.vec,
diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 4de57f4..4436b4f 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -271,6 +271,64 @@
#define WL_SPURAVOID_ON1 1
#define WL_SPURAVOID_ON2 2

+/* invalid core flags, use the saved coreflags */
+#define BRCMS_USE_COREFLAGS 0xffffffff
+
+/* values for PLCPHdr_override */
+#define BRCMS_PLCP_AUTO -1
+#define BRCMS_PLCP_SHORT 0
+#define BRCMS_PLCP_LONG 1
+
+/* values for g_protection_override and n_protection_override */
+#define BRCMS_PROTECTION_AUTO -1
+#define BRCMS_PROTECTION_OFF 0
+#define BRCMS_PROTECTION_ON 1
+#define BRCMS_PROTECTION_MMHDR_ONLY 2
+#define BRCMS_PROTECTION_CTS_ONLY 3
+
+/* values for g_protection_control and n_protection_control */
+#define BRCMS_PROTECTION_CTL_OFF 0
+#define BRCMS_PROTECTION_CTL_LOCAL 1
+#define BRCMS_PROTECTION_CTL_OVERLAP 2
+
+/* values for n_protection */
+#define BRCMS_N_PROTECTION_OFF 0
+#define BRCMS_N_PROTECTION_OPTIONAL 1
+#define BRCMS_N_PROTECTION_20IN40 2
+#define BRCMS_N_PROTECTION_MIXEDMODE 3
+
+/* values for band specific 40MHz capabilities */
+#define BRCMS_N_BW_20ALL 0
+#define BRCMS_N_BW_40ALL 1
+#define BRCMS_N_BW_20IN2G_40IN5G 2
+
+/* bitflags for SGI support (sgi_rx iovar) */
+#define BRCMS_N_SGI_20 0x01
+#define BRCMS_N_SGI_40 0x02
+
+/* defines used by the nrate iovar */
+/* MSC in use,indicates b0-6 holds an mcs */
+#define NRATE_MCS_INUSE 0x00000080
+/* rate/mcs value */
+#define NRATE_RATE_MASK 0x0000007f
+/* stf mode mask: siso, cdd, stbc, sdm */
+#define NRATE_STF_MASK 0x0000ff00
+/* stf mode shift */
+#define NRATE_STF_SHIFT 8
+/* bit indicates override both rate & mode */
+#define NRATE_OVERRIDE 0x80000000
+/* bit indicate to override mcs only */
+#define NRATE_OVERRIDE_MCS_ONLY 0x40000000
+#define NRATE_SGI_MASK 0x00800000 /* sgi mode */
+#define NRATE_SGI_SHIFT 23 /* sgi mode */
+#define NRATE_LDPC_CODING 0x00400000 /* bit indicates adv coding in use */
+#define NRATE_LDPC_SHIFT 22 /* ldpc shift */
+
+#define NRATE_STF_SISO 0 /* stf mode SISO */
+#define NRATE_STF_CDD 1 /* stf mode CDD */
+#define NRATE_STF_STBC 2 /* stf mode STBC */
+#define NRATE_STF_SDM 3 /* stf mode SDM */
+
/*
* 32 SSID chars, max of 4 chars for each SSID char "\xFF", plus NULL.
*/
@@ -3323,7 +3381,7 @@ static void brcms_c_bandinit_ordered(struct brcms_c_info *wlc,
/* fill in hw_rate */
brcms_c_rateset_filter(&default_rateset, &wlc->band->hw_rateset,
false, BRCMS_RATES_CCK_OFDM, BRCMS_RATE_MASK,
- (bool) N_ENAB(wlc->pub));
+ (bool) (wlc->pub->_n_enab & SUPPORT_11N));

/* init basic rate lookup */
brcms_c_rate_lookup_init(wlc, &default_rateset);
@@ -3608,14 +3666,14 @@ void brcms_c_mac_promisc(struct brcms_c_info *wlc)
* the MCTL_PROMISC bit since all BSS data traffic is
* directed at the AP
*/
- if (PROMISC_ENAB(wlc->pub))
+ if (wlc->pub->promisc)
promisc_bits |= MCTL_PROMISC;

/* monitor mode needs both MCTL_PROMISC and MCTL_KEEPCONTROL
* Note: monitor mode also needs MCTL_BCNS_PROMISC, but that is
* handled in brcms_c_mac_bcn_promisc()
*/
- if (MONITOR_ENAB(wlc))
+ if (wlc->monitor)
promisc_bits |= MCTL_PROMISC | MCTL_KEEPCONTROL;

brcms_c_mctrl(wlc, MCTL_PROMISC | MCTL_KEEPCONTROL, promisc_bits);
@@ -4925,10 +4983,10 @@ static void brcms_c_bss_default_init(struct brcms_c_info *wlc)
/* init bss rates to the band specific default rate set */
brcms_c_rateset_default(&bi->rateset, NULL, band->phytype,
band->bandtype, false, BRCMS_RATE_MASK_FULL,
- (bool) N_ENAB(wlc->pub), CHSPEC_WLC_BW(chanspec),
- wlc->stf->txstreams);
+ (bool) (wlc->pub->_n_enab & SUPPORT_11N),
+ CHSPEC_WLC_BW(chanspec), wlc->stf->txstreams);

- if (N_ENAB(wlc->pub))
+ if (wlc->pub->_n_enab & SUPPORT_11N)
bi->flags |= BRCMS_BSS_HT;
}

@@ -5139,7 +5197,7 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
brcms_c_rateset_filter(&wlc->band->defrateset,
&wlc->band->hw_rateset, false,
BRCMS_RATES_CCK_OFDM, BRCMS_RATE_MASK,
- (bool) N_ENAB(wlc->pub));
+ (bool) (wlc->pub->_n_enab & SUPPORT_11N));
}

/*
@@ -5194,8 +5252,6 @@ brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,

wlc->mimoft = FT_HT;
wlc->ht_cap.cap_info = HT_CAP;
- if (HT_ENAB(wlc->pub))
- wlc->stf->ldpc = AUTO;

wlc->mimo_40txbw = AUTO;
wlc->ofdm_40txbw = AUTO;
@@ -5843,7 +5899,7 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)
/* if N-support is enabled, allow Gmode set as long as requested
* Gmode is not GMODE_LEGACY_B
*/
- if (N_ENAB(wlc->pub) && gmode == GMODE_LEGACY_B)
+ if ((wlc->pub->_n_enab & SUPPORT_11N) && gmode == GMODE_LEGACY_B)
return -ENOTSUPP;

/* verify that we are dealing with 2G band and grab the band pointer */
@@ -6269,7 +6325,7 @@ _brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,
memcpy(&rs.rates, &in_rs->rates, rs.count);

/* merge rateset coming in with the current mcsset */
- if (N_ENAB(wlc->pub)) {
+ if (wlc->pub->_n_enab & SUPPORT_11N) {
struct brcms_bss_info *mcsset_bss;
if (bsscfg->associated)
mcsset_bss = current_bss;
@@ -6957,7 +7013,7 @@ mac80211_wlc_set_nrate(struct brcms_c_info *wlc, struct brcms_band *cur_band,
return (u32) rate;

/* validate the combination of rate/mcs/stf is allowed */
- if (N_ENAB(wlc->pub) && ismcs) {
+ if ((wlc->pub->_n_enab & SUPPORT_11N) && ismcs) {
/* mcs only allowed when nmode */
if (stf > PHY_TXC1_MODE_SDM) {
wiphy_err(wlc->wiphy, "wl%d: %s: Invalid stf\n",
@@ -7223,7 +7279,7 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,

phyctl1_stf = wlc->stf->ss_opmode;

- if (N_ENAB(wlc->pub)) {
+ if (wlc->pub->_n_enab & SUPPORT_11N) {
for (k = 0; k < hw->max_rates; k++) {
/*
* apply siso/cdd to single stream mcs's or ofdm
@@ -9287,7 +9343,7 @@ void brcms_default_rateset(struct brcms_c_info *wlc, struct brcms_c_rateset *rs)
{
brcms_c_rateset_default(rs, NULL, wlc->band->phytype,
wlc->band->bandtype, false, BRCMS_RATE_MASK_FULL,
- (bool) N_ENAB(wlc->pub),
+ (bool) (wlc->pub->_n_enab & SUPPORT_11N),
CHSPEC_WLC_BW(wlc->default_bss->chanspec),
wlc->stf->txstreams);
}
diff --git a/drivers/staging/brcm80211/brcmsmac/pub.h b/drivers/staging/brcm80211/brcmsmac/pub.h
index a56239a..f623d6e 100644
--- a/drivers/staging/brcm80211/brcmsmac/pub.h
+++ b/drivers/staging/brcm80211/brcmsmac/pub.h
@@ -293,22 +293,10 @@ enum wlc_par_id {
#define SUPPORT_HT (ENAB_1x1|ENAB_2x2|ENAB_3x3)

/* WL11N Support */
-#define N_ENAB(pub) ((pub)->_n_enab & SUPPORT_11N)
-#define N_REQD(pub) ((pub)->_n_reqd)
-
-#define HT_ENAB(pub) 0
-
#define AMPDU_AGG_HOST 1
-#define AMPDU_ENAB(pub) ((pub)->_ampdu)
-
-#define EDCF_ENAB(pub) (WME_ENAB(pub))
-#define QOS_ENAB(pub) (WME_ENAB(pub) || N_ENAB(pub))

-#define MONITOR_ENAB(wlc) ((wlc)->monitor)
-
-#define PROMISC_ENAB(wlc) ((wlc)->promisc)
-
-#define BRCMS_PREC_COUNT 16 /* Max precedence level implemented */
+#define EDCF_ENAB(pub) ((pub)->_wme != OFF)
+#define QOS_ENAB(pub) ((pub)->_wme != OFF || (pub)->_n_enab & SUPPORT_11N)

/* pri is priority encoded in the packet. This maps the Packet priority to
* enqueue precedence as defined in wlc_prec_map
@@ -316,6 +304,11 @@ enum wlc_par_id {
extern const u8 wlc_prio2prec_map[];
#define BRCMS_PRIO_TO_PREC(pri) wlc_prio2prec_map[(pri) & 7]

+#define BRCMS_PREC_COUNT 16 /* Max precedence level implemented */
+
+/* Mask to describe all precedence levels */
+#define BRCMS_PREC_BMP_ALL MAXBITVAL(BRCMS_PREC_COUNT)
+
/*
* This maps priority to one precedence higher - Used by PS-Poll response
* packets to simulate enqueue-at-head operation, but still maintain the
@@ -324,12 +317,6 @@ extern const u8 wlc_prio2prec_map[];
#define BRCMS_PRIO_TO_HI_PREC(pri) min(BRCMS_PRIO_TO_PREC(pri) + 1,\
BRCMS_PREC_COUNT - 1)

-extern const u8 wme_fifo2ac[];
-#define WME_PRIO2AC(prio) wme_fifo2ac[prio2fifo[(prio)]]
-
-/* Mask to describe all precedence levels */
-#define BRCMS_PREC_BMP_ALL MAXBITVAL(BRCMS_PREC_COUNT)
-
/* Define a bitmap of precedences comprised by each AC */
#define BRCMS_PREC_BMP_AC_BE (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_BE)) | \
NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_BE)) | \
@@ -348,14 +335,6 @@ extern const u8 wme_fifo2ac[];
NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_NC)) | \
NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_NC)))

-/* WME Support */
-#define WME_ENAB(pub) ((pub)->_wme != OFF)
-#define WME_AUTO(wlc) ((wlc)->pub->_wme == AUTO)
-
-/* invalid core flags, use the saved coreflags */
-#define BRCMS_USE_COREFLAGS 0xffffffff
-
-
/* network protection config */
#define BRCMS_PROT_G_SPEC 1 /* SPEC g protection */
#define BRCMS_PROT_G_OVR 2 /* SPEC g prot override */
@@ -409,67 +388,18 @@ extern const u8 wme_fifo2ac[];
#define GMODE_LRS 5
#define GMODE_MAX 6

-/* values for PLCPHdr_override */
-#define BRCMS_PLCP_AUTO -1
-#define BRCMS_PLCP_SHORT 0
-#define BRCMS_PLCP_LONG 1
-
-/* values for g_protection_override and n_protection_override */
-#define BRCMS_PROTECTION_AUTO -1
-#define BRCMS_PROTECTION_OFF 0
-#define BRCMS_PROTECTION_ON 1
-#define BRCMS_PROTECTION_MMHDR_ONLY 2
-#define BRCMS_PROTECTION_CTS_ONLY 3
-
-/* values for g_protection_control and n_protection_control */
-#define BRCMS_PROTECTION_CTL_OFF 0
-#define BRCMS_PROTECTION_CTL_LOCAL 1
-#define BRCMS_PROTECTION_CTL_OVERLAP 2
-
-/* values for n_protection */
-#define BRCMS_N_PROTECTION_OFF 0
-#define BRCMS_N_PROTECTION_OPTIONAL 1
-#define BRCMS_N_PROTECTION_20IN40 2
-#define BRCMS_N_PROTECTION_MIXEDMODE 3
-
-/* values for band specific 40MHz capabilities */
-#define BRCMS_N_BW_20ALL 0
-#define BRCMS_N_BW_40ALL 1
-#define BRCMS_N_BW_20IN2G_40IN5G 2
-
-/* bitflags for SGI support (sgi_rx iovar) */
-#define BRCMS_N_SGI_20 0x01
-#define BRCMS_N_SGI_40 0x02
-
-/* defines used by the nrate iovar */
-/* MSC in use,indicates b0-6 holds an mcs */
-#define NRATE_MCS_INUSE 0x00000080
-/* rate/mcs value */
-#define NRATE_RATE_MASK 0x0000007f
-/* stf mode mask: siso, cdd, stbc, sdm */
-#define NRATE_STF_MASK 0x0000ff00
-/* stf mode shift */
-#define NRATE_STF_SHIFT 8
-/* bit indicates override both rate & mode */
-#define NRATE_OVERRIDE 0x80000000
-/* bit indicate to override mcs only */
-#define NRATE_OVERRIDE_MCS_ONLY 0x40000000
-#define NRATE_SGI_MASK 0x00800000 /* sgi mode */
-#define NRATE_SGI_SHIFT 23 /* sgi mode */
-#define NRATE_LDPC_CODING 0x00400000 /* bit indicates adv coding in use */
-#define NRATE_LDPC_SHIFT 22 /* ldpc shift */
-
-#define NRATE_STF_SISO 0 /* stf mode SISO */
-#define NRATE_STF_CDD 1 /* stf mode CDD */
-#define NRATE_STF_STBC 2 /* stf mode STBC */
-#define NRATE_STF_SDM 3 /* stf mode SDM */
+/* MCS values greater than this enable multiple streams */
+#define HIGHEST_SINGLE_STREAM_MCS 7
+
+#define MAXBANDS 2 /* Maximum #of bands */
+
+/* bandstate array indices */
+#define BAND_2G_INDEX 0 /* wlc->bandstate[x] index */
+#define BAND_5G_INDEX 1 /* wlc->bandstate[x] index */

/* max number of antenna configurations */
#define ANT_SELCFG_MAX 4

-/* MCS values greater than this enable multiple streams */
-#define HIGHEST_SINGLE_STREAM_MCS 7
-
struct brcms_antselcfg {
u8 ant_config[ANT_SELCFG_MAX]; /* antenna configuration */
u8 num_antcfg; /* number of available antenna configurations */
@@ -559,12 +489,4 @@ extern void brcms_c_wait_for_tx_completion(struct brcms_c_info *wlc,
extern bool brcms_c_check_radio_disabled(struct brcms_c_info *wlc);
extern bool brcms_c_radio_monitor_stop(struct brcms_c_info *wlc);

-#define MAXBANDS 2 /* Maximum #of bands */
-/* bandstate array indices */
-#define BAND_2G_INDEX 0 /* wlc->bandstate[x] index */
-#define BAND_5G_INDEX 1 /* wlc->bandstate[x] index */
-
-#define BAND_2G_NAME "2.4G"
-#define BAND_5G_NAME "5G"
-
#endif /* _BRCM_PUB_H_ */
diff --git a/drivers/staging/brcm80211/brcmsmac/scb.h b/drivers/staging/brcm80211/brcmsmac/scb.h
index efa5047..3fe9cf2 100644
--- a/drivers/staging/brcm80211/brcmsmac/scb.h
+++ b/drivers/staging/brcm80211/brcmsmac/scb.h
@@ -75,11 +75,11 @@ struct scb {
};

/* scb flags */
-#define SCB_WMECAP 0x0040 /* may ONLY be set if WME_ENAB(wlc) */
+#define SCB_WMECAP 0x0040 /* may ONLY be set if pub->_wme!=OFF */
#define SCB_HTCAP 0x10000 /* HT (MIMO) capable device */
#define SCB_IS40 0x80000 /* 40MHz capable */
#define SCB_STBCCAP 0x40000000 /* STBC Capable */
-#define SCB_WME(a) ((a)->flags & SCB_WMECAP)/* implies WME_ENAB */
+#define SCB_WME(a) ((a)->flags & SCB_WMECAP)/* implies WME enab */
#define SCB_SEQNUM(scb, prio) ((scb)->seqnum[(prio)])
#define SCB_PS(a) NULL
#define SCB_STBC_CAP(a) ((a)->flags & SCB_STBCCAP)
--
1.7.4.1



2011-09-02 14:00:55

by Roland Vossen

[permalink] [raw]
Subject: [PATCH 12/12] staging: brcm80211: cleaned up softmac srom macro

Substituted macro.

Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Roland Vossen <[email protected]>
---
drivers/staging/brcm80211/brcmsmac/srom.c | 22 +++++++++-------------
1 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/srom.c b/drivers/staging/brcm80211/brcmsmac/srom.c
index c8f6897..165b88d 100644
--- a/drivers/staging/brcm80211/brcmsmac/srom.c
+++ b/drivers/staging/brcm80211/brcmsmac/srom.c
@@ -28,18 +28,6 @@
#include "otp.h"
#include "srom.h"

-#define SROM_OFFSET(sih) ((sih->ccrev > 31) ? \
- (((sih->cccaps & CC_CAP_SROM) == 0) ? NULL : \
- ((u8 *)curmap + PCI_16KB0_CCREGS_OFFSET + CC_SROM_OTP)) : \
- ((u8 *)curmap + PCI_BAR0_SPROM_OFFSET))
-
-#if defined(BCMDBG)
-/* 500 ms after write enable/disable toggle */
-#define WRITE_ENABLE_DELAY 500
-/* 20 ms between each word write */
-#define WRITE_WORD_DELAY 20
-#endif
-
/*
* SROM CRC8 polynomial value:
*
@@ -792,6 +780,14 @@ static const struct brcms_sromvar perpath_pci_sromvars[] = {

static u8 srom_crc8_table[CRC8_TABLE_SIZE];

+static u8 *srom_window_address(struct si_pub *sih, void *curmap)
+{
+ return sih->ccrev > 31 ?
+ (((sih->cccaps & CC_CAP_SROM) == 0) ? NULL :
+ ((u8 *)curmap + PCI_16KB0_CCREGS_OFFSET + CC_SROM_OTP)) :
+ ((u8 *)curmap + PCI_BAR0_SPROM_OFFSET);
+}
+
/* Parse SROM and create name=value pairs. 'srom' points to
* the SROM word array. 'off' specifies the offset of the
* first word 'srom' points to, which should be either 0 or
@@ -1147,7 +1143,7 @@ static int initvars_srom_pci(struct si_pub *sih, void *curmap, char **vars,
if (!srom)
return -ENOMEM;

- sromwindow = (u16 *) SROM_OFFSET(sih);
+ sromwindow = (u16 *) srom_window_address(sih, curmap);

crc8_populate_lsb(srom_crc8_table, SROM_CRC8_POLY);
if (ai_is_sprom_available(sih)) {
--
1.7.4.1



2011-09-02 14:00:58

by Roland Vossen

[permalink] [raw]
Subject: [PATCH 08/12] staging: brcm80211: cleaned up more softmac macro's

Substituted/removed macro's.

Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Roland Vossen <[email protected]>
---
drivers/staging/brcm80211/brcmsmac/main.c | 18 ++++++++++
drivers/staging/brcm80211/brcmsmac/main.h | 1 -
drivers/staging/brcm80211/brcmsmac/otp.c | 5 ++-
drivers/staging/brcm80211/brcmsmac/otp.h | 6 ---
drivers/staging/brcm80211/brcmsmac/pmu.h | 13 --------
drivers/staging/brcm80211/brcmsmac/pub.h | 49 -----------------------------
6 files changed, 21 insertions(+), 71 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 9e73b42..fff3ba9 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -267,6 +267,20 @@
#define APHY_SLOT_TIME 9
#define BPHY_SLOT_TIME 20

+#define WL_SPURAVOID_OFF 0
+#define WL_SPURAVOID_ON1 1
+#define WL_SPURAVOID_ON2 2
+
+/*
+ * 32 SSID chars, max of 4 chars for each SSID char "\xFF", plus NULL.
+ */
+#define SSID_FMT_BUF_LEN ((4 * IEEE80211_MAX_SSID_LEN) + 1)
+
+/* defaults for the HT (MIMO) bss */
+#define HT_CAP (IEEE80211_HT_CAP_SM_PS |\
+ IEEE80211_HT_CAP_SUP_WIDTH_20_40 | IEEE80211_HT_CAP_GRN_FLD |\
+ IEEE80211_HT_CAP_MAX_AMSDU | IEEE80211_HT_CAP_DSSSCCK40)
+
/*
* The following table lists the buffer memory allocated to xmt fifos in HW.
* the size is in units of 256bytes(one block), total size is HW dependent
@@ -361,6 +375,10 @@
#define IS_MBAND_UNLOCKED(wlc) \
((wlc->pub->_nbands > 1) && !(wlc)->bandlocked)

+#define CHSPEC_WLC_BW(chanspec) (CHSPEC_IS40(chanspec) ? BRCMS_40_MHZ : \
+ CHSPEC_IS20(chanspec) ? BRCMS_20_MHZ : \
+ BRCMS_10_MHZ)
+
/* dup state between BMAC(struct brcms_hardware) and HIGH(struct brcms_c_info)
driver */
struct brcms_b_state {
diff --git a/drivers/staging/brcm80211/brcmsmac/main.h b/drivers/staging/brcm80211/brcmsmac/main.h
index e8a854b..047c422 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.h
+++ b/drivers/staging/brcm80211/brcmsmac/main.h
@@ -23,7 +23,6 @@
#include "types.h"
#include "d11.h"

-#define MA_WINDOW_SZ 8 /* moving average window size */
#define INVCHANNEL 255 /* invalid channel */

/* max # brcms_c_module_register() calls */
diff --git a/drivers/staging/brcm80211/brcmsmac/otp.c b/drivers/staging/brcm80211/brcmsmac/otp.c
index 1e0093c..05c78c7 100644
--- a/drivers/staging/brcm80211/brcmsmac/otp.c
+++ b/drivers/staging/brcm80211/brcmsmac/otp.c
@@ -64,6 +64,9 @@

#define MAXNUMRDES 9 /* Maximum OTP redundancy entries */

+/* Fixed size subregions sizes in words */
+#define OTPGU_CI_SZ 2
+
/* OTP function struct */
struct otp_fn_s {
int (*size)(struct otpinfo *oi);
@@ -111,8 +114,6 @@ static struct otpinfo otpinfo;
*
*/

-#define HWSW_RGN(rgn) (((rgn) == OTP_HW_RGN) ? "h/w" : "s/w")
-
/* OTP layout */
/* CC revs 21, 24 and 27 OTP General Use Region word offset */
#define REVA4_OTPGU_BASE 12
diff --git a/drivers/staging/brcm80211/brcmsmac/otp.h b/drivers/staging/brcm80211/brcmsmac/otp.h
index 938100e..bf2f76f 100644
--- a/drivers/staging/brcm80211/brcmsmac/otp.h
+++ b/drivers/staging/brcm80211/brcmsmac/otp.h
@@ -30,12 +30,6 @@
/* OTP Size */
#define OTP_SZ_MAX (6144/8) /* maximum bytes in one CIS */

-/* Fixed size subregions sizes in words */
-#define OTPGU_CI_SZ 2
-
-/* OTP usage */
-#define OTP4325_FM_DISABLED_OFFSET 188
-
struct otpinfo;

/* Exported functions */
diff --git a/drivers/staging/brcm80211/brcmsmac/pmu.h b/drivers/staging/brcm80211/brcmsmac/pmu.h
index 0c7e48c..2917e6f 100644
--- a/drivers/staging/brcm80211/brcmsmac/pmu.h
+++ b/drivers/staging/brcm80211/brcmsmac/pmu.h
@@ -19,19 +19,6 @@
#define _BRCM_PMU_H_

#include "types.h"
-/*
- * LDO selections used in si_pmu_set_ldo_voltage
- */
-#define SET_LDO_VOLTAGE_LDO1 1
-#define SET_LDO_VOLTAGE_LDO2 2
-#define SET_LDO_VOLTAGE_LDO3 3
-#define SET_LDO_VOLTAGE_PAREF 4
-#define SET_LDO_VOLTAGE_CLDO_PWM 5
-#define SET_LDO_VOLTAGE_CLDO_BURST 6
-#define SET_LDO_VOLTAGE_CBUCK_PWM 7
-#define SET_LDO_VOLTAGE_CBUCK_BURST 8
-#define SET_LDO_VOLTAGE_LNLDO1 9
-#define SET_LDO_VOLTAGE_LNLDO2_SEL 10

extern u16 si_pmu_fast_pwrup_delay(struct si_pub *sih);
extern void si_pmu_sprom_enable(struct si_pub *sih, bool enable);
diff --git a/drivers/staging/brcm80211/brcmsmac/pub.h b/drivers/staging/brcm80211/brcmsmac/pub.h
index 5bca2fb..ab2fb11 100644
--- a/drivers/staging/brcm80211/brcmsmac/pub.h
+++ b/drivers/staging/brcm80211/brcmsmac/pub.h
@@ -40,10 +40,6 @@
#define BRCMS_20_MHZ 20 /* 20Mhz nphy channel bandwidth */
#define BRCMS_40_MHZ 40 /* 40Mhz nphy channel bandwidth */

-#define CHSPEC_WLC_BW(chanspec) (CHSPEC_IS40(chanspec) ? BRCMS_40_MHZ : \
- CHSPEC_IS20(chanspec) ? BRCMS_20_MHZ : \
- BRCMS_10_MHZ)
-
#define BRCMS_RSSI_MINVAL -200 /* Low value, e.g. for forcing roam */
#define BRCMS_RSSI_NO_SIGNAL -91 /* NDIS RSSI link quality cutoffs */
#define BRCMS_RSSI_VERY_LOW -80 /* Very low quality cutoffs */
@@ -52,13 +48,6 @@
#define BRCMS_RSSI_VERY_GOOD -58 /* Very good quality cutoffs */
#define BRCMS_RSSI_EXCELLENT -57 /* Excellent quality cutoffs */

-/* macro to perform PHY -> D11 PHY TYPE, currently 1:1 */
-#define BRCMS_PHYTYPE(_x) (_x)
-
-#define MA_WINDOW_SZ 8 /* moving average window size */
-
-#define BRCMS_SNR_INVALID 0 /* invalid SNR value */
-
/* a large TX Power as an init value to factor out of min() calculations,
* keep low enough to fit in an s8, units are .25 dBm
*/
@@ -87,9 +76,6 @@
/* driver's default tx antenna setting */
#define ANT_TX_DEF 3

-/* use all available core for transmit */
-#define TXCORE_POLICY_ALL 0x1
-
/* Tx Chain values */
/* def bitmap of txchain */
#define TXCHAIN_DEF 0x1
@@ -113,15 +99,9 @@
#define ANTSWITCH_TYPE_3 3

#define RXBUFSZ PKTBUFSZ
-/* aid bitmap size in bytes */
-#define AIDMAPSZ (roundup(MAXSCB, NBBY)/NBBY)

#define MAX_STREAMS_SUPPORTED 4 /* max number of streams supported */

-#define WL_SPURAVOID_OFF 0
-#define WL_SPURAVOID_ON1 1
-#define WL_SPURAVOID_ON2 2
-
struct brcms_tunables {
int ntxd; /* size of tx descriptor table */
int nrxd; /* size of rx descriptor table */
@@ -158,24 +138,11 @@ struct rsn_parms {
u8 PAD[4]; /* padding for future growth */
};

-/*
- * 32 SSID chars, max of 4 chars for each SSID char "\xFF", plus NULL.
- */
-#define SSID_FMT_BUF_LEN ((4 * IEEE80211_MAX_SSID_LEN) + 1)
-
-#define RSN_FLAGS_SUPPORTED 0x1 /* Flag for rsn_params */
-#define RSN_FLAGS_PREAUTH 0x2 /* Flag for WPA2 rsn_params */
-
/* All the HT-specific default advertised capabilities (including AMPDU)
* should be grouped here at one place
*/
#define AMPDU_DEF_MPDU_DENSITY 6 /* default mpdu density (110 ==> 4us) */

-/* defaults for the HT (MIMO) bss */
-#define HT_CAP (IEEE80211_HT_CAP_SM_PS |\
- IEEE80211_HT_CAP_SUP_WIDTH_20_40 | IEEE80211_HT_CAP_GRN_FLD |\
- IEEE80211_HT_CAP_MAX_AMSDU | IEEE80211_HT_CAP_DSSSCCK40)
-
/* wlc internal bss_info */
struct brcms_bss_info {
u8 BSSID[ETH_ALEN]; /* network BSSID */
@@ -202,22 +169,6 @@ struct brcms_bss_info {
u8 wpacfg; /* wpa config index */
};

-/* IOVar flags for common error checks */
-#define IOVF_MFG (1<<3) /* flag for mfgtest iovars */
-#define IOVF_WHL (1<<4) /* value must be whole (0-max) */
-#define IOVF_NTRL (1<<5) /* value must be natural (1-max) */
-
-#define IOVF_SET_UP (1<<6) /* set requires driver be up */
-#define IOVF_SET_DOWN (1<<7) /* set requires driver be down */
-#define IOVF_SET_CLK (1<<8) /* set requires core clock */
-#define IOVF_SET_BAND (1<<9) /* set requires fixed band */
-
-#define IOVF_GET_UP (1<<10) /* get requires driver be up */
-#define IOVF_GET_DOWN (1<<11) /* get requires driver be down */
-#define IOVF_GET_CLK (1<<12) /* get requires core clock */
-#define IOVF_GET_BAND (1<<13) /* get requires fixed band */
-#define IOVF_OPEN_ALLOW (1<<14) /* set allowed iovar for opensrc */
-
#define MAC80211_PROMISC_BCNS (1 << 0)
#define MAC80211_SCAN (1 << 1)

--
1.7.4.1



2011-09-02 14:01:02

by Roland Vossen

[permalink] [raw]
Subject: [PATCH 01/12] staging: brcm80211: remove extern keyword from function definition

From: Arend van Spriel <[email protected]>

Sparse warning was given when using the extern keyword in the function
definition. This patch removes those instances.

Reported-by: Aaro Koskinen <[email protected]>
Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
Reviewed-by: Roland Vossen <[email protected]>
Signed-off-by: Roland Vossen <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 25 +++++++++-----------
1 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index 5482005..6adf5c0 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -76,9 +76,8 @@ brcmf_pm_resume_wait(struct brcmf_sdio_dev *sdiodev, wait_queue_head_t wq)
#endif
}

-extern int
-brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, uint func,
- uint regaddr, u8 *byte)
+int brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, uint func,
+ uint regaddr, u8 *byte)
{
int err_ret;

@@ -173,9 +172,9 @@ brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, uint func,
return err_ret;
}

-extern int
-brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev, uint rw,
- uint func, uint addr, u32 *word, uint nbytes)
+int brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev,
+ uint rw, uint func, uint addr, u32 *word,
+ uint nbytes)
{
int err_ret = -EIO;

@@ -304,11 +303,10 @@ brcmf_sdioh_request_packet(struct brcmf_sdio_dev *sdiodev, uint fix_inc,
* aligned packet.
*
*/
-extern int
-brcmf_sdioh_request_buffer(struct brcmf_sdio_dev *sdiodev,
- uint fix_inc, uint write, uint func, uint addr,
- uint reg_width, uint buflen_u, u8 *buffer,
- struct sk_buff *pkt)
+int brcmf_sdioh_request_buffer(struct brcmf_sdio_dev *sdiodev,
+ uint fix_inc, uint write, uint func, uint addr,
+ uint reg_width, uint buflen_u, u8 *buffer,
+ struct sk_buff *pkt)
{
int Status;
struct sk_buff *mypkt = NULL;
@@ -425,9 +423,8 @@ static int brcmf_sdioh_get_cisaddr(struct brcmf_sdio_dev *sdiodev, u32 regaddr)
return scratch;
}

-extern int
-brcmf_sdioh_cis_read(struct brcmf_sdio_dev *sdiodev, uint func,
- u8 *cisd, u32 length)
+int brcmf_sdioh_cis_read(struct brcmf_sdio_dev *sdiodev, uint func,
+ u8 *cisd, u32 length)
{
u32 count;
int offset;
--
1.7.4.1



2011-09-02 15:49:25

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 12/12] staging: brcm80211: cleaned up softmac srom macro

On Fri, 2011-09-02 at 16:00 +0200, Roland Vossen wrote:
> Substituted macro.
[]
> diff --git a/drivers/staging/brcm80211/brcmsmac/srom.c b/drivers/staging/brcm80211/brcmsmac/srom.c
[]
> @@ -792,6 +780,14 @@ static const struct brcms_sromvar perpath_pci_sromvars[] = {
>
> static u8 srom_crc8_table[CRC8_TABLE_SIZE];
>
> +static u8 *srom_window_address(struct si_pub *sih, void *curmap)
> +{
> + return sih->ccrev > 31 ?
> + (((sih->cccaps & CC_CAP_SROM) == 0) ? NULL :
> + ((u8 *)curmap + PCI_16KB0_CCREGS_OFFSET + CC_SROM_OTP)) :
> + ((u8 *)curmap + PCI_BAR0_SPROM_OFFSET);
> +}

Please try to make code more readable when
converting to functions too.

Maybe:

static u16 *srom_window_address(struct si_pub *sih, u8 *curmap)
{
if (sih->ccrev < 32)
return (u16 *)(curmap + PCI_BAR0_SPROM_OFFSET);
if (sih->cccaps & CC_CAP_SROM)
return (u16 *)(curmap + PCI_16KB0_CCREGS_OFFSET + CC_SROM_OTP);

return NULL;
}
> @@ -1147,7 +1143,7 @@ static int initvars_srom_pci(struct si_pub *sih, void *curmap, char **vars,
> if (!srom)
> return -ENOMEM;
>
> - sromwindow = (u16 *) SROM_OFFSET(sih);
> + sromwindow = (u16 *) srom_window_address(sih, curmap);

sromwindow = srom_window_address(sih, curmap)



2011-09-02 14:00:57

by Roland Vossen

[permalink] [raw]
Subject: [PATCH 05/12] staging: brcm80211: remove 'default n' from Kconfig

From: Arend van Spriel <[email protected]>

Kconfig options are by default not selected so adding the
statement 'default n' to the option is not needed.

Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Signed-off-by: Roland Vossen <[email protected]>
---
drivers/staging/brcm80211/Kconfig | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/brcm80211/Kconfig b/drivers/staging/brcm80211/Kconfig
index 59e9c85..f51e0f1 100644
--- a/drivers/staging/brcm80211/Kconfig
+++ b/drivers/staging/brcm80211/Kconfig
@@ -1,10 +1,8 @@
config BRCMUTIL
tristate
- default n

config BRCMSMAC
tristate "Broadcom IEEE802.11n PCIe SoftMAC WLAN driver"
- default n
depends on PCI
depends on WLAN && MAC80211
depends on BCMA=n
@@ -20,7 +18,6 @@ config BRCMSMAC

config BRCMFMAC
tristate "Broadcom IEEE802.11n embedded FullMAC WLAN driver"
- default n
depends on MMC
depends on WLAN && CFG80211
select BRCMUTIL
@@ -33,7 +30,6 @@ config BRCMFMAC

config BRCMDBG
bool "Broadcom driver debug functions"
- default n
depends on BRCMSMAC || BRCMFMAC
---help---
Selecting this enables additional code for debug purposes.
--
1.7.4.1



2011-09-02 14:00:58

by Roland Vossen

[permalink] [raw]
Subject: [PATCH 06/12] staging: brcm80211: cleaned up softmac phy macro's affecting code flow

Substituted macro's.

Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Roland Vossen <[email protected]>
---
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c | 6 ++++--
drivers/staging/brcm80211/brcmsmac/types.h | 5 -----
2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
index b52b305..5f30de2 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c
@@ -204,7 +204,8 @@ u16 read_radio_reg(struct brcms_phy *pi, u16 addr)

switch (pi->pubpi.phy_type) {
case PHY_TYPE_N:
- CASECHECK(PHYTYPE, PHY_TYPE_N);
+ if (!CONF_HAS(PHYTYPE, PHY_TYPE_N))
+ break;
if (NREV_GE(pi->pubpi.phy_rev, 7))
addr |= RADIO_2057_READ_OFF;
else
@@ -212,7 +213,8 @@ u16 read_radio_reg(struct brcms_phy *pi, u16 addr)
break;

case PHY_TYPE_LCN:
- CASECHECK(PHYTYPE, PHY_TYPE_LCN);
+ if (!CONF_HAS(PHYTYPE, PHY_TYPE_LCN))
+ break;
addr |= RADIO_2064_READ_OFF;
break;

diff --git a/drivers/staging/brcm80211/brcmsmac/types.h b/drivers/staging/brcm80211/brcmsmac/types.h
index cf65f6e..792df07 100644
--- a/drivers/staging/brcm80211/brcmsmac/types.h
+++ b/drivers/staging/brcm80211/brcmsmac/types.h
@@ -220,11 +220,6 @@
#define PHYTYPE_IS(var, val)\
(PHYCONF_HAS(val) && (PHYCONF_IS(val) || ((var) == (val))))

-/* Finally, early-exit from switch case if anyone wants it... */
-
-#define CASECHECK(config, val) if (!(CONF_HAS(config, val))) break
-#define CASEMSK(config, mask) if (!(CONF_MSK(config, mask))) break
-
/* Set up PHYTYPE automatically: (depends on PHY_TYPE_X, from d11.h) */

#define _PHYCONF_N (1 << PHY_TYPE_N)
--
1.7.4.1



2011-09-02 14:00:55

by Roland Vossen

[permalink] [raw]
Subject: [PATCH 02/12] staging: brcm80211: replace 0 integer with NULL pointer

From: Arend van Spriel <[email protected]>

Running sparse showed following warning: Using plain integer as NULL
pointer. This has been fixed.

Reported-by: Aaro Koskinen <[email protected]>
Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
Reviewed-by: Roland Vossen <[email protected]>
Signed-off-by: Roland Vossen <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd_common.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_common.c b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
index 3abd434..cb7393c 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_common.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
@@ -840,7 +840,7 @@ brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg, int enable,
const char *str;
int buf_len;
int str_len;
- char *arg_save = 0, *arg_org = 0;
+ char *arg_save = NULL, *arg_org = NULL;
int rc;
char buf[128];
struct brcmf_pkt_filter_enable enable_parm;
@@ -915,9 +915,9 @@ void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg)
int rc;
u32 mask_size;
u32 pattern_size;
- char *argv[8], *buf = 0;
+ char *argv[8], *buf = NULL;
int i = 0;
- char *arg_save = 0, *arg_org = 0;
+ char *arg_save = NULL, *arg_org = NULL;

arg_save = kstrdup(arg, GFP_ATOMIC);
if (!arg_save) {
@@ -1099,7 +1099,7 @@ int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr)
/* query for 'ver' to get version info from firmware */
memset(buf, 0, sizeof(buf));
ptr = buf;
- brcmu_mkiovar("ver", 0, 0, buf, sizeof(buf));
+ brcmu_mkiovar("ver", NULL, 0, buf, sizeof(buf));
brcmf_proto_cdc_query_ioctl(drvr, 0, BRCMF_C_GET_VAR, buf, sizeof(buf));
strsep(&ptr, "\n");
/* Print fw version info */
--
1.7.4.1



2011-09-02 14:00:55

by Roland Vossen

[permalink] [raw]
Subject: [PATCH 09/12] staging: brcm80211: remove AP related code from softmac

AP support was only partially implemented and never invoked.
AP related code sections removed.

Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Roland Vossen <[email protected]>
---
drivers/staging/brcm80211/brcmsmac/main.c | 64 ++++-------------------------
drivers/staging/brcm80211/brcmsmac/pub.h | 11 +-----
2 files changed, 10 insertions(+), 65 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index fff3ba9..4de57f4 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -193,7 +193,7 @@
* for maintenance tasks such as phy calibration and scb update
*/

-#define BRCMS_WAR16165(wlc) ((!AP_ENAB(wlc->pub)) && (wlc->war16165))
+#define BRCMS_WAR16165(wlc) (wlc->war16165)

/* Find basic rate for a given rate */
#define BRCMS_BASIC_RATE(wlc, rspec) \
@@ -780,11 +780,6 @@ bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded)

WARN_ON(macintstatus & MI_PRQ); /* PRQ Interrupt in non-MBSS */

- /* BCN template is available */
- if (AP_ENAB(wlc->pub) && (!APSTA_ENAB(wlc->pub))
- && (macintstatus & MI_BCNTPL))
- brcms_c_update_beacon(wlc);
-
/* tx status */
if (macintstatus & MI_TFS) {
if (brcms_b_txstatus(wlc->hw, bounded, &fatal))
@@ -3596,8 +3591,7 @@ void brcms_c_mac_bcn_promisc_change(struct brcms_c_info *wlc, bool promisc)

void brcms_c_mac_bcn_promisc(struct brcms_c_info *wlc)
{
- if ((AP_ENAB(wlc->pub) && (N_ENAB(wlc->pub) || wlc->band->gmode)) ||
- wlc->bcnmisc_ibss || wlc->bcnmisc_scan || wlc->bcnmisc_monitor)
+ if (wlc->bcnmisc_ibss || wlc->bcnmisc_scan || wlc->bcnmisc_monitor)
brcms_c_mctrl(wlc, MCTL_BCNS_PROMISC, MCTL_BCNS_PROMISC);
else
brcms_c_mctrl(wlc, MCTL_BCNS_PROMISC, 0);
@@ -3614,7 +3608,7 @@ void brcms_c_mac_promisc(struct brcms_c_info *wlc)
* the MCTL_PROMISC bit since all BSS data traffic is
* directed at the AP
*/
- if (PROMISC_ENAB(wlc->pub) && !AP_ENAB(wlc->pub))
+ if (PROMISC_ENAB(wlc->pub))
promisc_bits |= MCTL_PROMISC;

/* monitor mode needs both MCTL_PROMISC and MCTL_KEEPCONTROL
@@ -4129,11 +4123,6 @@ void brcms_c_edcf_setparams(struct brcms_c_info *wlc, bool suspend)
if (suspend)
brcms_c_suspend_mac_and_wait(wlc);

- if (AP_ENAB(wlc->pub) && WME_ENAB(wlc->pub)) {
- brcms_c_update_beacon(wlc);
- brcms_c_update_probe_resp(wlc, false);
- }
-
if (suspend)
brcms_c_enable_mac(wlc);

@@ -4146,11 +4135,8 @@ static void brcms_c_down_led_upd(struct brcms_c_info *wlc)
* maintain LEDs while in down state, turn on sbclk if
* not available yet. Turn on sbclk if necessary
*/
- if (!AP_ENAB(wlc->pub)) {
- brcms_c_pllreq(wlc, true, BRCMS_PLLREQ_FLIP);
-
- brcms_c_pllreq(wlc, false, BRCMS_PLLREQ_FLIP);
- }
+ brcms_c_pllreq(wlc, true, BRCMS_PLLREQ_FLIP);
+ brcms_c_pllreq(wlc, false, BRCMS_PLLREQ_FLIP);
}

static bool brcms_c_radio_monitor_start(struct brcms_c_info *wlc)
@@ -5394,12 +5380,8 @@ uint brcms_c_detach(struct brcms_c_info *wlc)
/* update state that depends on the current value of "ap" */
void brcms_c_ap_upd(struct brcms_c_info *wlc)
{
- if (AP_ENAB(wlc->pub))
- /* AP: short not allowed, but not enforced */
- wlc->PLCPHdr_override = BRCMS_PLCP_AUTO;
- else
- /* STA-BSS; short capable */
- wlc->PLCPHdr_override = BRCMS_PLCP_SHORT;
+ /* STA-BSS; short capable */
+ wlc->PLCPHdr_override = BRCMS_PLCP_SHORT;

/* fixup mpc */
wlc->mpc = true;
@@ -5678,10 +5660,6 @@ int brcms_c_up(struct brcms_c_info *wlc)

brcms_b_up_finish(wlc->hw);

- /* other software states up after ISR is running */
- /* start APs that were to be brought up but are not up yet */
- /* if (AP_ENAB(wlc->pub)) brcms_c_restart_ap(wlc->ap); */
-
/* Program the TX wme params with the current settings */
brcms_c_wme_retries_write(wlc);

@@ -5900,9 +5878,6 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)
break;

case GMODE_LRS:
- if (AP_ENAB(wlc->pub))
- brcms_c_rateset_copy(&cck_rates,
- &wlc->sup_rates_override);
break;

case GMODE_AUTO:
@@ -5916,11 +5891,6 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)
break;

case GMODE_PERFORMANCE:
- if (AP_ENAB(wlc->pub))
- /* Put all rates into the Supported Rates element */
- brcms_c_rateset_copy(&cck_ofdm_rates,
- &wlc->sup_rates_override);
-
shortslot = BRCMS_SHORTSLOT_ON;
shortslot_restrict = true;
ofdm_basic = true;
@@ -5953,21 +5923,13 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config)

wlc->shortslot_override = shortslot;

- if (AP_ENAB(wlc->pub))
- /* wlc->ap->shortslot_restrict = shortslot_restrict; */
- wlc->PLCPHdr_override =
- (preamble !=
- BRCMS_PLCP_LONG) ? BRCMS_PLCP_SHORT : BRCMS_PLCP_AUTO;
-
- if ((AP_ENAB(wlc->pub) && preamble != BRCMS_PLCP_LONG)
- || preamble == BRCMS_PLCP_SHORT)
+ if (preamble == BRCMS_PLCP_SHORT)
wlc->default_bss->capability |= WLAN_CAPABILITY_SHORT_PREAMBLE;
else
wlc->default_bss->capability &= ~WLAN_CAPABILITY_SHORT_PREAMBLE;

/* Update shortslot capability bit for AP and IBSS */
- if ((AP_ENAB(wlc->pub) && shortslot == BRCMS_SHORTSLOT_AUTO) ||
- shortslot == BRCMS_SHORTSLOT_ON)
+ if (shortslot == BRCMS_SHORTSLOT_ON)
wlc->default_bss->capability |= WLAN_CAPABILITY_SHORT_SLOT_TIME;
else
wlc->default_bss->capability &=
@@ -8359,20 +8321,12 @@ brcms_c_txfifo_complete(struct brcms_c_info *wlc, uint fifo, s8 txpktpend)
/* There is more room; mark precedences related to this FIFO sendable */
BRCMS_TX_FIFO_ENAB(wlc, fifo);

- /* Clear MHF2_TXBCMC_NOW flag if BCMC fifo has drained */
- if (AP_ENAB(wlc->pub) &&
- !TXPKTPENDGET(wlc, TX_BCMC_FIFO))
- brcms_c_mhf(wlc, MHF2, MHF2_TXBCMC_NOW, 0, BRCM_BAND_AUTO);
-
/* figure out which bsscfg is being worked on... */
}

/* Update beacon listen interval in shared memory */
void brcms_c_bcn_li_upd(struct brcms_c_info *wlc)
{
- if (AP_ENAB(wlc->pub))
- return;
-
/* wake up every DTIM is the default */
if (wlc->bcn_li_dtim == 1)
brcms_c_write_shm(wlc, M_BCN_LI, 0);
diff --git a/drivers/staging/brcm80211/brcmsmac/pub.h b/drivers/staging/brcm80211/brcmsmac/pub.h
index ab2fb11..a56239a 100644
--- a/drivers/staging/brcm80211/brcmsmac/pub.h
+++ b/drivers/staging/brcm80211/brcmsmac/pub.h
@@ -285,22 +285,13 @@ enum wlc_par_id {
* *********************************************
*/

-/* AP Support (versus STA) */
-#define AP_ENAB(pub) (0)
-
-/* Macro to check if APSTA mode enabled */
-#define APSTA_ENAB(pub) (0)
-
-/* Some useful combinations */
-#define STA_ONLY(pub) (!AP_ENAB(pub))
-#define AP_ONLY(pub) (AP_ENAB(pub) && !APSTA_ENAB(pub))
-
#define ENAB_1x1 0x01
#define ENAB_2x2 0x02
#define ENAB_3x3 0x04
#define ENAB_4x4 0x08
#define SUPPORT_11N (ENAB_1x1|ENAB_2x2)
#define SUPPORT_HT (ENAB_1x1|ENAB_2x2|ENAB_3x3)
+
/* WL11N Support */
#define N_ENAB(pub) ((pub)->_n_enab & SUPPORT_11N)
#define N_REQD(pub) ((pub)->_n_reqd)
--
1.7.4.1



2011-09-02 20:32:55

by Roland Vossen

[permalink] [raw]
Subject: RE: [PATCH 12/12] staging: brcm80211: cleaned up softmac srom macro

Hello Joe,

> Please try to make code more readable when converting to functions too.

Good feedback. I will redo this particular patch [12/12] and keep this in mind for the future. Expect a new patch coming Monday.

Thanks, Roland.

2011-09-02 14:00:58

by Roland Vossen

[permalink] [raw]
Subject: [PATCH 07/12] staging: brcm80211: cleaned up softmac nicpci.c/nicpci.h macro's

Substituted macro's.

Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Roland Vossen <[email protected]>
---
drivers/staging/brcm80211/brcmsmac/nicpci.c | 42 ++++++++++++++++-----------
drivers/staging/brcm80211/brcmsmac/nicpci.h | 12 -------
2 files changed, 25 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/nicpci.c b/drivers/staging/brcm80211/brcmsmac/nicpci.c
index 6bffca0..a2cab5c 100644
--- a/drivers/staging/brcm80211/brcmsmac/nicpci.c
+++ b/drivers/staging/brcm80211/brcmsmac/nicpci.c
@@ -127,6 +127,18 @@
/* PCIE protocol TLP diagnostic registers */
#define PCIE_TLP_WORKAROUNDSREG 0x004 /* TLP Workarounds */

+/* Sonics to PCI translation types */
+#define SBTOPCI_PREF 0x4 /* prefetch enable */
+#define SBTOPCI_BURST 0x8 /* burst enable */
+#define SBTOPCI_RC_READMULTI 0x20 /* memory read multiple */
+
+#define PCI_CLKRUN_DSBL 0x8000 /* Bit 15 forceClkrun */
+
+/* PCI core index in SROM shadow area */
+#define SRSH_PI_OFFSET 0 /* first word */
+#define SRSH_PI_MASK 0xf000 /* bit 15:12 */
+#define SRSH_PI_SHIFT 12 /* bit 15:12 */
+
/* Sonics side: PCI core and host control registers */
struct sbpciregs {
u32 control; /* PCI control */
@@ -211,18 +223,17 @@ struct pcicore_info {
bool pmecap; /* Capable of generating PME */
};

-/* debug/trace */
-#define PCI_ERROR(args)
-#define PCIE_PUB(sih) ((sih)->buscoretype == PCIE_CORE_ID)
-
#define PCIE_ASPM(sih) \
- ((PCIE_PUB(sih)) && \
+ (((sih)->buscoretype == PCIE_CORE_ID) && \
(((sih)->buscorerev >= 3) && \
((sih)->buscorerev <= 5)))


/* delay needed between the mdio control/ mdiodata register data access */
-#define PR28829_DELAY() udelay(10)
+static void pr28829_delay(void)
+{
+ udelay(10);
+}

/* Initialize the PCI core.
* It's caller's responsibility to make sure that this is done only once
@@ -235,7 +246,6 @@ struct pcicore_info *pcicore_init(struct si_pub *sih, struct pci_dev *pdev,
/* alloc struct pcicore_info */
pi = kzalloc(sizeof(struct pcicore_info), GFP_ATOMIC);
if (pi == NULL) {
- PCI_ERROR(("pci_attach: malloc failed!\n"));
return NULL;
}

@@ -375,7 +385,7 @@ static bool pcie_mdiosetblock(struct pcicore_info *pi, uint blk)
(blk << 4));
W_REG(&pcieregs->mdiodata, mdiodata);

- PR28829_DELAY();
+ pr28829_delay();
/* retry till the transaction is complete */
while (i < pcie_serdes_spinwait) {
if (R_REG(&pcieregs->mdiocontrol) & MDIOCTL_ACCESS_DONE)
@@ -386,7 +396,6 @@ static bool pcie_mdiosetblock(struct pcicore_info *pi, uint blk)
}

if (i >= pcie_serdes_spinwait) {
- PCI_ERROR(("pcie_mdiosetblock: timed out\n"));
return false;
}

@@ -427,13 +436,13 @@ pcie_mdioop(struct pcicore_info *pi, uint physmedia, uint regaddr, bool write,

W_REG(&pcieregs->mdiodata, mdiodata);

- PR28829_DELAY();
+ pr28829_delay();

/* retry till the transaction is complete */
while (i < pcie_serdes_spinwait) {
if (R_REG(&pcieregs->mdiocontrol) & MDIOCTL_ACCESS_DONE) {
if (!write) {
- PR28829_DELAY();
+ pr28829_delay();
*val = (R_REG(&pcieregs->mdiodata) &
MDIODATA_MASK);
}
@@ -445,8 +454,7 @@ pcie_mdioop(struct pcicore_info *pi, uint physmedia, uint regaddr, bool write,
i++;
}

- PCI_ERROR(("pcie_mdioop: timed out op: %d\n", write));
- /* Disable mdio access to SERDES */
+ /* Timed out. Disable mdio access to SERDES. */
W_REG(&pcieregs->mdiocontrol, 0);
return 1;
}
@@ -498,7 +506,7 @@ static void pcie_extendL1timer(struct pcicore_info *pi, bool extend)
struct si_pub *sih = pi->sih;
struct sbpcieregs *pcieregs = pi->regs.pcieregs;

- if (!PCIE_PUB(sih) || sih->buscorerev < 7)
+ if (sih->buscoretype != PCIE_CORE_ID || sih->buscorerev < 7)
return;

w = pcie_readreg(pcieregs, PCIE_PCIEREGS, PCIE_DLLP_PMTHRESHREG);
@@ -736,7 +744,7 @@ void pcicore_attach(struct pcicore_info *pi, char *pvars, int state)

void pcicore_hwup(struct pcicore_info *pi)
{
- if (!pi || !PCIE_PUB(pi->sih))
+ if (!pi || pi->sih->buscoretype != PCIE_CORE_ID)
return;

pcie_war_pci_setup(pi);
@@ -744,7 +752,7 @@ void pcicore_hwup(struct pcicore_info *pi)

void pcicore_up(struct pcicore_info *pi, int state)
{
- if (!pi || !PCIE_PUB(pi->sih))
+ if (!pi || pi->sih->buscoretype != PCIE_CORE_ID)
return;

/* Restore L1 timer for better performance */
@@ -772,7 +780,7 @@ void pcicore_sleep(struct pcicore_info *pi)

void pcicore_down(struct pcicore_info *pi, int state)
{
- if (!pi || !PCIE_PUB(pi->sih))
+ if (!pi || pi->sih->buscoretype != PCIE_CORE_ID)
return;

pcie_clkreq_upd(pi, state);
diff --git a/drivers/staging/brcm80211/brcmsmac/nicpci.h b/drivers/staging/brcm80211/brcmsmac/nicpci.h
index 3082db0..4995203 100644
--- a/drivers/staging/brcm80211/brcmsmac/nicpci.h
+++ b/drivers/staging/brcm80211/brcmsmac/nicpci.h
@@ -58,18 +58,6 @@
/* bar0 + 12K accesses chipc core registers */
#define PCI_16KB0_CCREGS_OFFSET (12 * 1024)

-#define PCI_CLKRUN_DSBL 0x8000 /* Bit 15 forceClkrun */
-
-/* Sonics to PCI translation types */
-#define SBTOPCI_PREF 0x4 /* prefetch enable */
-#define SBTOPCI_BURST 0x8 /* burst enable */
-#define SBTOPCI_RC_READMULTI 0x20 /* memory read multiple */
-
-/* PCI core index in SROM shadow area */
-#define SRSH_PI_OFFSET 0 /* first word */
-#define SRSH_PI_MASK 0xf000 /* bit 15:12 */
-#define SRSH_PI_SHIFT 12 /* bit 15:12 */
-
struct sbpciregs;
struct sbpcieregs;

--
1.7.4.1



2011-09-02 14:00:55

by Roland Vossen

[permalink] [raw]
Subject: [PATCH 03/12] staging: brcm80211: use address space qualifier in brcmfmac

From: Arend van Spriel <[email protected]>

Several sparse warning were issued due to missing __user qualifier
for brcmfmac variables. This patch adds those.

Reported-by: Aaro Koskinen <[email protected]>
Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
Reviewed-by: Roland Vossen <[email protected]>
Signed-off-by: Roland Vossen <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd.h | 2 +-
drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 4 ++--
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index ee09c17..4d06d87 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -779,7 +779,7 @@ extern void brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg,
/* Linux network driver ioctl encoding */
struct brcmf_c_ioctl {
uint cmd; /* common ioctl definition */
- void *buf; /* pointer to user buffer */
+ void __user *buf; /* pointer to user buffer */
uint len; /* length of user buffer */
bool set; /* get or set request (optional) */
uint used; /* bytes read or written (optional) */
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index 470759a..bb0f718 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -835,7 +835,7 @@ static struct ethtool_ops brcmf_ethtool_ops = {
.get_drvinfo = brcmf_ethtool_get_drvinfo
};

-static int brcmf_ethtool(struct brcmf_info *drvr_priv, void *uaddr)
+static int brcmf_ethtool(struct brcmf_info *drvr_priv, void __user *uaddr)
{
struct ethtool_drvinfo info;
char drvname[sizeof(info.driver)];
@@ -1001,7 +1001,7 @@ static int brcmf_netdev_ioctl_entry(struct net_device *net, struct ifreq *ifr,
}

/* To differentiate read 4 more byes */
- if ((copy_from_user(&driver, (char *)ifr->ifr_data +
+ if ((copy_from_user(&driver, (char __user *)ifr->ifr_data +
sizeof(struct brcmf_ioctl), sizeof(uint)) != 0)) {
bcmerror = -EINVAL;
goto done;
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index 60a04b3..db51c46 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -540,7 +540,7 @@ brcmf_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
ioc.buf = arg;
ioc.len = len;
strcpy(ifr.ifr_name, dev->name);
- ifr.ifr_data = (caddr_t)&ioc;
+ ifr.ifr_data = (char __user *)&ioc;

fs = get_fs();
set_fs(get_ds());
--
1.7.4.1



2011-09-05 08:06:50

by Roland Vossen

[permalink] [raw]
Subject: Re: [PATCH 12/12] staging: brcm80211: cleaned up softmac srom macro

please drop this particular patch (#12) but keep the other ones
(#1..#11). Will sent out a v2 patch shortly.


2011-09-02 14:01:01

by Roland Vossen

[permalink] [raw]
Subject: [PATCH 04/12] staging: brcm80211: remove sparse warning from main.c

From: Arend van Spriel <[email protected]>

The source file main.c contained several sparse warnings which
have been cleaned up.

Reported-by: Aaro Koskinen <[email protected]>
Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
Reviewed-by: Roland Vossen <[email protected]>
Signed-off-by: Roland Vossen <[email protected]>
---
drivers/staging/brcm80211/brcmsmac/main.c | 19 +++++++++----------
drivers/staging/brcm80211/brcmsmac/pub.h | 5 +++--
2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 6b694b1..9e73b42 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -880,7 +880,7 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme)
/* name and offsets for dma_attach */
snprintf(name, sizeof(name), "wl%d", unit);

- if (wlc_hw->di[0] == 0) { /* Init FIFOs */
+ if (wlc_hw->di[0] == NULL) { /* Init FIFOs */
int dma_attach_err = 0;

/*
@@ -5006,7 +5006,8 @@ static void brcms_c_update_mimo_band_bwcap(struct brcms_c_info *wlc, u8 bwcap)
*/
struct brcms_c_info *
brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
- bool piomode, void *regsva, struct pci_dev *btparam, uint *perr)
+ bool piomode, void __iomem *regsva, struct pci_dev *btparam,
+ uint *perr)
{
struct brcms_c_info *wlc;
uint err = 0;
@@ -7096,8 +7097,8 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
int len, phylen, rts_phylen;
u16 mch, phyctl, xfts, mainrates;
u16 seq = 0, mcl = 0, status = 0, frameid = 0;
- u32 rspec[2] = { BRCM_RATE_1M, BRCM_RATE_1M }, rts_rspec[2] = {
- BRCM_RATE_1M, BRCM_RATE_1M};
+ u32 rspec[2] = { BRCM_RATE_1M, BRCM_RATE_1M };
+ u32 rts_rspec[2] = { BRCM_RATE_1M, BRCM_RATE_1M };
bool use_rts = false;
bool use_cts = false;
bool use_rifs = false;
@@ -7741,9 +7742,8 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
return 0;
}

-bool
-brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu,
- struct ieee80211_hw *hw)
+void brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu,
+ struct ieee80211_hw *hw)
{
u8 prio;
uint fifo;
@@ -7760,10 +7760,9 @@ brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu,
if (unlikely
(brcms_c_d11hdrs_mac80211(
wlc, hw, sdu, scb, 0, 1, fifo, 0, NULL, 0)))
- return -EINVAL;
+ return;
brcms_c_txq_enq(wlc, scb, sdu, BRCMS_PRIO_TO_PREC(prio));
brcms_c_send_q(wlc);
- return 0;
}

void brcms_c_send_q(struct brcms_c_info *wlc)
@@ -9100,7 +9099,7 @@ brcms_c_bcn_prb_template(struct brcms_c_info *wlc, u16 type,
return;
}

-int brcms_c_get_header_len()
+int brcms_c_get_header_len(void)
{
return TXOFF;
}
diff --git a/drivers/staging/brcm80211/brcmsmac/pub.h b/drivers/staging/brcm80211/brcmsmac/pub.h
index f4e47e8..5bca2fb 100644
--- a/drivers/staging/brcm80211/brcmsmac/pub.h
+++ b/drivers/staging/brcm80211/brcmsmac/pub.h
@@ -536,7 +536,8 @@ struct brcms_antselcfg {
/* common functions for every port */
struct brcms_c_info *
brcms_c_attach(struct brcms_info *wl, u16 vendor, u16 device, uint unit,
- bool piomode, void *regsva, struct pci_dev *btparam, uint *perr);
+ bool piomode, void __iomem *regsva, struct pci_dev *btparam,
+ uint *perr);
extern uint brcms_c_detach(struct brcms_c_info *wlc);
extern int brcms_c_up(struct brcms_c_info *wlc);
extern uint brcms_c_down(struct brcms_c_info *wlc);
@@ -553,7 +554,7 @@ extern void brcms_c_intrsrestore(struct brcms_c_info *wlc, u32 macintmask);
extern bool brcms_c_intrsupd(struct brcms_c_info *wlc);
extern bool brcms_c_isr(struct brcms_c_info *wlc, bool *wantdpc);
extern bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded);
-extern bool brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc,
+extern void brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc,
struct sk_buff *sdu,
struct ieee80211_hw *hw);
extern int brcms_c_ioctl(struct brcms_c_info *wlc, int cmd, void *arg, int len,
--
1.7.4.1



2011-09-02 14:01:02

by Roland Vossen

[permalink] [raw]
Subject: [PATCH 11/12] staging: brcm80211: cleaned up softmac scb.h macro's

Substituted/removed macro's.

Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Roland Vossen <[email protected]>
---
drivers/staging/brcm80211/brcmsmac/main.c | 8 ++++----
drivers/staging/brcm80211/brcmsmac/main.h | 3 ++-
drivers/staging/brcm80211/brcmsmac/rate.h | 16 ----------------
drivers/staging/brcm80211/brcmsmac/scb.h | 24 ++++++++++--------------
4 files changed, 16 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 4436b4f..6d2fc103 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -7196,11 +7196,11 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
} else {
/* Increment the counter for first fragment */
if (tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
- SCB_SEQNUM(scb, p->priority)++;
+ scb->seqnum[p->priority]++;

/* extract fragment number from frame first */
seq = le16_to_cpu(seq) & FRAGNUM_MASK;
- seq |= (SCB_SEQNUM(scb, p->priority) << SEQNUM_SHIFT);
+ seq |= (scb->seqnum[p->priority] << SEQNUM_SHIFT);
h->seq_ctrl = cpu_to_le16(seq);

frameid = ((seq << TXFID_SEQ_SHIFT) & TXFID_SEQ_MASK) |
@@ -7210,7 +7210,7 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
frameid |= queue & TXFID_QUEUE_MASK;

/* set the ignpmq bit for all pkts tx'd in PS mode and for beacons */
- if (SCB_PS(scb) || ieee80211_is_beacon(h->frame_control))
+ if (ieee80211_is_beacon(h->frame_control))
mcl |= TXC_IGNOREPMQ;

txrate[0] = tx_info->control.rates;
@@ -7685,7 +7685,7 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw,
}

ac = skb_get_queue_mapping(p);
- if (SCB_WME(scb) && qos && wlc->edcf_txop[ac]) {
+ if ((scb->flags & SCB_WMECAP) && qos && wlc->edcf_txop[ac]) {
uint frag_dur, dur, dur_fallback;

/* WME: Update TXOP threshold */
diff --git a/drivers/staging/brcm80211/brcmsmac/main.h b/drivers/staging/brcm80211/brcmsmac/main.h
index 047c422..a0dcacc 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.h
+++ b/drivers/staging/brcm80211/brcmsmac/main.h
@@ -221,7 +221,8 @@ struct brcms_stf {

#define BRCMS_STF_SS_STBC_TX(wlc, scb) \
(((wlc)->stf->txstreams > 1) && (((wlc)->band->band_stf_stbc_tx == ON) \
- || (SCB_STBC_CAP((scb)) && (wlc)->band->band_stf_stbc_tx == AUTO && \
+ || (((scb)->flags & SCB_STBCCAP) && \
+ (wlc)->band->band_stf_stbc_tx == AUTO && \
isset(&((wlc)->stf->ss_algo_channel), PHY_TXC1_MODE_STBC))))

#define BRCMS_STBC_CAP_PHY(wlc) (BRCMS_ISNPHY(wlc->band) && \
diff --git a/drivers/staging/brcm80211/brcmsmac/rate.h b/drivers/staging/brcm80211/brcmsmac/rate.h
index 39e1796..ae5479b 100644
--- a/drivers/staging/brcm80211/brcmsmac/rate.h
+++ b/drivers/staging/brcm80211/brcmsmac/rate.h
@@ -123,22 +123,6 @@ extern const struct brcms_mcs_info mcs_table[];
RSPEC_ISSGI(rspec)) : \
(rspec & RSPEC_RATE_MASK))

-/* return rate in unit of 500Kbps -- for internal use in wlc_rate_sel.c */
-#define RSPEC2RATE500K(rspec) \
- ((rspec & RSPEC_MIMORATE) ? \
- MCS_RATE((rspec & RSPEC_RATE_MASK), state->is40bw, \
- RSPEC_ISSGI(rspec))/500 : \
- (rspec & RSPEC_RATE_MASK))
-
-#define CRSPEC2RATE500K(rspec) \
- ((rspec & RSPEC_MIMORATE) ? \
- MCS_RATE((rspec & RSPEC_RATE_MASK), RSPEC_IS40MHZ(rspec), \
- RSPEC_ISSGI(rspec))/500 :\
- (rspec & RSPEC_RATE_MASK))
-
-#define RSPEC2KBPS(rspec) \
- (IS_MCS(rspec) ? RSPEC2RATE(rspec) : RSPEC2RATE(rspec)*500)
-
#define RSPEC_PHYTXBYTE2(rspec) ((rspec & 0xff00) >> 8)

#define RSPEC_GET_BW(rspec) ((rspec & RSPEC_BW_MASK) >> RSPEC_BW_SHIFT)
diff --git a/drivers/staging/brcm80211/brcmsmac/scb.h b/drivers/staging/brcm80211/brcmsmac/scb.h
index 3fe9cf2..b2aacf3 100644
--- a/drivers/staging/brcm80211/brcmsmac/scb.h
+++ b/drivers/staging/brcm80211/brcmsmac/scb.h
@@ -24,6 +24,16 @@

#define AMPDU_TX_BA_MAX_WSIZE 64 /* max Tx ba window size (in pdu) */

+#define AMPDU_MAX_SCB_TID NUMPRIO
+
+/* scb flags */
+#define SCB_WMECAP 0x0040 /* may ONLY be set if pub->_wme!=OFF */
+#define SCB_HTCAP 0x10000 /* HT (MIMO) capable device */
+#define SCB_IS40 0x80000 /* 40MHz capable */
+#define SCB_STBCCAP 0x40000000 /* STBC Capable */
+
+#define SCB_MAGIC 0xbeefcafe
+
/* structure to store per-tid state for the ampdu initiator */
struct scb_ampdu_tid_ini {
u8 tx_in_transit; /* number of pending mpdus in transit in driver */
@@ -34,8 +44,6 @@ struct scb_ampdu_tid_ini {
u8 ba_wsize; /* negotiated ba window size (in pdu) */
};

-#define AMPDU_MAX_SCB_TID NUMPRIO
-
struct scb_ampdu {
struct scb *scb; /* back pointer for easy reference */
u8 mpdu_density; /* mpdu density */
@@ -54,8 +62,6 @@ struct scb_ampdu {
struct scb_ampdu_tid_ini ini[AMPDU_MAX_SCB_TID];
};

-#define SCB_MAGIC 0xbeefcafe
-
/* station control block - one per remote MAC address */
struct scb {
u32 magic;
@@ -74,14 +80,4 @@ struct scb {
struct scb_ampdu scb_ampdu; /* AMPDU state including per tid info */
};

-/* scb flags */
-#define SCB_WMECAP 0x0040 /* may ONLY be set if pub->_wme!=OFF */
-#define SCB_HTCAP 0x10000 /* HT (MIMO) capable device */
-#define SCB_IS40 0x80000 /* 40MHz capable */
-#define SCB_STBCCAP 0x40000000 /* STBC Capable */
-#define SCB_WME(a) ((a)->flags & SCB_WMECAP)/* implies WME enab */
-#define SCB_SEQNUM(scb, prio) ((scb)->seqnum[(prio)])
-#define SCB_PS(a) NULL
-#define SCB_STBC_CAP(a) ((a)->flags & SCB_STBCCAP)
-#define SCB_AMPDU(a) true
#endif /* _BRCM_SCB_H_ */
--
1.7.4.1