Code clean up for fullmac.
v2:
* remove patch "staging: brcm80211: reduced checkpatch warnings to zero" based
on Joe Perches's comments
Arend van Spriel (1):
staging: brcm80211: remove unconditional code blocks from brcmfmac
Franky Lin (6):
staging: brcm80211: remove event handler thread from fullmac
staging: brcm80211: remove fullmac module_param brcmf_dongle_memsize
staging: brcm80211: remove fullmac module_param
brcmf_sdiod_drive_strength
staging: brcm80211: remove fullmac module_param for watchdog
staging: brcm80211: remove fullmac module_param brcmf_idletime
staging: brcm80211: remove global variables for data frame boundary
Roland Vossen (12):
staging: brcm80211: sparse endianness warnings on dongle events
staging: brcm80211: various fulmac sparse endianness fixes
staging: brcm80211: sparse endianness warnings for struct
brcmf_proto_cdc_ioctl
staging: brcm80211: sparse endianness warnings for struct
sdpcm_shared
staging: brcm80211: more fullmac sparse endianness scan related
changes
staging: brcm80211: removed two fullmac sparse spinlock warnings
staging: brcm80211: added endianness check flag to fullmac Makefile
staging: brcm80211: removed likely/unlikely calls
staging: brcm80211: removed log after kzalloc()/kmalloc() failure
staging: brcm80211: clarified fullmac io and event codes
staging: brcm80211: consistent naming of struct net_device *ndev
staging: brcm80211: simplified internal ioctl function once more
drivers/staging/brcm80211/brcmfmac/Makefile | 1 +
drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 2 +-
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 6 +-
drivers/staging/brcm80211/brcmfmac/dhd.h | 51 +-
drivers/staging/brcm80211/brcmfmac/dhd_bus.h | 13 +-
drivers/staging/brcm80211/brcmfmac/dhd_cdc.c | 37 +-
drivers/staging/brcm80211/brcmfmac/dhd_common.c | 166 +++---
drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 296 +++++-----
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 215 +++----
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 678 +++++++++------------
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h | 11 +-
drivers/staging/brcm80211/brcmsmac/ampdu.c | 8 +-
drivers/staging/brcm80211/brcmsmac/antsel.c | 5 +-
drivers/staging/brcm80211/brcmsmac/channel.c | 5 +-
drivers/staging/brcm80211/brcmsmac/dma.c | 16 +-
drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 11 +-
drivers/staging/brcm80211/brcmsmac/nicpci.c | 3 +-
drivers/staging/brcm80211/brcmsmac/phy_shim.c | 7 +-
18 files changed, 689 insertions(+), 842 deletions(-)
From: Roland Vossen <[email protected]>
Annotated endianness on structures send/received to/from dongle.
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd.h | 25 +++++++--
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 64 +++++++++++-----------
2 files changed, 52 insertions(+), 37 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index c368f71..1e18ad0 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -469,6 +469,13 @@ struct brcmf_scan_results {
struct brcmf_bss_info bss_info[1];
};
+struct brcmf_scan_results_le {
+ __le32 buflen;
+ __le32 version;
+ __le32 count;
+ struct brcmf_bss_info bss_info[1];
+};
+
/* used for association with a specific BSSID and chanspec list */
struct brcmf_assoc_params_le {
/* 00:00:00:00:00:00: broadcast scan */
@@ -492,8 +499,14 @@ struct brcmf_join_params {
/* incremental scan results struct */
struct brcmf_iscan_results {
- u32 status;
- struct brcmf_scan_results results;
+ union {
+ u32 status;
+ __le32 status_le;
+ };
+ union {
+ struct brcmf_scan_results results;
+ struct brcmf_scan_results_le results_le;
+ };
};
/* size of brcmf_iscan_results not including variable length array */
@@ -549,10 +562,10 @@ struct brcmf_scb_val_le {
};
/* channel encoding */
-struct brcmf_channel_info {
- int hw_channel;
- int target_channel;
- int scan_channel;
+struct brcmf_channel_info_le {
+ __le32 hw_channel;
+ __le32 target_channel;
+ __le32 scan_channel;
};
/* Linux network driver ioctl encoding */
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index b4befec..5e86e21 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -2201,18 +2201,20 @@ brcmf_get_iscan_results(struct brcmf_cfg80211_iscan_ctrl *iscan, u32 *status,
{
struct brcmf_iscan_results list;
struct brcmf_scan_results *results;
+ struct brcmf_scan_results_le *results_le;
struct brcmf_iscan_results *list_buf;
s32 err = 0;
memset(iscan->scan_buf, 0, WL_ISCAN_BUF_MAX);
list_buf = (struct brcmf_iscan_results *)iscan->scan_buf;
results = &list_buf->results;
+ results_le = &list_buf->results_le;
results->buflen = BRCMF_ISCAN_RESULTS_FIXED_SIZE;
results->version = 0;
results->count = 0;
memset(&list, 0, sizeof(list));
- list.results.buflen = cpu_to_le32(WL_ISCAN_BUF_MAX);
+ list.results_le.buflen = cpu_to_le32(WL_ISCAN_BUF_MAX);
err = brcmf_dev_iovar_getbuf(iscan->dev, "iscanresults", &list,
BRCMF_ISCAN_RESULTS_FIXED_SIZE, iscan->scan_buf,
WL_ISCAN_BUF_MAX);
@@ -2220,12 +2222,12 @@ brcmf_get_iscan_results(struct brcmf_cfg80211_iscan_ctrl *iscan, u32 *status,
WL_ERR("error (%d)\n", err);
return err;
}
- results->buflen = le32_to_cpu(results->buflen);
- results->version = le32_to_cpu(results->version);
- results->count = le32_to_cpu(results->count);
- WL_SCAN("results->count = %d\n", results->count);
- WL_SCAN("results->buflen = %d\n", results->buflen);
- *status = le32_to_cpu(list_buf->status);
+ results->buflen = le32_to_cpu(results_le->buflen);
+ results->version = le32_to_cpu(results_le->version);
+ results->count = le32_to_cpu(results_le->count);
+ WL_SCAN("results->count = %d\n", results_le->count);
+ WL_SCAN("results->buflen = %d\n", results_le->buflen);
+ *status = le32_to_cpu(list_buf->status_le);
WL_SCAN("status = %d\n", *status);
*bss_list = results;
@@ -2848,11 +2850,12 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_priv *cfg_priv,
{
struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg_priv);
struct wiphy *wiphy = cfg_to_wiphy(cfg_priv);
- struct brcmf_channel_info channel;
+ struct brcmf_channel_info_le channel_le;
struct ieee80211_channel *notify_channel;
struct ieee80211_supported_band *band;
u32 freq;
s32 err = 0;
+ u32 target_channel;
WL_TRACE("Enter\n");
@@ -2860,18 +2863,18 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_priv *cfg_priv,
brcmf_update_prof(cfg_priv, NULL, &e->addr, WL_PROF_BSSID);
brcmf_update_bss_info(cfg_priv);
- brcmf_dev_ioctl(ndev, BRCMF_C_GET_CHANNEL, &channel, sizeof(channel));
+ brcmf_dev_ioctl(ndev, BRCMF_C_GET_CHANNEL, &channel_le,
+ sizeof(channel_le));
- channel.target_channel = le32_to_cpu(channel.target_channel);
- WL_CONN("Roamed to channel %d\n", channel.target_channel);
+ target_channel = le32_to_cpu(channel_le.target_channel);
+ WL_CONN("Roamed to channel %d\n", target_channel);
- if (channel.target_channel <= CH_MAX_2G_CHANNEL)
+ if (target_channel <= CH_MAX_2G_CHANNEL)
band = wiphy->bands[IEEE80211_BAND_2GHZ];
else
band = wiphy->bands[IEEE80211_BAND_5GHZ];
- freq = ieee80211_channel_to_frequency(channel.target_channel,
- band->band);
+ freq = ieee80211_channel_to_frequency(target_channel, band->band);
notify_channel = ieee80211_get_channel(wiphy, freq);
cfg80211_roamed(ndev, notify_channel,
@@ -3011,11 +3014,12 @@ brcmf_notify_scan_status(struct brcmf_cfg80211_priv *cfg_priv,
struct net_device *ndev,
const struct brcmf_event_msg *e, void *data)
{
- struct brcmf_channel_info channel_inform;
- struct brcmf_scan_results *bss_list;
+ struct brcmf_channel_info_le channel_inform_le;
+ struct brcmf_scan_results_le *bss_list_le;
u32 len = WL_SCAN_BUF_MAX;
s32 err = 0;
bool scan_abort = false;
+ u32 scan_channel;
WL_TRACE("Enter\n");
@@ -3032,34 +3036,32 @@ brcmf_notify_scan_status(struct brcmf_cfg80211_priv *cfg_priv,
goto scan_done_out;
}
- err = brcmf_dev_ioctl(ndev, BRCMF_C_GET_CHANNEL, &channel_inform,
- sizeof(channel_inform));
+ err = brcmf_dev_ioctl(ndev, BRCMF_C_GET_CHANNEL, &channel_inform_le,
+ sizeof(channel_inform_le));
if (unlikely(err)) {
WL_ERR("scan busy (%d)\n", err);
scan_abort = true;
goto scan_done_out;
}
- channel_inform.scan_channel = le32_to_cpu(channel_inform.scan_channel);
- if (unlikely(channel_inform.scan_channel)) {
-
- WL_CONN("channel_inform.scan_channel (%d)\n",
- channel_inform.scan_channel);
- }
+ scan_channel = le32_to_cpu(channel_inform_le.scan_channel);
+ if (unlikely(scan_channel))
+ WL_CONN("channel_inform.scan_channel (%d)\n", scan_channel);
cfg_priv->bss_list = cfg_priv->scan_results;
- bss_list = cfg_priv->bss_list;
- memset(bss_list, 0, len);
- bss_list->buflen = cpu_to_le32(len);
+ bss_list_le = (struct brcmf_scan_results_le *) cfg_priv->bss_list;
- err = brcmf_dev_ioctl(ndev, BRCMF_C_SCAN_RESULTS, bss_list, len);
+ memset(cfg_priv->scan_results, 0, len);
+ bss_list_le->buflen = cpu_to_le32(len);
+ err = brcmf_dev_ioctl(ndev, BRCMF_C_SCAN_RESULTS,
+ cfg_priv->scan_results, len);
if (unlikely(err)) {
WL_ERR("%s Scan_results error (%d)\n", ndev->name, err);
err = -EINVAL;
scan_abort = true;
goto scan_done_out;
}
- bss_list->buflen = le32_to_cpu(bss_list->buflen);
- bss_list->version = le32_to_cpu(bss_list->version);
- bss_list->count = le32_to_cpu(bss_list->count);
+ cfg_priv->scan_results->buflen = le32_to_cpu(bss_list_le->buflen);
+ cfg_priv->scan_results->version = le32_to_cpu(bss_list_le->version);
+ cfg_priv->scan_results->count = le32_to_cpu(bss_list_le->count);
err = brcmf_inform_bss(cfg_priv);
if (err) {
--
1.7.1
From: Roland Vossen <[email protected]>
Structure that is received from dongle has been annotated.
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 31 +++++++++++++++++-------
1 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 57001d4..9d4850d 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -530,6 +530,17 @@ struct sdpcm_shared {
u8 tag[32];
};
+struct sdpcm_shared_le {
+ __le32 flags;
+ __le32 trap_addr;
+ __le32 assert_exp_addr;
+ __le32 assert_file_addr;
+ __le32 assert_line;
+ __le32 console_addr; /* Address of struct rte_console */
+ __le32 msgtrace_addr;
+ u8 tag[32];
+};
+
/* misc chip info needed by some of the routines */
struct chip_info {
@@ -2919,6 +2930,7 @@ brcmf_sdbrcm_readshared(struct brcmf_bus *bus, struct sdpcm_shared *sh)
u32 addr;
__le32 addr_le;
int rv;
+ struct sdpcm_shared_le sh_le;
/* Read last word in memory to determine address of
sdpcm_shared structure */
@@ -2942,19 +2954,20 @@ brcmf_sdbrcm_readshared(struct brcmf_bus *bus, struct sdpcm_shared *sh)
}
/* Read rte_shared structure */
- rv = brcmf_sdbrcm_membytes(bus, false, addr, (u8 *) sh,
- sizeof(struct sdpcm_shared));
+ rv = brcmf_sdbrcm_membytes(bus, false, addr, (u8 *) &sh_le,
+ sizeof(struct sdpcm_shared_le));
if (rv < 0)
return rv;
/* Endianness */
- sh->flags = le32_to_cpu(sh->flags);
- sh->trap_addr = le32_to_cpu(sh->trap_addr);
- sh->assert_exp_addr = le32_to_cpu(sh->assert_exp_addr);
- sh->assert_file_addr = le32_to_cpu(sh->assert_file_addr);
- sh->assert_line = le32_to_cpu(sh->assert_line);
- sh->console_addr = le32_to_cpu(sh->console_addr);
- sh->msgtrace_addr = le32_to_cpu(sh->msgtrace_addr);
+ sh->flags = le32_to_cpu(sh_le.flags);
+ sh->trap_addr = le32_to_cpu(sh_le.trap_addr);
+ sh->assert_exp_addr = le32_to_cpu(sh_le.assert_exp_addr);
+ sh->assert_file_addr = le32_to_cpu(sh_le.assert_file_addr);
+ sh->assert_line = le32_to_cpu(sh_le.assert_line);
+ sh->console_addr = le32_to_cpu(sh_le.console_addr);
+ sh->msgtrace_addr = le32_to_cpu(sh_le.msgtrace_addr);
+ memcpy(sh->tag, sh_le.tag, sizeof(sh->tag));
if ((sh->flags & SDPCM_SHARED_VERSION_MASK) != SDPCM_SHARED_VERSION) {
brcmf_dbg(ERROR, "sdpcm_shared version %d in brcmf is different than sdpcm_shared version %d in dongle\n",
--
1.7.1
From: Roland Vossen <[email protected]>
There was no performance rationale to use these guys.
Reported-by: Dan Carpenter <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 4 +-
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 211 +++++++++++-----------
drivers/staging/brcm80211/brcmsmac/ampdu.c | 2 +-
3 files changed, 107 insertions(+), 110 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index e1d7456..cc8564a 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -944,7 +944,7 @@ static int brcmf_netdev_open(struct net_device *net)
/* Allow transmit calls */
netif_start_queue(net);
drvr_priv->pub.up = 1;
- if (unlikely(brcmf_cfg80211_up(drvr_priv->pub.config))) {
+ if (brcmf_cfg80211_up(drvr_priv->pub.config)) {
brcmf_dbg(ERROR, "failed to bring up cfg80211\n");
return -1;
}
@@ -1054,7 +1054,7 @@ struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, uint bus_hdrlen)
brcmf_cfg80211_attach(net,
brcmf_bus_get_device(bus),
&drvr_priv->pub);
- if (unlikely(drvr_priv->pub.config == NULL)) {
+ if (drvr_priv->pub.config == NULL) {
brcmf_dbg(ERROR, "wl_cfg80211_attach failed\n");
goto fail;
}
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index 0bda00c..6acaaae 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -337,7 +337,7 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
}
err = brcmf_dev_ioctl_u32(ndev, BRCMF_C_SET_INFRA, &infra);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("WLC_SET_INFRA error (%d)\n", err);
err = -EAGAIN;
} else {
@@ -367,7 +367,7 @@ static s32 brcmf_dev_intvar_set(struct net_device *dev, s8 *name, s32 val)
BUG_ON(!len);
err = brcmf_dev_ioctl(dev, BRCMF_C_SET_VAR, buf, len);
- if (unlikely(err))
+ if (err)
WL_ERR("error (%d)\n", err);
return err;
@@ -389,7 +389,7 @@ brcmf_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval)
sizeof(var.buf));
BUG_ON(!len);
err = brcmf_dev_ioctl(dev, BRCMF_C_GET_VAR, &var, len);
- if (unlikely(err))
+ if (err)
WL_ERR("error (%d)\n", err);
*retval = le32_to_cpu(var.val);
@@ -404,7 +404,7 @@ static void brcmf_set_mpc(struct net_device *ndev, int mpc)
if (test_bit(WL_STATUS_READY, &cfg_priv->status)) {
err = brcmf_dev_intvar_set(ndev, "mpc", mpc);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("fail to set mpc\n");
return;
}
@@ -463,7 +463,7 @@ brcmf_run_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan,
if (ssid && ssid->SSID_len)
params_size += sizeof(struct brcmf_ssid);
params = kzalloc(params_size, GFP_KERNEL);
- if (unlikely(!params))
+ if (!params)
return -ENOMEM;
BUG_ON(params_size >= BRCMF_C_IOCTL_SMLEN);
@@ -475,7 +475,7 @@ brcmf_run_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan,
err = brcmf_dev_iovar_setbuf(iscan->dev, "iscan", params, params_size,
iscan->ioctl_buf, BRCMF_C_IOCTL_SMLEN);
- if (unlikely(err)) {
+ if (err) {
if (err == -EBUSY)
WL_INFO("system busy : iscan canceled\n");
else
@@ -502,7 +502,7 @@ static s32 brcmf_do_iscan(struct brcmf_cfg80211_priv *cfg_priv)
passive_scan = cfg_priv->active_scan ? 0 : 1;
err = brcmf_dev_ioctl(cfg_to_ndev(cfg_priv), BRCMF_C_SET_PASSIVE_SCAN,
&passive_scan, sizeof(passive_scan));
- if (unlikely(err)) {
+ if (err) {
WL_ERR("error (%d)\n", err);
return err;
}
@@ -533,11 +533,11 @@ __brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
s32 err = 0;
u32 SSID_len;
- if (unlikely(test_bit(WL_STATUS_SCANNING, &cfg_priv->status))) {
+ if (test_bit(WL_STATUS_SCANNING, &cfg_priv->status)) {
WL_ERR("Scanning already : status (%lu)\n", cfg_priv->status);
return -EAGAIN;
}
- if (unlikely(test_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status))) {
+ if (test_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status)) {
WL_ERR("Scanning being aborted : status (%lu)\n",
cfg_priv->status);
return -EAGAIN;
@@ -565,7 +565,7 @@ __brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
set_bit(WL_STATUS_SCANNING, &cfg_priv->status);
if (iscan_req) {
err = brcmf_do_iscan(cfg_priv);
- if (likely(!err))
+ if (!err)
return err;
else
goto scan_out;
@@ -586,7 +586,7 @@ __brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
passive_scan = cfg_priv->active_scan ? 0 : 1;
err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_PASSIVE_SCAN,
&passive_scan, sizeof(passive_scan));
- if (unlikely(err)) {
+ if (err) {
WL_ERR("WLC_SET_PASSIVE_SCAN error (%d)\n", err);
goto scan_out;
}
@@ -625,7 +625,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
return -EIO;
err = __brcmf_cfg80211_scan(wiphy, ndev, request, NULL);
- if (unlikely(err))
+ if (err)
WL_ERR("scan error (%d)\n", err);
WL_TRACE("Exit\n");
@@ -637,7 +637,7 @@ static s32 brcmf_set_rts(struct net_device *dev, u32 rts_threshold)
s32 err = 0;
err = brcmf_dev_intvar_set(dev, "rtsthresh", rts_threshold);
- if (unlikely(err))
+ if (err)
WL_ERR("Error (%d)\n", err);
return err;
@@ -648,7 +648,7 @@ static s32 brcmf_set_frag(struct net_device *dev, u32 frag_threshold)
s32 err = 0;
err = brcmf_dev_intvar_set(dev, "fragthresh", frag_threshold);
- if (unlikely(err))
+ if (err)
WL_ERR("Error (%d)\n", err);
return err;
@@ -660,7 +660,7 @@ static s32 brcmf_set_retry(struct net_device *dev, u32 retry, bool l)
u32 cmd = (l ? BRCM_SET_LRL : BRCM_SET_SRL);
err = brcmf_dev_ioctl_u32(dev, cmd, &retry);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("cmd (%d) , error (%d)\n", cmd, err);
return err;
}
@@ -809,7 +809,7 @@ static void brcmf_link_down(struct brcmf_cfg80211_priv *cfg_priv)
dev = cfg_to_ndev(cfg_priv);
WL_INFO("Call WLC_DISASSOC to stop excess roaming\n ");
err = brcmf_dev_ioctl(dev, BRCMF_C_DISASSOC, NULL, 0);
- if (unlikely(err))
+ if (err)
WL_ERR("WLC_DISASSOC failed (%d)\n", err);
cfg_priv->link_up = false;
}
@@ -883,7 +883,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
wsec |= WEP_ENABLED;
err = brcmf_dev_intvar_set(dev, "wsec", wsec);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("wsec failed (%d)\n", err);
goto done;
}
@@ -895,7 +895,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
bcnprd = 100;
err = brcmf_dev_ioctl_u32(dev, BRCM_SET_BCNPRD, &bcnprd);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("WLC_SET_BCNPRD failed (%d)\n", err);
goto done;
}
@@ -940,7 +940,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
target_channel = cfg_priv->channel;
err = brcmf_dev_ioctl_u32(dev, BRCM_SET_CHANNEL,
&target_channel);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("WLC_SET_CHANNEL failed (%d)\n", err);
goto done;
}
@@ -952,7 +952,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
err = brcmf_dev_ioctl(dev, BRCMF_C_SET_SSID,
&join_params, join_params_size);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("WLC_SET_SSID failed (%d)\n", err);
goto done;
}
@@ -997,7 +997,7 @@ static s32 brcmf_set_wpa_version(struct net_device *dev,
val = WPA_AUTH_DISABLED;
WL_CONN("setting wpa_auth to 0x%0x\n", val);
err = brcmf_dev_intvar_set(dev, "wpa_auth", val);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("set wpa_auth failed (%d)\n", err);
return err;
}
@@ -1036,7 +1036,7 @@ brcmf_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme)
}
err = brcmf_dev_intvar_set(dev, "auth", val);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("set auth failed (%d)\n", err);
return err;
}
@@ -1100,7 +1100,7 @@ brcmf_set_set_cipher(struct net_device *dev,
WL_CONN("pval (%d) gval (%d)\n", pval, gval);
err = brcmf_dev_intvar_set(dev, "wsec", pval | gval);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("error (%d)\n", err);
return err;
}
@@ -1122,7 +1122,7 @@ brcmf_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme)
if (sme->crypto.n_akm_suites) {
err = brcmf_dev_intvar_get(dev, "wpa_auth", &val);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("could not get wpa_auth (%d)\n", err);
return err;
}
@@ -1156,7 +1156,7 @@ brcmf_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme)
WL_CONN("setting wpa_auth to %d\n", val);
err = brcmf_dev_intvar_set(dev, "wpa_auth", val);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("could not set wpa_auth (%d)\n", err);
return err;
}
@@ -1190,7 +1190,7 @@ brcmf_set_set_sharedkey(struct net_device *dev,
memset(&key, 0, sizeof(key));
key.len = (u32) sme->key_len;
key.index = (u32) sme->key_idx;
- if (unlikely(key.len > sizeof(key.data))) {
+ if (key.len > sizeof(key.data)) {
WL_ERR("Too long key length (%u)\n", key.len);
return -EINVAL;
}
@@ -1220,7 +1220,7 @@ brcmf_set_set_sharedkey(struct net_device *dev,
WL_CONN("set auth_type to shared key\n");
val = 1; /* shared key */
err = brcmf_dev_intvar_set(dev, "auth", val);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("set auth failed (%d)\n", err);
return err;
}
@@ -1246,7 +1246,7 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
if (!check_sys_up(wiphy))
return -EIO;
- if (unlikely(!sme->ssid)) {
+ if (!sme->ssid) {
WL_ERR("Invalid ssid\n");
return -EOPNOTSUPP;
}
@@ -1340,7 +1340,7 @@ brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
scbval.val = cpu_to_le32(reason_code);
err = brcmf_dev_ioctl(dev, BRCMF_C_DISASSOC, &scbval,
sizeof(struct brcmf_scb_val_le));
- if (unlikely(err))
+ if (err)
WL_ERR("error (%d)\n", err);
cfg_priv->link_up = false;
@@ -1385,7 +1385,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy,
/* Make sure radio is off or on as far as software is concerned */
disable = WL_RADIO_SW_DISABLE << 16;
err = brcmf_dev_ioctl_u32(ndev, BRCMF_C_SET_RADIO, &disable);
- if (unlikely(err))
+ if (err)
WL_ERR("WLC_SET_RADIO error (%d)\n", err);
if (dbm > 0xffff)
@@ -1394,7 +1394,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy,
txpwrmw = (u16) dbm;
err = brcmf_dev_intvar_set(ndev, "qtxpower",
(s32) (brcmu_mw_to_qdbm(txpwrmw)));
- if (unlikely(err))
+ if (err)
WL_ERR("qtxpower error (%d)\n", err);
cfg_priv->conf->tx_power = dbm;
@@ -1416,7 +1416,7 @@ static s32 brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm)
return -EIO;
err = brcmf_dev_intvar_get(ndev, "qtxpower", &txpwrdbm);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("error (%d)\n", err);
goto done;
}
@@ -1443,7 +1443,7 @@ brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev,
return -EIO;
err = brcmf_dev_ioctl_u32(dev, BRCMF_C_GET_WSEC, &wsec);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("WLC_GET_WSEC error (%d)\n", err);
goto done;
}
@@ -1452,7 +1452,7 @@ brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev,
/* Just select a new current key */
index = key_idx;
err = brcmf_dev_ioctl_u32(dev, BRCMF_C_SET_KEY_PRIMARY, &index);
- if (unlikely(err))
+ if (err)
WL_ERR("error (%d)\n", err);
}
done:
@@ -1538,7 +1538,7 @@ brcmf_add_keyext(struct wiphy *wiphy, struct net_device *dev,
brcmf_netdev_wait_pend8021x(dev);
err = brcmf_dev_ioctl(dev, BRCMF_C_SET_KEY, &key_le,
sizeof(key_le));
- if (unlikely(err)) {
+ if (err) {
WL_ERR("WLC_SET_KEY error (%d)\n", err);
return err;
}
@@ -1571,7 +1571,7 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
key.len = (u32) params->key_len;
key.index = (u32) key_idx;
- if (unlikely(key.len > sizeof(key.data))) {
+ if (key.len > sizeof(key.data)) {
WL_ERR("Too long key length (%u)\n", key.len);
err = -EINVAL;
goto done;
@@ -1615,21 +1615,21 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
val = WEP_ENABLED;
err = brcmf_dev_intvar_get(dev, "wsec", &wsec);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("get wsec error (%d)\n", err);
goto done;
}
wsec &= ~(WEP_ENABLED);
wsec |= val;
err = brcmf_dev_intvar_set(dev, "wsec", wsec);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("set wsec error (%d)\n", err);
goto done;
}
val = 1; /* assume shared key. otherwise 0 */
err = brcmf_dev_ioctl_u32(dev, BRCMF_C_SET_AUTH, &val);
- if (unlikely(err))
+ if (err)
WL_ERR("WLC_SET_AUTH error (%d)\n", err);
done:
WL_TRACE("Exit\n");
@@ -1672,7 +1672,7 @@ brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
val = 0;
err = brcmf_dev_intvar_get(dev, "wsec", &wsec);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("get wsec error (%d)\n", err);
/* Ignore this error, may happen during DISASSOC */
err = -EAGAIN;
@@ -1681,7 +1681,7 @@ brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
wsec &= ~(WEP_ENABLED);
wsec |= val;
err = brcmf_dev_intvar_set(dev, "wsec", wsec);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("set wsec error (%d)\n", err);
/* Ignore this error, may happen during DISASSOC */
err = -EAGAIN;
@@ -1690,7 +1690,7 @@ brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
val = 0; /* assume open key. otherwise 1 */
err = brcmf_dev_ioctl_u32(dev, BRCMF_C_SET_AUTH, &val);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("WLC_SET_AUTH error (%d)\n", err);
/* Ignore this error, may happen during DISASSOC */
err = -EAGAIN;
@@ -1719,7 +1719,7 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
memset(¶ms, 0, sizeof(params));
err = brcmf_dev_ioctl_u32(dev, BRCMF_C_GET_WSEC, &wsec);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("WLC_GET_WSEC error (%d)\n", err);
/* Ignore this error, may happen during DISASSOC */
err = -EAGAIN;
@@ -1780,8 +1780,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
if (!check_sys_up(wiphy))
return -EIO;
- if (unlikely
- (memcmp(mac, bssid, ETH_ALEN))) {
+ if (memcmp(mac, bssid, ETH_ALEN)) {
WL_ERR("Wrong Mac address cfg_mac-%X:%X:%X:%X:%X:%X"
"wl_bssid-%X:%X:%X:%X:%X:%X\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5],
@@ -1805,7 +1804,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
scb_val.val = cpu_to_le32(0);
err = brcmf_dev_ioctl(dev, BRCMF_C_GET_RSSI, &scb_val,
sizeof(struct brcmf_scb_val_le));
- if (unlikely(err))
+ if (err)
WL_ERR("Could not get rssi (%d)\n", err);
rssi = le32_to_cpu(scb_val.val);
@@ -1848,7 +1847,7 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
WL_INFO("power save %s\n", (pm ? "enabled" : "disabled"));
err = brcmf_dev_ioctl_u32(dev, BRCMF_C_SET_PM, &pm);
- if (unlikely(err)) {
+ if (err) {
if (err == -ENODEV)
WL_ERR("net_device is not ready yet\n");
else
@@ -1880,7 +1879,7 @@ brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,
/* Get current rateset */
err = brcmf_dev_ioctl(dev, BRCM_GET_CURR_RATESET, &rateset_le,
sizeof(rateset_le));
- if (unlikely(err)) {
+ if (err) {
WL_ERR("could not get current rateset (%d)\n", err);
goto done;
}
@@ -1908,7 +1907,7 @@ brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,
*/
err_bg = brcmf_dev_intvar_set(dev, "bg_rate", rate);
err_a = brcmf_dev_intvar_set(dev, "a_rate", rate);
- if (unlikely(err_bg && err_a)) {
+ if (err_bg && err_a) {
WL_ERR("could not set fixed rate (%d) (%d)\n", err_bg, err_a);
err = err_bg | err_a;
}
@@ -1935,7 +1934,7 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_priv *cfg_priv,
size_t notify_ielen;
s32 notify_signal;
- if (unlikely(le32_to_cpu(bi->length) > WL_BSS_INFO_MAX)) {
+ if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) {
WL_ERR("Bss info is larger than buffer. Discarding\n");
return 0;
}
@@ -1971,7 +1970,7 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_priv *cfg_priv,
notify_timestamp, notify_capability, notify_interval, notify_ie,
notify_ielen, notify_signal, GFP_KERNEL);
- if (unlikely(!bss)) {
+ if (!bss) {
WL_ERR("cfg80211_inform_bss_frame error\n");
return -EINVAL;
}
@@ -1987,7 +1986,7 @@ static s32 brcmf_inform_bss(struct brcmf_cfg80211_priv *cfg_priv)
int i;
bss_list = cfg_priv->bss_list;
- if (unlikely(bss_list->version != BRCMF_BSS_INFO_VERSION)) {
+ if (bss_list->version != BRCMF_BSS_INFO_VERSION) {
WL_ERR("Version %d != WL_BSS_INFO_VERSION\n",
bss_list->version);
return -EOPNOTSUPP;
@@ -1996,7 +1995,7 @@ static s32 brcmf_inform_bss(struct brcmf_cfg80211_priv *cfg_priv)
for (i = 0; i < bss_list->count && i < WL_AP_MAX; i++) {
bi = next_bss(bss_list, bi);
err = brcmf_inform_single_bss(cfg_priv, bi);
- if (unlikely(err))
+ if (err)
break;
}
return err;
@@ -2032,7 +2031,7 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_priv *cfg_priv,
*(__le32 *)buf = cpu_to_le32(WL_BSS_INFO_MAX);
err = brcmf_dev_ioctl(dev, BRCMF_C_GET_BSS_INFO, buf, WL_BSS_INFO_MAX);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("WLC_GET_BSS_INFO failed: %d\n", err);
goto CleanUp;
}
@@ -2101,14 +2100,14 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_priv *cfg_priv)
*(__le32 *)cfg_priv->extra_buf = cpu_to_le32(WL_EXTRA_BUF_MAX);
err = brcmf_dev_ioctl(cfg_to_ndev(cfg_priv), BRCMF_C_GET_BSS_INFO,
cfg_priv->extra_buf, WL_EXTRA_BUF_MAX);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("Could not get bss info %d\n", err);
goto update_bss_info_out;
}
bi = (struct brcmf_bss_info *)(cfg_priv->extra_buf + 4);
err = brcmf_inform_single_bss(cfg_priv, bi);
- if (unlikely(err))
+ if (err)
goto update_bss_info_out;
ie = ((u8 *)bi) + le16_to_cpu(bi->ie_offset);
@@ -2127,7 +2126,7 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_priv *cfg_priv)
u32 var;
err = brcmf_dev_intvar_get(cfg_to_ndev(cfg_priv),
"dtim_assoc", &var);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("wl dtim_assoc failed (%d)\n", err);
goto update_bss_info_out;
}
@@ -2169,12 +2168,11 @@ static void brcmf_notify_iscan_complete(struct brcmf_cfg80211_iscan_ctrl *iscan,
struct brcmf_cfg80211_priv *cfg_priv = iscan_to_cfg(iscan);
struct net_device *ndev = cfg_to_ndev(cfg_priv);
- if (unlikely(!test_and_clear_bit(WL_STATUS_SCANNING,
- &cfg_priv->status))) {
+ if (!test_and_clear_bit(WL_STATUS_SCANNING, &cfg_priv->status)) {
WL_ERR("Scan complete while device not scanning\n");
return;
}
- if (likely(cfg_priv->scan_request)) {
+ if (cfg_priv->scan_request) {
WL_SCAN("ISCAN Completed scan: %s\n",
aborted ? "Aborted" : "Done");
cfg80211_scan_done(cfg_priv->scan_request, aborted);
@@ -2186,7 +2184,7 @@ static void brcmf_notify_iscan_complete(struct brcmf_cfg80211_iscan_ctrl *iscan,
static s32 brcmf_wakeup_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan)
{
- if (likely(iscan->state != WL_ISCAN_STATE_IDLE)) {
+ if (iscan->state != WL_ISCAN_STATE_IDLE) {
WL_SCAN("wake up iscan\n");
schedule_work(&iscan->work);
return 0;
@@ -2218,7 +2216,7 @@ brcmf_get_iscan_results(struct brcmf_cfg80211_iscan_ctrl *iscan, u32 *status,
err = brcmf_dev_iovar_getbuf(iscan->dev, "iscanresults", &list,
BRCMF_ISCAN_RESULTS_FIXED_SIZE, iscan->scan_buf,
WL_ISCAN_BUF_MAX);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("error (%d)\n", err);
return err;
}
@@ -2481,7 +2479,7 @@ brcmf_dev_bufvar_get(struct net_device *dev, s8 *name, s8 *buf,
BUG_ON(!len);
err = brcmf_dev_ioctl(dev, BRCMF_C_GET_VAR, (void *)cfg_priv->ioctl_buf,
WL_IOCTL_LEN_MAX);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("error (%d)\n", err);
return err;
}
@@ -2504,7 +2502,7 @@ brcmf_update_pmklist(struct net_device *dev,
WL_CONN("%02x\n", pmk_list->pmkids.pmkid[i].PMKID[j]);
}
- if (likely(!err))
+ if (!err)
brcmf_dev_bufvar_set(dev, "pmkid_info", (char *)pmk_list,
sizeof(*pmk_list));
@@ -2662,14 +2660,14 @@ static struct wireless_dev *brcmf_alloc_wdev(s32 sizeof_iface,
s32 err = 0;
wdev = kzalloc(sizeof(*wdev), GFP_KERNEL);
- if (unlikely(!wdev)) {
+ if (!wdev) {
WL_ERR("Could not allocate wireless device\n");
return ERR_PTR(-ENOMEM);
}
wdev->wiphy =
wiphy_new(&wl_cfg80211_ops,
sizeof(struct brcmf_cfg80211_priv) + sizeof_iface);
- if (unlikely(!wdev->wiphy)) {
+ if (!wdev->wiphy) {
WL_ERR("Couldn not allocate wiphy device\n");
err = -ENOMEM;
goto wiphy_new_out;
@@ -2695,7 +2693,7 @@ static struct wireless_dev *brcmf_alloc_wdev(s32 sizeof_iface,
* by default
*/
err = wiphy_register(wdev->wiphy);
- if (unlikely(err < 0)) {
+ if (err < 0) {
WL_ERR("Couldn not register wiphy device (%d)\n", err);
goto wiphy_register_out;
}
@@ -2714,7 +2712,7 @@ static void brcmf_free_wdev(struct brcmf_cfg80211_priv *cfg_priv)
{
struct wireless_dev *wdev = cfg_priv->wdev;
- if (unlikely(!wdev)) {
+ if (!wdev) {
WL_ERR("wdev is invalid\n");
return;
}
@@ -2798,7 +2796,7 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv)
err = brcmf_dev_bufvar_get(ndev, "assoc_info", cfg_priv->extra_buf,
WL_ASSOC_INFO_MAX);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("could not get assoc info (%d)\n", err);
return err;
}
@@ -2809,7 +2807,7 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv)
err = brcmf_dev_bufvar_get(ndev, "assoc_req_ies",
cfg_priv->extra_buf,
WL_ASSOC_INFO_MAX);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("could not get assoc req (%d)\n", err);
return err;
}
@@ -2825,7 +2823,7 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv)
err = brcmf_dev_bufvar_get(ndev, "assoc_resp_ies",
cfg_priv->extra_buf,
WL_ASSOC_INFO_MAX);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("could not get assoc resp (%d)\n", err);
return err;
}
@@ -3028,8 +3026,7 @@ brcmf_notify_scan_status(struct brcmf_cfg80211_priv *cfg_priv,
return brcmf_wakeup_iscan(cfg_to_iscan(cfg_priv));
}
- if (unlikely(!test_and_clear_bit(WL_STATUS_SCANNING,
- &cfg_priv->status))) {
+ if (!test_and_clear_bit(WL_STATUS_SCANNING, &cfg_priv->status)) {
WL_ERR("Scan complete while device not scanning\n");
scan_abort = true;
err = -EINVAL;
@@ -3038,13 +3035,13 @@ brcmf_notify_scan_status(struct brcmf_cfg80211_priv *cfg_priv,
err = brcmf_dev_ioctl(ndev, BRCMF_C_GET_CHANNEL, &channel_inform_le,
sizeof(channel_inform_le));
- if (unlikely(err)) {
+ if (err) {
WL_ERR("scan busy (%d)\n", err);
scan_abort = true;
goto scan_done_out;
}
scan_channel = le32_to_cpu(channel_inform_le.scan_channel);
- if (unlikely(scan_channel))
+ if (scan_channel)
WL_CONN("channel_inform.scan_channel (%d)\n", scan_channel);
cfg_priv->bss_list = cfg_priv->scan_results;
bss_list_le = (struct brcmf_scan_results_le *) cfg_priv->bss_list;
@@ -3053,7 +3050,7 @@ brcmf_notify_scan_status(struct brcmf_cfg80211_priv *cfg_priv,
bss_list_le->buflen = cpu_to_le32(len);
err = brcmf_dev_ioctl(ndev, BRCMF_C_SCAN_RESULTS,
cfg_priv->scan_results, len);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("%s Scan_results error (%d)\n", ndev->name, err);
err = -EINVAL;
scan_abort = true;
@@ -3127,48 +3124,48 @@ static void brcmf_deinit_priv_mem(struct brcmf_cfg80211_priv *cfg_priv)
static s32 brcmf_init_priv_mem(struct brcmf_cfg80211_priv *cfg_priv)
{
cfg_priv->scan_results = kzalloc(WL_SCAN_BUF_MAX, GFP_KERNEL);
- if (unlikely(!cfg_priv->scan_results)) {
+ if (!cfg_priv->scan_results) {
WL_ERR("Scan results alloc failed\n");
goto init_priv_mem_out;
}
cfg_priv->conf = kzalloc(sizeof(*cfg_priv->conf), GFP_KERNEL);
- if (unlikely(!cfg_priv->conf)) {
+ if (!cfg_priv->conf) {
WL_ERR("wl_conf alloc failed\n");
goto init_priv_mem_out;
}
cfg_priv->profile = kzalloc(sizeof(*cfg_priv->profile), GFP_KERNEL);
- if (unlikely(!cfg_priv->profile)) {
+ if (!cfg_priv->profile) {
WL_ERR("wl_profile alloc failed\n");
goto init_priv_mem_out;
}
cfg_priv->bss_info = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL);
- if (unlikely(!cfg_priv->bss_info)) {
+ if (!cfg_priv->bss_info) {
WL_ERR("Bss information alloc failed\n");
goto init_priv_mem_out;
}
cfg_priv->scan_req_int = kzalloc(sizeof(*cfg_priv->scan_req_int),
GFP_KERNEL);
- if (unlikely(!cfg_priv->scan_req_int)) {
+ if (!cfg_priv->scan_req_int) {
WL_ERR("Scan req alloc failed\n");
goto init_priv_mem_out;
}
cfg_priv->ioctl_buf = kzalloc(WL_IOCTL_LEN_MAX, GFP_KERNEL);
- if (unlikely(!cfg_priv->ioctl_buf)) {
+ if (!cfg_priv->ioctl_buf) {
WL_ERR("Ioctl buf alloc failed\n");
goto init_priv_mem_out;
}
cfg_priv->extra_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL);
- if (unlikely(!cfg_priv->extra_buf)) {
+ if (!cfg_priv->extra_buf) {
WL_ERR("Extra buf alloc failed\n");
goto init_priv_mem_out;
}
cfg_priv->iscan = kzalloc(sizeof(*cfg_priv->iscan), GFP_KERNEL);
- if (unlikely(!cfg_priv->iscan)) {
+ if (!cfg_priv->iscan) {
WL_ERR("Iscan buf alloc failed\n");
goto init_priv_mem_out;
}
cfg_priv->pmk_list = kzalloc(sizeof(*cfg_priv->pmk_list), GFP_KERNEL);
- if (unlikely(!cfg_priv->pmk_list)) {
+ if (!cfg_priv->pmk_list) {
WL_ERR("pmk list alloc failed\n");
goto init_priv_mem_out;
}
@@ -3191,7 +3188,7 @@ static struct brcmf_cfg80211_event_q *brcmf_deq_event(
struct brcmf_cfg80211_event_q *e = NULL;
spin_lock_irq(&cfg_priv->evt_q_lock);
- if (likely(!list_empty(&cfg_priv->evt_q_list))) {
+ if (!list_empty(&cfg_priv->evt_q_list)) {
e = list_first_entry(&cfg_priv->evt_q_list,
struct brcmf_cfg80211_event_q, evt_q_list);
list_del(&e->evt_q_list);
@@ -3213,7 +3210,7 @@ brcmf_enq_event(struct brcmf_cfg80211_priv *cfg_priv, u32 event,
s32 err = 0;
e = kzalloc(sizeof(struct brcmf_cfg80211_event_q), GFP_KERNEL);
- if (unlikely(!e)) {
+ if (!e) {
WL_ERR("event alloc failed\n");
return -ENOMEM;
}
@@ -3296,13 +3293,13 @@ static s32 wl_init_priv(struct brcmf_cfg80211_priv *cfg_priv)
cfg_priv->dongle_up = false; /* dongle is not up yet */
brcmf_init_eq(cfg_priv);
err = brcmf_init_priv_mem(cfg_priv);
- if (unlikely(err))
+ if (err)
return err;
INIT_WORK(&cfg_priv->event_work, brcmf_cfg80211_event_handler);
brcmf_init_eloop_handler(&cfg_priv->el);
mutex_init(&cfg_priv->usr_sync);
err = brcmf_init_iscan(cfg_priv);
- if (unlikely(err))
+ if (err)
return err;
brcmf_init_conf(cfg_priv->conf);
brcmf_init_prof(cfg_priv->profile);
@@ -3331,12 +3328,12 @@ struct brcmf_cfg80211_dev *brcmf_cfg80211_attach(struct net_device *ndev,
struct brcmf_cfg80211_dev *cfg_dev;
s32 err = 0;
- if (unlikely(!ndev)) {
+ if (!ndev) {
WL_ERR("ndev is invalid\n");
return NULL;
}
cfg_dev = kzalloc(sizeof(struct brcmf_cfg80211_dev), GFP_KERNEL);
- if (unlikely(!cfg_dev)) {
+ if (!cfg_dev) {
WL_ERR("wl_cfg80211_dev is invalid\n");
return NULL;
}
@@ -3357,7 +3354,7 @@ struct brcmf_cfg80211_dev *brcmf_cfg80211_attach(struct net_device *ndev,
SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy));
wdev->netdev = ndev;
err = wl_init_priv(cfg_priv);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("Failed to init iwm_priv (%d)\n", err);
goto cfg80211_attach_out;
}
@@ -3390,7 +3387,7 @@ brcmf_cfg80211_event(struct net_device *ndev,
u32 event_type = be32_to_cpu(e->event_type);
struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev);
- if (likely(!brcmf_enq_event(cfg_priv, event_type, e)))
+ if (!brcmf_enq_event(cfg_priv, event_type, e))
schedule_work(&cfg_priv->event_work);
}
@@ -3418,7 +3415,7 @@ static s32 brcmf_dongle_mode(struct net_device *ndev, s32 iftype)
return err;
}
err = brcmf_dev_ioctl_u32(ndev, BRCMF_C_SET_INFRA, &infra);
- if (unlikely(err)) {
+ if (err) {
WL_ERR("WLC_SET_INFRA error (%d)\n", err);
return err;
}
@@ -3439,7 +3436,7 @@ static s32 brcmf_dongle_eventmsg(struct net_device *ndev)
brcmu_mkiovar("event_msgs", eventmask, BRCMF_EVENTING_MASK_LEN, iovbuf,
sizeof(iovbuf));
err = brcmf_dev_ioctl(ndev, BRCMF_C_GET_VAR, iovbuf, sizeof(iovbuf));
- if (unlikely(err)) {
+ if (err) {
WL_ERR("Get event_msgs error (%d)\n", err);
goto dongle_eventmsg_out;
}
@@ -3468,7 +3465,7 @@ static s32 brcmf_dongle_eventmsg(struct net_device *ndev)
brcmu_mkiovar("event_msgs", eventmask, BRCMF_EVENTING_MASK_LEN, iovbuf,
sizeof(iovbuf));
err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_VAR, iovbuf, sizeof(iovbuf));
- if (unlikely(err)) {
+ if (err) {
WL_ERR("Set event_msgs error (%d)\n", err);
goto dongle_eventmsg_out;
}
@@ -3495,7 +3492,7 @@ brcmf_dongle_roam(struct net_device *ndev, u32 roamvar, u32 bcn_timeout)
sizeof(bcn_timeout), iovbuf, sizeof(iovbuf));
err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_VAR,
iovbuf, sizeof(iovbuf));
- if (unlikely(err)) {
+ if (err) {
WL_ERR("bcn_timeout error (%d)\n", err);
goto dongle_rom_out;
}
@@ -3509,7 +3506,7 @@ brcmf_dongle_roam(struct net_device *ndev, u32 roamvar, u32 bcn_timeout)
brcmu_mkiovar("roam_off", (char *)&roamvar,
sizeof(roamvar), iovbuf, sizeof(iovbuf));
err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_VAR, iovbuf, sizeof(iovbuf));
- if (unlikely(err)) {
+ if (err) {
WL_ERR("roam_off error (%d)\n", err);
goto dongle_rom_out;
}
@@ -3518,7 +3515,7 @@ brcmf_dongle_roam(struct net_device *ndev, u32 roamvar, u32 bcn_timeout)
roamtrigger[1] = BRCM_BAND_ALL;
err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_ROAM_TRIGGER,
(void *)roamtrigger, sizeof(roamtrigger));
- if (unlikely(err)) {
+ if (err) {
WL_ERR("WLC_SET_ROAM_TRIGGER error (%d)\n", err);
goto dongle_rom_out;
}
@@ -3527,7 +3524,7 @@ brcmf_dongle_roam(struct net_device *ndev, u32 roamvar, u32 bcn_timeout)
roam_delta[1] = BRCM_BAND_ALL;
err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_ROAM_DELTA,
(void *)roam_delta, sizeof(roam_delta));
- if (unlikely(err)) {
+ if (err) {
WL_ERR("WLC_SET_ROAM_DELTA error (%d)\n", err);
goto dongle_rom_out;
}
@@ -3584,7 +3581,7 @@ static s32 wl_update_wiphybands(struct brcmf_cfg80211_priv *cfg_priv)
err = brcmf_dev_ioctl(cfg_to_ndev(cfg_priv), BRCM_GET_PHYLIST,
&phy_list, sizeof(phy_list));
- if (unlikely(err)) {
+ if (err) {
WL_ERR("error (%d)\n", err);
return err;
}
@@ -3624,7 +3621,7 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv,
WL_SCAN_UNASSOC_TIME, WL_SCAN_PASSIVE_TIME);
err = brcmf_dongle_eventmsg(ndev);
- if (unlikely(err))
+ if (err)
goto default_conf_out;
power_mode = cfg_priv->pwr_save ? PM_FAST : PM_OFF;
@@ -3636,13 +3633,13 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv,
err = brcmf_dongle_roam(ndev, (cfg_priv->roam_on ? 0 : 1),
WL_BEACON_TIMEOUT);
- if (unlikely(err))
+ if (err)
goto default_conf_out;
err = brcmf_dongle_mode(ndev, wdev->iftype);
- if (unlikely(err && err != -EINPROGRESS))
+ if (err && err != -EINPROGRESS)
goto default_conf_out;
err = brcmf_dongle_probecap(cfg_priv);
- if (unlikely(err))
+ if (err)
goto default_conf_out;
/* -EINPROGRESS: Call commit handler */
@@ -3700,7 +3697,7 @@ static s32 __brcmf_cfg80211_up(struct brcmf_cfg80211_priv *cfg_priv)
brcmf_debugfs_add_netdev_params(cfg_priv);
err = brcmf_config_dongle(cfg_priv, false);
- if (unlikely(err))
+ if (err)
return err;
brcmf_invoke_iscan(cfg_priv);
@@ -3778,7 +3775,7 @@ static __used s32 brcmf_add_ie(struct brcmf_cfg80211_priv *cfg_priv,
struct brcmf_cfg80211_ie *ie = &cfg_priv->ie;
s32 err = 0;
- if (unlikely(ie->offset + l + 2 > WL_TLV_INFO_MAX)) {
+ if (ie->offset + l + 2 > WL_TLV_INFO_MAX) {
WL_ERR("ei crosses buffer boundary\n");
return -ENOSPC;
}
diff --git a/drivers/staging/brcm80211/brcmsmac/ampdu.c b/drivers/staging/brcm80211/brcmsmac/ampdu.c
index 47dc27a..d221a3a 100644
--- a/drivers/staging/brcm80211/brcmsmac/ampdu.c
+++ b/drivers/staging/brcm80211/brcmsmac/ampdu.c
@@ -1132,7 +1132,7 @@ brcms_c_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb,
s2 = R_REG(&wlc->regs->frmtxstatus2);
}
- if (likely(scb)) {
+ if (scb) {
scb_ampdu = &scb->scb_ampdu;
ini = &scb_ampdu->ini[p->priority];
brcms_c_ampdu_dotxstatus_complete(ampdu, scb, p, txs, s1, s2);
--
1.7.1
Put boundary settings in brcmf_bus structure
Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd_bus.h | 4 ----
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 24 ++++++++++--------------
2 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_bus.h b/drivers/staging/brcm80211/brcmfmac/dhd_bus.h
index 104c0e7..a5064f5 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_bus.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_bus.h
@@ -27,10 +27,6 @@
* Exported from brcmf bus module (brcmf_usb, brcmf_sdio)
*/
-/* Tx/Rx bounds module parameters */
-extern uint brcmf_txbound;
-extern uint brcmf_rxbound;
-
/* Indicate (dis)interest in finding dongles. */
extern int brcmf_bus_register(void);
extern void brcmf_bus_unregister(void);
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 57049ec..66ab752 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -588,6 +588,10 @@ struct brcmf_bus {
u8 rx_seq; /* Receive sequence number (expected) */
bool rxskip; /* Skip receive (awaiting NAK ACK) */
+ uint rxbound; /* Rx frames to read before resched */
+ uint txbound; /* Tx frames to send before resched */
+ uint txminmax;
+
struct sk_buff *glomd; /* Packet containing glomming descriptor */
struct sk_buff *glom; /* Packet chain for glommed superframe */
uint glomerr; /* Glom packet read errors */
@@ -740,13 +744,6 @@ module_param(brcmf_watchdog_prio, int, 0);
int brcmf_dpc_prio = 98;
module_param(brcmf_dpc_prio, int, 0);
-/* Tx/Rx bounds */
-uint brcmf_txbound;
-uint brcmf_rxbound;
-module_param(brcmf_txbound, uint, 0);
-module_param(brcmf_rxbound, uint, 0);
-static uint brcmf_txminmax;
-
#define SDIO_DRIVE_STRENGTH 6 /* in milliamps */
/* Use polling */
@@ -2488,8 +2485,8 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus)
{
u32 intstatus, newstatus = 0;
uint retries = 0;
- uint rxlimit = brcmf_rxbound; /* Rx frames to read before resched */
- uint txlimit = brcmf_txbound; /* Tx frames to send before resched */
+ uint rxlimit = bus->rxbound; /* Rx frames to read before resched */
+ uint txlimit = bus->txbound; /* Tx frames to send before resched */
uint framecnt = 0; /* Temporary counter of tx/rx frames */
bool rxdone = true; /* Flag for no more read data */
bool resched = false; /* Flag indicating resched wanted */
@@ -2690,7 +2687,7 @@ clkwait:
else if ((bus->clkstate == CLK_AVAIL) && !bus->fcstate &&
brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol) && txlimit
&& data_ok(bus)) {
- framecnt = rxdone ? txlimit : min(txlimit, brcmf_txminmax);
+ framecnt = rxdone ? txlimit : min(txlimit, bus->txminmax);
framecnt = brcmf_sdbrcm_sendfromq(bus, framecnt);
txlimit -= framecnt;
}
@@ -4779,10 +4776,6 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
* first time that the driver is initialized vs subsequent
* initializations.
*/
- brcmf_txbound = BRCMF_TXBOUND;
- brcmf_rxbound = BRCMF_RXBOUND;
- brcmf_txminmax = BRCMF_TXMINMAX;
-
brcmf_c_init();
brcmf_dbg(TRACE, "Enter\n");
@@ -4798,6 +4791,9 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
}
bus->sdiodev = sdiodev;
sdiodev->bus = bus;
+ bus->txbound = BRCMF_TXBOUND;
+ bus->rxbound = BRCMF_RXBOUND;
+ bus->txminmax = BRCMF_TXMINMAX;
bus->tx_seq = SDPCM_SEQUENCE_WRAP - 1;
bus->usebufpool = false; /* Use bufpool if allocated,
else use locally malloced rxbuf */
--
1.7.1
From: Roland Vossen <[email protected]>
Code cleanup. Various names (ndev, net, dev) were used for the
same structure. Settled for 'ndev'.
Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd.h | 6 +-
drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 214 +++++++++++----------
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 219 +++++++++++-----------
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h | 2 +-
4 files changed, 225 insertions(+), 216 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index 7ab45d9..a16f731 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -722,9 +722,9 @@ static inline void MUTEX_UNLOCK_WL_SCAN_SET(void)
extern struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus,
uint bus_hdrlen);
extern int brcmf_net_attach(struct brcmf_pub *drvr, int idx);
-extern int brcmf_netdev_wait_pend8021x(struct net_device *dev);
+extern int brcmf_netdev_wait_pend8021x(struct net_device *ndev);
-extern int brcmf_netdev_ioctl_priv(struct net_device *net,
+extern int brcmf_netdev_ioctl_priv(struct net_device *ndev,
struct brcmf_ioctl *ioc);
/* Indication from bus module regarding removal/absence of dongle */
@@ -766,7 +766,7 @@ extern int brcmf_c_host_event(struct brcmf_info *drvr_priv, int *idx,
extern void brcmf_c_init(void);
extern int brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx,
- struct net_device *net, char *name, u8 *mac_addr,
+ struct net_device *ndev, char *name, u8 *mac_addr,
u32 flags, u8 bssidx);
extern void brcmf_del_if(struct brcmf_info *drvr_priv, int ifidx);
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index 659a9c2..827022e 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -53,7 +53,7 @@ MODULE_LICENSE("Dual BSD/GPL");
struct brcmf_if {
struct brcmf_info *info; /* back pointer to brcmf_info */
/* OS/stack specifics */
- struct net_device *net;
+ struct net_device *ndev;
struct net_device_stats stats;
int idx; /* iface idx in dongle */
int state; /* interface state */
@@ -83,12 +83,12 @@ struct brcmf_info {
module_param(brcmf_msg_level, int, 0);
-static int brcmf_net2idx(struct brcmf_info *drvr_priv, struct net_device *net)
+static int brcmf_net2idx(struct brcmf_info *drvr_priv, struct net_device *ndev)
{
int i = 0;
while (i < BRCMF_MAX_IFS) {
- if (drvr_priv->iflist[i] && (drvr_priv->iflist[i]->net == net))
+ if (drvr_priv->iflist[i] && drvr_priv->iflist[i]->ndev == ndev)
return i;
i++;
}
@@ -127,15 +127,15 @@ char *brcmf_ifname(struct brcmf_pub *drvr, int ifidx)
return "<if_null>";
}
- if (drvr_priv->iflist[ifidx]->net)
- return drvr_priv->iflist[ifidx]->net->name;
+ if (drvr_priv->iflist[ifidx]->ndev)
+ return drvr_priv->iflist[ifidx]->ndev->name;
return "<if_none>";
}
static void _brcmf_set_multicast_list(struct work_struct *work)
{
- struct net_device *dev;
+ struct net_device *ndev;
struct netdev_hw_addr *ha;
u32 allmulti, cnt;
__le32 cnt_le;
@@ -149,11 +149,11 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
struct brcmf_info *drvr_priv = container_of(work, struct brcmf_info,
multicast_work);
- dev = drvr_priv->iflist[0]->net;
- cnt = netdev_mc_count(dev);
+ ndev = drvr_priv->iflist[0]->ndev;
+ cnt = netdev_mc_count(ndev);
/* Determine initial value of allmulti flag */
- allmulti = (dev->flags & IFF_ALLMULTI) ? true : false;
+ allmulti = (ndev->flags & IFF_ALLMULTI) ? true : false;
/* Send down the multicast list first. */
@@ -169,7 +169,7 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
memcpy(bufp, &cnt_le, sizeof(cnt));
bufp += sizeof(cnt_le);
- netdev_for_each_mc_addr(ha, dev) {
+ netdev_for_each_mc_addr(ha, ndev) {
if (!cnt)
break;
memcpy(bufp, ha->addr, ETH_ALEN);
@@ -232,7 +232,7 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
/* Finally, pick up the PROMISC flag as well, like the NIC
driver does */
- allmulti = (dev->flags & IFF_PROMISC) ? true : false;
+ allmulti = (ndev->flags & IFF_PROMISC) ? true : false;
allmulti_le = cpu_to_le32(allmulti);
memset(&ioc, 0, sizeof(ioc));
@@ -277,7 +277,7 @@ _brcmf_set_mac_address(struct work_struct *work)
brcmf_dbg(ERROR, "%s: set cur_etheraddr failed\n",
brcmf_ifname(&drvr_priv->pub, 0));
else
- memcpy(drvr_priv->iflist[0]->net->dev_addr,
+ memcpy(drvr_priv->iflist[0]->ndev->dev_addr,
drvr_priv->macvalue, ETH_ALEN);
return;
@@ -299,23 +299,23 @@ static void brcmf_op_if(struct brcmf_if *ifp)
* Delete the existing interface before overwriting it
* in case we missed the BRCMF_E_IF_DEL event.
*/
- if (ifp->net != NULL) {
+ if (ifp->ndev != NULL) {
brcmf_dbg(ERROR, "ERROR: netdev:%s already exists, try free & unregister\n",
- ifp->net->name);
- netif_stop_queue(ifp->net);
- unregister_netdev(ifp->net);
- free_netdev(ifp->net);
+ ifp->ndev->name);
+ netif_stop_queue(ifp->ndev);
+ unregister_netdev(ifp->ndev);
+ free_netdev(ifp->ndev);
}
/* Allocate netdev, including space for private structure */
- ifp->net = alloc_netdev(sizeof(drvr_priv), "wlan%d",
- ether_setup);
- if (!ifp->net) {
+ ifp->ndev = alloc_netdev(sizeof(drvr_priv), "wlan%d",
+ ether_setup);
+ if (!ifp->ndev) {
brcmf_dbg(ERROR, "OOM - alloc_netdev\n");
ret = -ENOMEM;
}
if (ret == 0) {
- strcpy(ifp->net->name, ifp->name);
- memcpy(netdev_priv(ifp->net), &drvr_priv,
+ strcpy(ifp->ndev->name, ifp->name);
+ memcpy(netdev_priv(ifp->ndev), &drvr_priv,
sizeof(drvr_priv));
err = brcmf_net_attach(&drvr_priv->pub, ifp->idx);
if (err != 0) {
@@ -324,16 +324,16 @@ static void brcmf_op_if(struct brcmf_if *ifp)
ret = -EOPNOTSUPP;
} else {
brcmf_dbg(TRACE, " ==== pid:%x, net_device for if:%s created ===\n",
- current->pid, ifp->net->name);
+ current->pid, ifp->ndev->name);
ifp->state = 0;
}
}
break;
case BRCMF_E_IF_DEL:
- if (ifp->net != NULL) {
+ if (ifp->ndev != NULL) {
brcmf_dbg(TRACE, "got 'WLC_E_IF_DEL' state\n");
- netif_stop_queue(ifp->net);
- unregister_netdev(ifp->net);
+ netif_stop_queue(ifp->ndev);
+ unregister_netdev(ifp->ndev);
ret = BRCMF_DEL_IF; /* Make sure the free_netdev()
is called */
}
@@ -344,21 +344,22 @@ static void brcmf_op_if(struct brcmf_if *ifp)
}
if (ret < 0) {
- if (ifp->net)
- free_netdev(ifp->net);
+ if (ifp->ndev)
+ free_netdev(ifp->ndev);
drvr_priv->iflist[ifp->idx] = NULL;
kfree(ifp);
}
}
-static int brcmf_netdev_set_mac_address(struct net_device *dev, void *addr)
+static int brcmf_netdev_set_mac_address(struct net_device *ndev, void *addr)
{
- struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(dev);
+ struct brcmf_info *drvr_priv = *(struct brcmf_info **)
+ netdev_priv(ndev);
struct sockaddr *sa = (struct sockaddr *)addr;
int ifidx;
- ifidx = brcmf_net2idx(drvr_priv, dev);
+ ifidx = brcmf_net2idx(drvr_priv, ndev);
if (ifidx == BRCMF_BAD_IF)
return -1;
@@ -367,12 +368,13 @@ static int brcmf_netdev_set_mac_address(struct net_device *dev, void *addr)
return 0;
}
-static void brcmf_netdev_set_multicast_list(struct net_device *dev)
+static void brcmf_netdev_set_multicast_list(struct net_device *ndev)
{
- struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(dev);
+ struct brcmf_info *drvr_priv = *(struct brcmf_info **)
+ netdev_priv(ndev);
int ifidx;
- ifidx = brcmf_net2idx(drvr_priv, dev);
+ ifidx = brcmf_net2idx(drvr_priv, ndev);
if (ifidx == BRCMF_BAD_IF)
return;
@@ -405,10 +407,11 @@ int brcmf_sendpkt(struct brcmf_pub *drvr, int ifidx, struct sk_buff *pktbuf)
return brcmf_sdbrcm_bus_txdata(drvr->bus, pktbuf);
}
-static int brcmf_netdev_start_xmit(struct sk_buff *skb, struct net_device *net)
+static int brcmf_netdev_start_xmit(struct sk_buff *skb, struct net_device *ndev)
{
int ret;
- struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net);
+ struct brcmf_info *drvr_priv = *(struct brcmf_info **)
+ netdev_priv(ndev);
int ifidx;
brcmf_dbg(TRACE, "Enter\n");
@@ -417,14 +420,14 @@ static int brcmf_netdev_start_xmit(struct sk_buff *skb, struct net_device *net)
if (!drvr_priv->pub.up || (drvr_priv->pub.busstate == BRCMF_BUS_DOWN)) {
brcmf_dbg(ERROR, "xmit rejected pub.up=%d busstate=%d\n",
drvr_priv->pub.up, drvr_priv->pub.busstate);
- netif_stop_queue(net);
+ netif_stop_queue(ndev);
return -ENODEV;
}
- ifidx = brcmf_net2idx(drvr_priv, net);
+ ifidx = brcmf_net2idx(drvr_priv, ndev);
if (ifidx == BRCMF_BAD_IF) {
brcmf_dbg(ERROR, "bad ifidx %d\n", ifidx);
- netif_stop_queue(net);
+ netif_stop_queue(ndev);
return -ENODEV;
}
@@ -460,17 +463,17 @@ done:
void brcmf_txflowcontrol(struct brcmf_pub *drvr, int ifidx, bool state)
{
- struct net_device *net;
+ struct net_device *ndev;
struct brcmf_info *drvr_priv = drvr->info;
brcmf_dbg(TRACE, "Enter\n");
drvr->txoff = state;
- net = drvr_priv->iflist[ifidx]->net;
+ ndev = drvr_priv->iflist[ifidx]->ndev;
if (state == ON)
- netif_stop_queue(net);
+ netif_stop_queue(ndev);
else
- netif_wake_queue(net);
+ netif_wake_queue(ndev);
}
static int brcmf_host_event(struct brcmf_info *drvr_priv, int *ifidx,
@@ -483,8 +486,8 @@ static int brcmf_host_event(struct brcmf_info *drvr_priv, int *ifidx,
if (bcmerror != 0)
return bcmerror;
- if (drvr_priv->iflist[*ifidx]->net)
- brcmf_cfg80211_event(drvr_priv->iflist[*ifidx]->net,
+ if (drvr_priv->iflist[*ifidx]->ndev)
+ brcmf_cfg80211_event(drvr_priv->iflist[*ifidx]->ndev,
event, *data);
return bcmerror;
@@ -530,7 +533,7 @@ void brcmf_rx_frame(struct brcmf_pub *drvr, int ifidx, struct sk_buff *skb,
if (ifp == NULL)
ifp = drvr_priv->iflist[0];
- skb->dev = ifp->net;
+ skb->dev = ifp->ndev;
skb->protocol = eth_type_trans(skb, skb->dev);
if (skb->pkt_type == PACKET_MULTICAST)
@@ -552,8 +555,8 @@ void brcmf_rx_frame(struct brcmf_pub *drvr, int ifidx, struct sk_buff *skb,
!drvr_priv->iflist[ifidx]->state)
ifp = drvr_priv->iflist[ifidx];
- if (ifp->net)
- ifp->net->last_rx = jiffies;
+ if (ifp->ndev)
+ ifp->ndev->last_rx = jiffies;
drvr->dstats.rx_bytes += skb->len;
drvr->rx_packets++; /* Local count */
@@ -588,15 +591,16 @@ void brcmf_txcomplete(struct brcmf_pub *drvr, struct sk_buff *txp, bool success)
}
-static struct net_device_stats *brcmf_netdev_get_stats(struct net_device *net)
+static struct net_device_stats *brcmf_netdev_get_stats(struct net_device *ndev)
{
- struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net);
+ struct brcmf_info *drvr_priv = *(struct brcmf_info **)
+ netdev_priv(ndev);
struct brcmf_if *ifp;
int ifidx;
brcmf_dbg(TRACE, "Enter\n");
- ifidx = brcmf_net2idx(drvr_priv, net);
+ ifidx = brcmf_net2idx(drvr_priv, ndev);
if (ifidx == BRCMF_BAD_IF)
return NULL;
@@ -698,10 +702,11 @@ static int brcmf_toe_set(struct brcmf_info *drvr_priv, int ifidx, u32 toe_ol)
return 0;
}
-static void brcmf_ethtool_get_drvinfo(struct net_device *net,
+static void brcmf_ethtool_get_drvinfo(struct net_device *ndev,
struct ethtool_drvinfo *info)
{
- struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net);
+ struct brcmf_info *drvr_priv = *(struct brcmf_info **)
+ netdev_priv(ndev);
sprintf(info->driver, KBUILD_MODNAME);
sprintf(info->version, "%lu", drvr_priv->pub.drv_version);
@@ -809,10 +814,10 @@ static int brcmf_ethtool(struct brcmf_info *drvr_priv, void __user *uaddr)
/* If setting TX checksum mode, tell Linux the new mode */
if (cmd == ETHTOOL_STXCSUM) {
if (edata.data)
- drvr_priv->iflist[0]->net->features |=
+ drvr_priv->iflist[0]->ndev->features |=
NETIF_F_IP_CSUM;
else
- drvr_priv->iflist[0]->net->features &=
+ drvr_priv->iflist[0]->ndev->features &=
~NETIF_F_IP_CSUM;
}
@@ -825,13 +830,14 @@ static int brcmf_ethtool(struct brcmf_info *drvr_priv, void __user *uaddr)
return 0;
}
-static int brcmf_netdev_ioctl_entry(struct net_device *net, struct ifreq *ifr,
+static int brcmf_netdev_ioctl_entry(struct net_device *ndev, struct ifreq *ifr,
int cmd)
{
- struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net);
+ struct brcmf_info *drvr_priv = *(struct brcmf_info **)
+ netdev_priv(ndev);
int ifidx;
- ifidx = brcmf_net2idx(drvr_priv, net);
+ ifidx = brcmf_net2idx(drvr_priv, ndev);
brcmf_dbg(TRACE, "ifidx %d, cmd 0x%04x\n", ifidx, cmd);
if (ifidx == BRCMF_BAD_IF)
@@ -844,15 +850,16 @@ static int brcmf_netdev_ioctl_entry(struct net_device *net, struct ifreq *ifr,
}
/* called only from within this driver */
-int brcmf_netdev_ioctl_priv(struct net_device *net, struct brcmf_ioctl *ioc)
+int brcmf_netdev_ioctl_priv(struct net_device *ndev, struct brcmf_ioctl *ioc)
{
int bcmerror = 0;
int buflen = 0;
bool is_set_key_cmd;
- struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net);
+ struct brcmf_info *drvr_priv = *(struct brcmf_info **)
+ netdev_priv(ndev);
int ifidx;
- ifidx = brcmf_net2idx(drvr_priv, net);
+ ifidx = brcmf_net2idx(drvr_priv, ndev);
if (ioc->buf != NULL)
buflen = min_t(uint, ioc->len, BRCMF_IOCTL_MAXLEN);
@@ -879,7 +886,7 @@ int brcmf_netdev_ioctl_priv(struct net_device *net, struct brcmf_ioctl *ioc)
((ioc->cmd == BRCMF_C_SET_VAR) &&
!(strncmp("bsscfg:wsec_key", ioc->buf, 15))));
if (is_set_key_cmd)
- brcmf_netdev_wait_pend8021x(net);
+ brcmf_netdev_wait_pend8021x(ndev);
bcmerror = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, ioc, buflen);
@@ -890,9 +897,9 @@ done:
return bcmerror;
}
-static int brcmf_netdev_stop(struct net_device *net)
+static int brcmf_netdev_stop(struct net_device *ndev)
{
- struct brcmf_pub *drvr = *(struct brcmf_pub **) netdev_priv(net);
+ struct brcmf_pub *drvr = *(struct brcmf_pub **) netdev_priv(ndev);
brcmf_dbg(TRACE, "Enter\n");
brcmf_cfg80211_down(drvr->config);
@@ -901,16 +908,17 @@ static int brcmf_netdev_stop(struct net_device *net)
/* Set state and stop OS transmissions */
drvr->up = 0;
- netif_stop_queue(net);
+ netif_stop_queue(ndev);
return 0;
}
-static int brcmf_netdev_open(struct net_device *net)
+static int brcmf_netdev_open(struct net_device *ndev)
{
- struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net);
+ struct brcmf_info *drvr_priv = *(struct brcmf_info **)
+ netdev_priv(ndev);
u32 toe_ol;
- int ifidx = brcmf_net2idx(drvr_priv, net);
+ int ifidx = brcmf_net2idx(drvr_priv, ndev);
s32 ret = 0;
brcmf_dbg(TRACE, "ifidx %d\n", ifidx);
@@ -925,19 +933,19 @@ static int brcmf_netdev_open(struct net_device *net)
}
atomic_set(&drvr_priv->pend_8021x_cnt, 0);
- memcpy(net->dev_addr, drvr_priv->pub.mac, ETH_ALEN);
+ memcpy(ndev->dev_addr, drvr_priv->pub.mac, ETH_ALEN);
/* Get current TOE mode from dongle */
if (brcmf_toe_get(drvr_priv, ifidx, &toe_ol) >= 0
&& (toe_ol & TOE_TX_CSUM_OL) != 0)
- drvr_priv->iflist[ifidx]->net->features |=
+ drvr_priv->iflist[ifidx]->ndev->features |=
NETIF_F_IP_CSUM;
else
- drvr_priv->iflist[ifidx]->net->features &=
+ drvr_priv->iflist[ifidx]->ndev->features &=
~NETIF_F_IP_CSUM;
}
/* Allow transmit calls */
- netif_start_queue(net);
+ netif_start_queue(ndev);
drvr_priv->pub.up = 1;
if (brcmf_cfg80211_up(drvr_priv->pub.config)) {
brcmf_dbg(ERROR, "failed to bring up cfg80211\n");
@@ -948,12 +956,12 @@ static int brcmf_netdev_open(struct net_device *net)
}
int
-brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, struct net_device *net,
+brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, struct net_device *ndev,
char *name, u8 *mac_addr, u32 flags, u8 bssidx)
{
struct brcmf_if *ifp;
- brcmf_dbg(TRACE, "idx %d, handle->%p\n", ifidx, net);
+ brcmf_dbg(TRACE, "idx %d, handle->%p\n", ifidx, ndev);
ifp = drvr_priv->iflist[ifidx];
if (!ifp) {
@@ -969,12 +977,12 @@ brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, struct net_device *net,
if (mac_addr != NULL)
memcpy(&ifp->mac_addr, mac_addr, ETH_ALEN);
- if (net == NULL) {
+ if (ndev == NULL) {
ifp->state = BRCMF_E_IF_ADD;
ifp->idx = ifidx;
brcmf_op_if(ifp);
} else
- ifp->net = net;
+ ifp->ndev = ndev;
return 0;
}
@@ -999,13 +1007,13 @@ void brcmf_del_if(struct brcmf_info *drvr_priv, int ifidx)
struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, uint bus_hdrlen)
{
struct brcmf_info *drvr_priv = NULL;
- struct net_device *net;
+ struct net_device *ndev;
brcmf_dbg(TRACE, "Enter\n");
/* Allocate netdev, including space for private structure */
- net = alloc_netdev(sizeof(drvr_priv), "wlan%d", ether_setup);
- if (!net) {
+ ndev = alloc_netdev(sizeof(drvr_priv), "wlan%d", ether_setup);
+ if (!ndev) {
brcmf_dbg(ERROR, "OOM - alloc_netdev\n");
goto fail;
}
@@ -1018,13 +1026,13 @@ struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, uint bus_hdrlen)
/*
* Save the brcmf_info into the priv
*/
- memcpy(netdev_priv(net), &drvr_priv, sizeof(drvr_priv));
+ memcpy(netdev_priv(ndev), &drvr_priv, sizeof(drvr_priv));
- if (brcmf_add_if(drvr_priv, 0, net, net->name, NULL, 0, 0) ==
+ if (brcmf_add_if(drvr_priv, 0, ndev, ndev->name, NULL, 0, 0) ==
BRCMF_BAD_IF)
goto fail;
- net->netdev_ops = NULL;
+ ndev->netdev_ops = NULL;
mutex_init(&drvr_priv->proto_block);
/* Link to info module */
@@ -1042,7 +1050,7 @@ struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, uint bus_hdrlen)
/* Attach and link in the cfg80211 */
drvr_priv->pub.config =
- brcmf_cfg80211_attach(net,
+ brcmf_cfg80211_attach(ndev,
brcmf_bus_get_device(bus),
&drvr_priv->pub);
if (drvr_priv->pub.config == NULL) {
@@ -1056,13 +1064,13 @@ struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, uint bus_hdrlen)
/*
* Save the brcmf_info into the priv
*/
- memcpy(netdev_priv(net), &drvr_priv, sizeof(drvr_priv));
+ memcpy(netdev_priv(ndev), &drvr_priv, sizeof(drvr_priv));
return &drvr_priv->pub;
fail:
- if (net)
- free_netdev(net);
+ if (ndev)
+ free_netdev(ndev);
if (drvr_priv)
brcmf_detach(&drvr_priv->pub);
@@ -1143,14 +1151,14 @@ static struct net_device_ops brcmf_netdev_ops_pri = {
int brcmf_net_attach(struct brcmf_pub *drvr, int ifidx)
{
struct brcmf_info *drvr_priv = drvr->info;
- struct net_device *net;
+ struct net_device *ndev;
u8 temp_addr[ETH_ALEN] = {
0x00, 0x90, 0x4c, 0x11, 0x22, 0x33};
brcmf_dbg(TRACE, "ifidx %d\n", ifidx);
- net = drvr_priv->iflist[ifidx]->net;
- net->netdev_ops = &brcmf_netdev_ops_pri;
+ ndev = drvr_priv->iflist[ifidx]->ndev;
+ ndev->netdev_ops = &brcmf_netdev_ops_pri;
/*
* We have to use the primary MAC for virtual interfaces
@@ -1168,25 +1176,25 @@ int brcmf_net_attach(struct brcmf_pub *drvr, int ifidx)
- Locally Administered address */
}
- net->hard_header_len = ETH_HLEN + drvr_priv->pub.hdrlen;
- net->ethtool_ops = &brcmf_ethtool_ops;
+ ndev->hard_header_len = ETH_HLEN + drvr_priv->pub.hdrlen;
+ ndev->ethtool_ops = &brcmf_ethtool_ops;
- drvr_priv->pub.rxsz = net->mtu + net->hard_header_len +
- drvr_priv->pub.hdrlen;
+ drvr_priv->pub.rxsz = ndev->mtu + ndev->hard_header_len +
+ drvr_priv->pub.hdrlen;
- memcpy(net->dev_addr, temp_addr, ETH_ALEN);
+ memcpy(ndev->dev_addr, temp_addr, ETH_ALEN);
- if (register_netdev(net) != 0) {
+ if (register_netdev(ndev) != 0) {
brcmf_dbg(ERROR, "couldn't register the net device\n");
goto fail;
}
- brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", net->name);
+ brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name);
return 0;
fail:
- net->netdev_ops = NULL;
+ ndev->netdev_ops = NULL;
return -EBADE;
}
@@ -1225,9 +1233,9 @@ void brcmf_detach(struct brcmf_pub *drvr)
brcmf_del_if(drvr_priv, i);
ifp = drvr_priv->iflist[0];
- if (ifp->net->netdev_ops == &brcmf_netdev_ops_pri) {
- brcmf_netdev_stop(ifp->net);
- unregister_netdev(ifp->net);
+ if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
+ brcmf_netdev_stop(ifp->ndev);
+ unregister_netdev(ifp->ndev);
}
cancel_work_sync(&drvr_priv->setmacaddr_work);
@@ -1240,7 +1248,7 @@ void brcmf_detach(struct brcmf_pub *drvr)
brcmf_cfg80211_detach(drvr->config);
- free_netdev(ifp->net);
+ free_netdev(ifp->ndev);
kfree(ifp);
kfree(drvr_priv);
}
@@ -1305,9 +1313,9 @@ static int brcmf_get_pend_8021x_cnt(struct brcmf_info *drvr_priv)
#define MAX_WAIT_FOR_8021X_TX 10
-int brcmf_netdev_wait_pend8021x(struct net_device *dev)
+int brcmf_netdev_wait_pend8021x(struct net_device *ndev)
{
- struct brcmf_info *drvr_priv = *(struct brcmf_info **)netdev_priv(dev);
+ struct brcmf_info *drvr_priv = *(struct brcmf_info **)netdev_priv(ndev);
int timeout = 10 * HZ / 1000;
int ntimes = MAX_WAIT_FOR_8021X_TX;
int pend = brcmf_get_pend_8021x_cnt(drvr_priv);
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index 45c9e78..b707bc0 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -267,12 +267,12 @@ brcmf_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
/* function for reading/writing a single u32 from/to the dongle */
static int
-brcmf_dev_ioctl_u32(struct net_device *dev, u32 cmd, u32 *par)
+brcmf_dev_ioctl_u32(struct net_device *ndev, u32 cmd, u32 *par)
{
int err;
__le32 par_le = cpu_to_le32(*par);
- err = brcmf_dev_ioctl(dev, cmd, &par_le, sizeof(__le32));
+ err = brcmf_dev_ioctl(ndev, cmd, &par_le, sizeof(__le32));
*par = le32_to_cpu(par_le);
return err;
@@ -292,14 +292,14 @@ static void convert_key_from_CPU(struct brcmf_wsec_key *key,
memcpy(key_le->ea, key->ea, sizeof(key->ea));
}
-static int send_key_to_dongle(struct net_device *dev,
+static int send_key_to_dongle(struct net_device *ndev,
struct brcmf_wsec_key *key)
{
int err;
struct brcmf_wsec_key_le key_le;
convert_key_from_CPU(key, &key_le);
- err = brcmf_dev_ioctl(dev, BRCMF_C_SET_KEY, &key_le, sizeof(key_le));
+ err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_KEY, &key_le, sizeof(key_le));
if (err)
WL_ERR("WLC_SET_KEY error (%d)\n", err);
return err;
@@ -356,7 +356,7 @@ done:
return err;
}
-static s32 brcmf_dev_intvar_set(struct net_device *dev, s8 *name, s32 val)
+static s32 brcmf_dev_intvar_set(struct net_device *ndev, s8 *name, s32 val)
{
s8 buf[BRCMF_C_IOCTL_SMLEN];
u32 len;
@@ -368,7 +368,7 @@ static s32 brcmf_dev_intvar_set(struct net_device *dev, s8 *name, s32 val)
sizeof(buf));
BUG_ON(!len);
- err = brcmf_dev_ioctl(dev, BRCMF_C_SET_VAR, buf, len);
+ err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_VAR, buf, len);
if (err)
WL_ERR("error (%d)\n", err);
@@ -376,7 +376,7 @@ static s32 brcmf_dev_intvar_set(struct net_device *dev, s8 *name, s32 val)
}
static s32
-brcmf_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval)
+brcmf_dev_intvar_get(struct net_device *ndev, s8 *name, s32 *retval)
{
union {
s8 buf[BRCMF_C_IOCTL_SMLEN];
@@ -390,7 +390,7 @@ brcmf_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval)
brcmu_mkiovar(name, (char *)(&data_null), 0, (char *)(&var),
sizeof(var.buf));
BUG_ON(!len);
- err = brcmf_dev_ioctl(dev, BRCMF_C_GET_VAR, &var, len);
+ err = brcmf_dev_ioctl(ndev, BRCMF_C_GET_VAR, &var, len);
if (err)
WL_ERR("error (%d)\n", err);
@@ -430,7 +430,7 @@ static void wl_iscan_prep(struct brcmf_scan_params_le *params_le,
}
static s32
-brcmf_dev_iovar_setbuf(struct net_device *dev, s8 * iovar, void *param,
+brcmf_dev_iovar_setbuf(struct net_device *ndev, s8 * iovar, void *param,
s32 paramlen, void *bufptr, s32 buflen)
{
s32 iolen;
@@ -438,11 +438,11 @@ brcmf_dev_iovar_setbuf(struct net_device *dev, s8 * iovar, void *param,
iolen = brcmu_mkiovar(iovar, param, paramlen, bufptr, buflen);
BUG_ON(!iolen);
- return brcmf_dev_ioctl(dev, BRCMF_C_SET_VAR, bufptr, iolen);
+ return brcmf_dev_ioctl(ndev, BRCMF_C_SET_VAR, bufptr, iolen);
}
static s32
-brcmf_dev_iovar_getbuf(struct net_device *dev, s8 * iovar, void *param,
+brcmf_dev_iovar_getbuf(struct net_device *ndev, s8 * iovar, void *param,
s32 paramlen, void *bufptr, s32 buflen)
{
s32 iolen;
@@ -450,7 +450,7 @@ brcmf_dev_iovar_getbuf(struct net_device *dev, s8 * iovar, void *param,
iolen = brcmu_mkiovar(iovar, param, paramlen, bufptr, buflen);
BUG_ON(!iolen);
- return brcmf_dev_ioctl(dev, BRCMF_C_GET_VAR, bufptr, buflen);
+ return brcmf_dev_ioctl(ndev, BRCMF_C_GET_VAR, bufptr, buflen);
}
static s32
@@ -475,8 +475,8 @@ brcmf_run_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan,
params->action = cpu_to_le16(action);
params->scan_duration = cpu_to_le16(0);
- err = brcmf_dev_iovar_setbuf(iscan->dev, "iscan", params, params_size,
- iscan->ioctl_buf, BRCMF_C_IOCTL_SMLEN);
+ err = brcmf_dev_iovar_setbuf(iscan->ndev, "iscan", params, params_size,
+ iscan->ioctl_buf, BRCMF_C_IOCTL_SMLEN);
if (err) {
if (err == -EBUSY)
WL_INFO("system busy : iscan canceled\n");
@@ -634,34 +634,34 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
return err;
}
-static s32 brcmf_set_rts(struct net_device *dev, u32 rts_threshold)
+static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_threshold)
{
s32 err = 0;
- err = brcmf_dev_intvar_set(dev, "rtsthresh", rts_threshold);
+ err = brcmf_dev_intvar_set(ndev, "rtsthresh", rts_threshold);
if (err)
WL_ERR("Error (%d)\n", err);
return err;
}
-static s32 brcmf_set_frag(struct net_device *dev, u32 frag_threshold)
+static s32 brcmf_set_frag(struct net_device *ndev, u32 frag_threshold)
{
s32 err = 0;
- err = brcmf_dev_intvar_set(dev, "fragthresh", frag_threshold);
+ err = brcmf_dev_intvar_set(ndev, "fragthresh", frag_threshold);
if (err)
WL_ERR("Error (%d)\n", err);
return err;
}
-static s32 brcmf_set_retry(struct net_device *dev, u32 retry, bool l)
+static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l)
{
s32 err = 0;
u32 cmd = (l ? BRCM_SET_LRL : BRCM_SET_SRL);
- err = brcmf_dev_ioctl_u32(dev, cmd, &retry);
+ err = brcmf_dev_ioctl_u32(ndev, cmd, &retry);
if (err) {
WL_ERR("cmd (%d) , error (%d)\n", cmd, err);
return err;
@@ -802,15 +802,15 @@ static void brcmf_ch_to_chanspec(int ch, struct brcmf_join_params *join_params,
static void brcmf_link_down(struct brcmf_cfg80211_priv *cfg_priv)
{
- struct net_device *dev = NULL;
+ struct net_device *ndev = NULL;
s32 err = 0;
WL_TRACE("Enter\n");
if (cfg_priv->link_up) {
- dev = cfg_to_ndev(cfg_priv);
+ ndev = cfg_to_ndev(cfg_priv);
WL_INFO("Call WLC_DISASSOC to stop excess roaming\n ");
- err = brcmf_dev_ioctl(dev, BRCMF_C_DISASSOC, NULL, 0);
+ err = brcmf_dev_ioctl(ndev, BRCMF_C_DISASSOC, NULL, 0);
if (err)
WL_ERR("WLC_DISASSOC failed (%d)\n", err);
cfg_priv->link_up = false;
@@ -819,7 +819,7 @@ static void brcmf_link_down(struct brcmf_cfg80211_priv *cfg_priv)
}
static s32
-brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
+brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
struct cfg80211_ibss_params *params)
{
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
@@ -884,7 +884,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
if (params->privacy)
wsec |= WEP_ENABLED;
- err = brcmf_dev_intvar_set(dev, "wsec", wsec);
+ err = brcmf_dev_intvar_set(ndev, "wsec", wsec);
if (err) {
WL_ERR("wsec failed (%d)\n", err);
goto done;
@@ -896,7 +896,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
else
bcnprd = 100;
- err = brcmf_dev_ioctl_u32(dev, BRCM_SET_BCNPRD, &bcnprd);
+ err = brcmf_dev_ioctl_u32(ndev, BRCM_SET_BCNPRD, &bcnprd);
if (err) {
WL_ERR("WLC_SET_BCNPRD failed (%d)\n", err);
goto done;
@@ -940,7 +940,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
/* set channel for starter */
target_channel = cfg_priv->channel;
- err = brcmf_dev_ioctl_u32(dev, BRCM_SET_CHANNEL,
+ err = brcmf_dev_ioctl_u32(ndev, BRCM_SET_CHANNEL,
&target_channel);
if (err) {
WL_ERR("WLC_SET_CHANNEL failed (%d)\n", err);
@@ -952,7 +952,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
cfg_priv->ibss_starter = false;
- err = brcmf_dev_ioctl(dev, BRCMF_C_SET_SSID,
+ err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_SSID,
&join_params, join_params_size);
if (err) {
WL_ERR("WLC_SET_SSID failed (%d)\n", err);
@@ -967,7 +967,7 @@ done:
}
static s32
-brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
+brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *ndev)
{
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
s32 err = 0;
@@ -983,10 +983,10 @@ brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
return err;
}
-static s32 brcmf_set_wpa_version(struct net_device *dev,
+static s32 brcmf_set_wpa_version(struct net_device *ndev,
struct cfg80211_connect_params *sme)
{
- struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev);
+ struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev);
struct brcmf_cfg80211_security *sec;
s32 val = 0;
s32 err = 0;
@@ -998,7 +998,7 @@ static s32 brcmf_set_wpa_version(struct net_device *dev,
else
val = WPA_AUTH_DISABLED;
WL_CONN("setting wpa_auth to 0x%0x\n", val);
- err = brcmf_dev_intvar_set(dev, "wpa_auth", val);
+ err = brcmf_dev_intvar_set(ndev, "wpa_auth", val);
if (err) {
WL_ERR("set wpa_auth failed (%d)\n", err);
return err;
@@ -1008,10 +1008,10 @@ static s32 brcmf_set_wpa_version(struct net_device *dev,
return err;
}
-static s32
-brcmf_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme)
+static s32 brcmf_set_auth_type(struct net_device *ndev,
+ struct cfg80211_connect_params *sme)
{
- struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev);
+ struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev);
struct brcmf_cfg80211_security *sec;
s32 val = 0;
s32 err = 0;
@@ -1037,7 +1037,7 @@ brcmf_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme)
break;
}
- err = brcmf_dev_intvar_set(dev, "auth", val);
+ err = brcmf_dev_intvar_set(ndev, "auth", val);
if (err) {
WL_ERR("set auth failed (%d)\n", err);
return err;
@@ -1048,10 +1048,10 @@ brcmf_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme)
}
static s32
-brcmf_set_set_cipher(struct net_device *dev,
+brcmf_set_set_cipher(struct net_device *ndev,
struct cfg80211_connect_params *sme)
{
- struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev);
+ struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev);
struct brcmf_cfg80211_security *sec;
s32 pval = 0;
s32 gval = 0;
@@ -1101,7 +1101,7 @@ brcmf_set_set_cipher(struct net_device *dev,
}
WL_CONN("pval (%d) gval (%d)\n", pval, gval);
- err = brcmf_dev_intvar_set(dev, "wsec", pval | gval);
+ err = brcmf_dev_intvar_set(ndev, "wsec", pval | gval);
if (err) {
WL_ERR("error (%d)\n", err);
return err;
@@ -1115,15 +1115,15 @@ brcmf_set_set_cipher(struct net_device *dev,
}
static s32
-brcmf_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme)
+brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
{
- struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev);
+ struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev);
struct brcmf_cfg80211_security *sec;
s32 val = 0;
s32 err = 0;
if (sme->crypto.n_akm_suites) {
- err = brcmf_dev_intvar_get(dev, "wpa_auth", &val);
+ err = brcmf_dev_intvar_get(ndev, "wpa_auth", &val);
if (err) {
WL_ERR("could not get wpa_auth (%d)\n", err);
return err;
@@ -1157,7 +1157,7 @@ brcmf_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme)
}
WL_CONN("setting wpa_auth to %d\n", val);
- err = brcmf_dev_intvar_set(dev, "wpa_auth", val);
+ err = brcmf_dev_intvar_set(ndev, "wpa_auth", val);
if (err) {
WL_ERR("could not set wpa_auth (%d)\n", err);
return err;
@@ -1170,10 +1170,10 @@ brcmf_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme)
}
static s32
-brcmf_set_set_sharedkey(struct net_device *dev,
+brcmf_set_set_sharedkey(struct net_device *ndev,
struct cfg80211_connect_params *sme)
{
- struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev);
+ struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev);
struct brcmf_cfg80211_security *sec;
struct brcmf_wsec_key key;
s32 val;
@@ -1214,14 +1214,14 @@ brcmf_set_set_sharedkey(struct net_device *dev,
WL_CONN("key length (%d) key index (%d) algo (%d)\n",
key.len, key.index, key.algo);
WL_CONN("key \"%s\"\n", key.data);
- err = send_key_to_dongle(dev, &key);
+ err = send_key_to_dongle(ndev, &key);
if (err)
return err;
if (sec->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) {
WL_CONN("set auth_type to shared key\n");
val = 1; /* shared key */
- err = brcmf_dev_intvar_set(dev, "auth", val);
+ err = brcmf_dev_intvar_set(ndev, "auth", val);
if (err) {
WL_ERR("set auth failed (%d)\n", err);
return err;
@@ -1233,7 +1233,7 @@ brcmf_set_set_sharedkey(struct net_device *dev,
}
static s32
-brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
+brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
struct cfg80211_connect_params *sme)
{
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
@@ -1265,31 +1265,31 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
WL_INFO("ie (%p), ie_len (%zd)\n", sme->ie, sme->ie_len);
- err = brcmf_set_wpa_version(dev, sme);
+ err = brcmf_set_wpa_version(ndev, sme);
if (err) {
WL_ERR("wl_set_wpa_version failed (%d)\n", err);
goto done;
}
- err = brcmf_set_auth_type(dev, sme);
+ err = brcmf_set_auth_type(ndev, sme);
if (err) {
WL_ERR("wl_set_auth_type failed (%d)\n", err);
goto done;
}
- err = brcmf_set_set_cipher(dev, sme);
+ err = brcmf_set_set_cipher(ndev, sme);
if (err) {
WL_ERR("wl_set_set_cipher failed (%d)\n", err);
goto done;
}
- err = brcmf_set_key_mgmt(dev, sme);
+ err = brcmf_set_key_mgmt(ndev, sme);
if (err) {
WL_ERR("wl_set_key_mgmt failed (%d)\n", err);
goto done;
}
- err = brcmf_set_set_sharedkey(dev, sme);
+ err = brcmf_set_set_sharedkey(ndev, sme);
if (err) {
WL_ERR("wl_set_set_sharedkey failed (%d)\n", err);
goto done;
@@ -1312,7 +1312,7 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
brcmf_ch_to_chanspec(cfg_priv->channel,
&join_params, &join_params_size);
- err = brcmf_dev_ioctl(dev, BRCMF_C_SET_SSID,
+ err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_SSID,
&join_params, join_params_size);
if (err)
WL_ERR("WLC_SET_SSID failed (%d)\n", err);
@@ -1325,7 +1325,7 @@ done:
}
static s32
-brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
+brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev,
u16 reason_code)
{
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
@@ -1340,7 +1340,7 @@ brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
memcpy(&scbval.ea, brcmf_read_prof(cfg_priv, WL_PROF_BSSID), ETH_ALEN);
scbval.val = cpu_to_le32(reason_code);
- err = brcmf_dev_ioctl(dev, BRCMF_C_DISASSOC, &scbval,
+ err = brcmf_dev_ioctl(ndev, BRCMF_C_DISASSOC, &scbval,
sizeof(struct brcmf_scb_val_le));
if (err)
WL_ERR("error (%d)\n", err);
@@ -1432,7 +1432,7 @@ done:
}
static s32
-brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev,
+brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *ndev,
u8 key_idx, bool unicast, bool multicast)
{
u32 index;
@@ -1444,7 +1444,7 @@ brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev,
if (!check_sys_up(wiphy))
return -EIO;
- err = brcmf_dev_ioctl_u32(dev, BRCMF_C_GET_WSEC, &wsec);
+ err = brcmf_dev_ioctl_u32(ndev, BRCMF_C_GET_WSEC, &wsec);
if (err) {
WL_ERR("WLC_GET_WSEC error (%d)\n", err);
goto done;
@@ -1453,7 +1453,8 @@ brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev,
if (wsec & WEP_ENABLED) {
/* Just select a new current key */
index = key_idx;
- err = brcmf_dev_ioctl_u32(dev, BRCMF_C_SET_KEY_PRIMARY, &index);
+ err = brcmf_dev_ioctl_u32(ndev, BRCMF_C_SET_KEY_PRIMARY,
+ &index);
if (err)
WL_ERR("error (%d)\n", err);
}
@@ -1463,7 +1464,7 @@ done:
}
static s32
-brcmf_add_keyext(struct wiphy *wiphy, struct net_device *dev,
+brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev,
u8 key_idx, const u8 *mac_addr, struct key_params *params)
{
struct brcmf_wsec_key key;
@@ -1480,7 +1481,7 @@ brcmf_add_keyext(struct wiphy *wiphy, struct net_device *dev,
/* check for key index change */
if (key.len == 0) {
/* key delete */
- err = send_key_to_dongle(dev, &key);
+ err = send_key_to_dongle(ndev, &key);
if (err)
return err;
} else {
@@ -1537,8 +1538,8 @@ brcmf_add_keyext(struct wiphy *wiphy, struct net_device *dev,
}
convert_key_from_CPU(&key, &key_le);
- brcmf_netdev_wait_pend8021x(dev);
- err = brcmf_dev_ioctl(dev, BRCMF_C_SET_KEY, &key_le,
+ brcmf_netdev_wait_pend8021x(ndev);
+ err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_KEY, &key_le,
sizeof(key_le));
if (err) {
WL_ERR("WLC_SET_KEY error (%d)\n", err);
@@ -1549,7 +1550,7 @@ brcmf_add_keyext(struct wiphy *wiphy, struct net_device *dev,
}
static s32
-brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
+brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
u8 key_idx, bool pairwise, const u8 *mac_addr,
struct key_params *params)
{
@@ -1566,7 +1567,7 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
if (mac_addr) {
WL_TRACE("Exit");
- return brcmf_add_keyext(wiphy, dev, key_idx, mac_addr, params);
+ return brcmf_add_keyext(wiphy, ndev, key_idx, mac_addr, params);
}
memset(&key, 0, sizeof(key));
@@ -1611,26 +1612,26 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
goto done;
}
- err = send_key_to_dongle(dev, &key); /* Set the new key/index */
+ err = send_key_to_dongle(ndev, &key); /* Set the new key/index */
if (err)
goto done;
val = WEP_ENABLED;
- err = brcmf_dev_intvar_get(dev, "wsec", &wsec);
+ err = brcmf_dev_intvar_get(ndev, "wsec", &wsec);
if (err) {
WL_ERR("get wsec error (%d)\n", err);
goto done;
}
wsec &= ~(WEP_ENABLED);
wsec |= val;
- err = brcmf_dev_intvar_set(dev, "wsec", wsec);
+ err = brcmf_dev_intvar_set(ndev, "wsec", wsec);
if (err) {
WL_ERR("set wsec error (%d)\n", err);
goto done;
}
val = 1; /* assume shared key. otherwise 0 */
- err = brcmf_dev_ioctl_u32(dev, BRCMF_C_SET_AUTH, &val);
+ err = brcmf_dev_ioctl_u32(ndev, BRCMF_C_SET_AUTH, &val);
if (err)
WL_ERR("WLC_SET_AUTH error (%d)\n", err);
done:
@@ -1639,7 +1640,7 @@ done:
}
static s32
-brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
+brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,
u8 key_idx, bool pairwise, const u8 *mac_addr)
{
struct brcmf_wsec_key key;
@@ -1660,7 +1661,7 @@ brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
WL_CONN("key index (%d)\n", key_idx);
/* Set the new key/index */
- err = send_key_to_dongle(dev, &key);
+ err = send_key_to_dongle(ndev, &key);
if (err) {
if (err == -EINVAL) {
if (key.index >= DOT11_MAX_DEFAULT_KEYS)
@@ -1673,7 +1674,7 @@ brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
}
val = 0;
- err = brcmf_dev_intvar_get(dev, "wsec", &wsec);
+ err = brcmf_dev_intvar_get(ndev, "wsec", &wsec);
if (err) {
WL_ERR("get wsec error (%d)\n", err);
/* Ignore this error, may happen during DISASSOC */
@@ -1682,7 +1683,7 @@ brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
}
wsec &= ~(WEP_ENABLED);
wsec |= val;
- err = brcmf_dev_intvar_set(dev, "wsec", wsec);
+ err = brcmf_dev_intvar_set(ndev, "wsec", wsec);
if (err) {
WL_ERR("set wsec error (%d)\n", err);
/* Ignore this error, may happen during DISASSOC */
@@ -1691,7 +1692,7 @@ brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
}
val = 0; /* assume open key. otherwise 1 */
- err = brcmf_dev_ioctl_u32(dev, BRCMF_C_SET_AUTH, &val);
+ err = brcmf_dev_ioctl_u32(ndev, BRCMF_C_SET_AUTH, &val);
if (err) {
WL_ERR("WLC_SET_AUTH error (%d)\n", err);
/* Ignore this error, may happen during DISASSOC */
@@ -1703,7 +1704,7 @@ done:
}
static s32
-brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
+brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
u8 key_idx, bool pairwise, const u8 *mac_addr, void *cookie,
void (*callback) (void *cookie, struct key_params * params))
{
@@ -1720,7 +1721,7 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
memset(¶ms, 0, sizeof(params));
- err = brcmf_dev_ioctl_u32(dev, BRCMF_C_GET_WSEC, &wsec);
+ err = brcmf_dev_ioctl_u32(ndev, BRCMF_C_GET_WSEC, &wsec);
if (err) {
WL_ERR("WLC_GET_WSEC error (%d)\n", err);
/* Ignore this error, may happen during DISASSOC */
@@ -1760,7 +1761,7 @@ done:
static s32
brcmf_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,
- struct net_device *dev, u8 key_idx)
+ struct net_device *ndev, u8 key_idx)
{
WL_INFO("Not supported\n");
@@ -1768,7 +1769,7 @@ brcmf_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,
}
static s32
-brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
+brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
u8 *mac, struct station_info *sinfo)
{
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
@@ -1793,7 +1794,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
}
/* Report the current tx rate */
- err = brcmf_dev_ioctl_u32(dev, BRCMF_C_GET_RATE, &rate);
+ err = brcmf_dev_ioctl_u32(ndev, BRCMF_C_GET_RATE, &rate);
if (err) {
WL_ERR("Could not get rate (%d)\n", err);
} else {
@@ -1804,7 +1805,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
if (test_bit(WL_STATUS_CONNECTED, &cfg_priv->status)) {
scb_val.val = cpu_to_le32(0);
- err = brcmf_dev_ioctl(dev, BRCMF_C_GET_RSSI, &scb_val,
+ err = brcmf_dev_ioctl(ndev, BRCMF_C_GET_RSSI, &scb_val,
sizeof(struct brcmf_scb_val_le));
if (err)
WL_ERR("Could not get rssi (%d)\n", err);
@@ -1821,7 +1822,7 @@ done:
}
static s32
-brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
+brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev,
bool enabled, s32 timeout)
{
s32 pm;
@@ -1848,7 +1849,7 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
pm = enabled ? PM_FAST : PM_OFF;
WL_INFO("power save %s\n", (pm ? "enabled" : "disabled"));
- err = brcmf_dev_ioctl_u32(dev, BRCMF_C_SET_PM, &pm);
+ err = brcmf_dev_ioctl_u32(ndev, BRCMF_C_SET_PM, &pm);
if (err) {
if (err == -ENODEV)
WL_ERR("net_device is not ready yet\n");
@@ -1861,7 +1862,7 @@ done:
}
static s32
-brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,
+brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *ndev,
const u8 *addr,
const struct cfg80211_bitrate_mask *mask)
{
@@ -1879,7 +1880,7 @@ brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,
/* addr param is always NULL. ignore it */
/* Get current rateset */
- err = brcmf_dev_ioctl(dev, BRCM_GET_CURR_RATESET, &rateset_le,
+ err = brcmf_dev_ioctl(ndev, BRCM_GET_CURR_RATESET, &rateset_le,
sizeof(rateset_le));
if (err) {
WL_ERR("could not get current rateset (%d)\n", err);
@@ -1907,8 +1908,8 @@ brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,
* Set rate override,
* Since the is a/b/g-blind, both a/bg_rate are enforced.
*/
- err_bg = brcmf_dev_intvar_set(dev, "bg_rate", rate);
- err_a = brcmf_dev_intvar_set(dev, "a_rate", rate);
+ err_bg = brcmf_dev_intvar_set(ndev, "bg_rate", rate);
+ err_a = brcmf_dev_intvar_set(ndev, "a_rate", rate);
if (err_bg && err_a) {
WL_ERR("could not set fixed rate (%d) (%d)\n", err_bg, err_a);
err = err_bg | err_a;
@@ -2004,7 +2005,7 @@ static s32 brcmf_inform_bss(struct brcmf_cfg80211_priv *cfg_priv)
}
static s32 wl_inform_ibss(struct brcmf_cfg80211_priv *cfg_priv,
- struct net_device *dev, const u8 *bssid)
+ struct net_device *ndev, const u8 *bssid)
{
struct wiphy *wiphy = cfg_to_wiphy(cfg_priv);
struct ieee80211_channel *notify_channel;
@@ -2031,7 +2032,7 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_priv *cfg_priv,
*(__le32 *)buf = cpu_to_le32(WL_BSS_INFO_MAX);
- err = brcmf_dev_ioctl(dev, BRCMF_C_GET_BSS_INFO, buf, WL_BSS_INFO_MAX);
+ err = brcmf_dev_ioctl(ndev, BRCMF_C_GET_BSS_INFO, buf, WL_BSS_INFO_MAX);
if (err) {
WL_ERR("WLC_GET_BSS_INFO failed: %d\n", err);
goto CleanUp;
@@ -2214,9 +2215,9 @@ brcmf_get_iscan_results(struct brcmf_cfg80211_iscan_ctrl *iscan, u32 *status,
memset(&list, 0, sizeof(list));
list.results_le.buflen = cpu_to_le32(WL_ISCAN_BUF_MAX);
- err = brcmf_dev_iovar_getbuf(iscan->dev, "iscanresults", &list,
- BRCMF_ISCAN_RESULTS_FIXED_SIZE, iscan->scan_buf,
- WL_ISCAN_BUF_MAX);
+ err = brcmf_dev_iovar_getbuf(iscan->ndev, "iscanresults", &list,
+ BRCMF_ISCAN_RESULTS_FIXED_SIZE,
+ iscan->scan_buf, WL_ISCAN_BUF_MAX);
if (err) {
WL_ERR("error (%d)\n", err);
return err;
@@ -2352,7 +2353,7 @@ static s32 brcmf_init_iscan(struct brcmf_cfg80211_priv *cfg_priv)
int err = 0;
if (cfg_priv->iscan_on) {
- iscan->dev = cfg_to_ndev(cfg_priv);
+ iscan->ndev = cfg_to_ndev(cfg_priv);
brcmf_init_iscan_eloop(&iscan->el);
iscan->timer_ms = WL_ISCAN_TIMER_INTERVAL_MS;
init_timer(&iscan->timer);
@@ -2454,32 +2455,32 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
}
static __used s32
-brcmf_dev_bufvar_set(struct net_device *dev, s8 *name, s8 *buf, s32 len)
+brcmf_dev_bufvar_set(struct net_device *ndev, s8 *name, s8 *buf, s32 len)
{
- struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev);
+ struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev);
u32 buflen;
buflen = brcmu_mkiovar(name, buf, len, cfg_priv->ioctl_buf,
WL_IOCTL_LEN_MAX);
BUG_ON(!buflen);
- return brcmf_dev_ioctl(dev, BRCMF_C_SET_VAR, cfg_priv->ioctl_buf,
+ return brcmf_dev_ioctl(ndev, BRCMF_C_SET_VAR, cfg_priv->ioctl_buf,
buflen);
}
static s32
-brcmf_dev_bufvar_get(struct net_device *dev, s8 *name, s8 *buf,
+brcmf_dev_bufvar_get(struct net_device *ndev, s8 *name, s8 *buf,
s32 buf_len)
{
- struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev);
+ struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev);
u32 len;
s32 err = 0;
len = brcmu_mkiovar(name, NULL, 0, cfg_priv->ioctl_buf,
WL_IOCTL_LEN_MAX);
BUG_ON(!len);
- err = brcmf_dev_ioctl(dev, BRCMF_C_GET_VAR, (void *)cfg_priv->ioctl_buf,
- WL_IOCTL_LEN_MAX);
+ err = brcmf_dev_ioctl(ndev, BRCMF_C_GET_VAR, cfg_priv->ioctl_buf,
+ WL_IOCTL_LEN_MAX);
if (err) {
WL_ERR("error (%d)\n", err);
return err;
@@ -2490,7 +2491,7 @@ brcmf_dev_bufvar_get(struct net_device *dev, s8 *name, s8 *buf,
}
static __used s32
-brcmf_update_pmklist(struct net_device *dev,
+brcmf_update_pmklist(struct net_device *ndev,
struct brcmf_cfg80211_pmk_list *pmk_list, s32 err)
{
int i, j;
@@ -2504,14 +2505,14 @@ brcmf_update_pmklist(struct net_device *dev,
}
if (!err)
- brcmf_dev_bufvar_set(dev, "pmkid_info", (char *)pmk_list,
+ brcmf_dev_bufvar_set(ndev, "pmkid_info", (char *)pmk_list,
sizeof(*pmk_list));
return err;
}
static s32
-brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev,
+brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *ndev,
struct cfg80211_pmksa *pmksa)
{
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
@@ -2539,14 +2540,14 @@ brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev,
for (i = 0; i < WLAN_PMKID_LEN; i++)
WL_CONN("%02x\n", pmkids->pmkid[pmkids->npmkid].PMKID[i]);
- err = brcmf_update_pmklist(dev, cfg_priv->pmk_list, err);
+ err = brcmf_update_pmklist(ndev, cfg_priv->pmk_list, err);
WL_TRACE("Exit\n");
return err;
}
static s32
-brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev,
+brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev,
struct cfg80211_pmksa *pmksa)
{
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
@@ -2588,7 +2589,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev,
} else
err = -EINVAL;
- err = brcmf_update_pmklist(dev, cfg_priv->pmk_list, err);
+ err = brcmf_update_pmklist(ndev, cfg_priv->pmk_list, err);
WL_TRACE("Exit\n");
return err;
@@ -2596,7 +2597,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev,
}
static s32
-brcmf_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev)
+brcmf_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *ndev)
{
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
s32 err = 0;
@@ -2606,7 +2607,7 @@ brcmf_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev)
return -EIO;
memset(cfg_priv->pmk_list, 0, sizeof(*cfg_priv->pmk_list));
- err = brcmf_update_pmklist(dev, cfg_priv->pmk_list, err);
+ err = brcmf_update_pmklist(ndev, cfg_priv->pmk_list, err);
WL_TRACE("Exit\n");
return err;
@@ -2655,7 +2656,7 @@ static s32 brcmf_mode_to_nl80211_iftype(s32 mode)
}
static struct wireless_dev *brcmf_alloc_wdev(s32 sizeof_iface,
- struct device *dev)
+ struct device *ndev)
{
struct wireless_dev *wdev;
s32 err = 0;
@@ -2672,7 +2673,7 @@ static struct wireless_dev *brcmf_alloc_wdev(s32 sizeof_iface,
err = -ENOMEM;
goto wiphy_new_out;
}
- set_wiphy_dev(wdev->wiphy, dev);
+ set_wiphy_dev(wdev->wiphy, ndev);
wdev->wiphy->max_scan_ssids = WL_NUM_SCAN_MAX;
wdev->wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
wdev->wiphy->interface_modes =
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
index 14a32e1..afc60d9 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
@@ -243,7 +243,7 @@ struct brcmf_cfg80211_iscan_eloop {
/* dongle iscan controller */
struct brcmf_cfg80211_iscan_ctrl {
- struct net_device *dev;
+ struct net_device *ndev;
struct timer_list timer;
u32 timer_ms;
u32 timer_on;
--
1.7.1
From: Roland Vossen <[email protected]>
Code cleanup. Merged two functions.
Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd.h | 3 +-
drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 40 ++++++++++++---------
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 16 ---------
3 files changed, 24 insertions(+), 35 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index a16f731..514f779 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -724,8 +724,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 int brcmf_netdev_ioctl_priv(struct net_device *ndev,
- struct brcmf_ioctl *ioc);
+extern s32 brcmf_dev_ioctl(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);
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index 827022e..3ae0d43 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -849,30 +849,36 @@ static int brcmf_netdev_ioctl_entry(struct net_device *ndev, struct ifreq *ifr,
return -EOPNOTSUPP;
}
-/* called only from within this driver */
-int brcmf_netdev_ioctl_priv(struct net_device *ndev, struct brcmf_ioctl *ioc)
+/* called only from within this driver. Sends an ioctl to the dongle. */
+s32 brcmf_dev_ioctl(struct net_device *ndev, u32 cmd, void *arg, u32 len)
{
- int bcmerror = 0;
+ struct brcmf_ioctl ioc;
+ s32 err = 0;
int buflen = 0;
bool is_set_key_cmd;
struct brcmf_info *drvr_priv = *(struct brcmf_info **)
- netdev_priv(ndev);
+ netdev_priv(ndev);
int ifidx;
+ memset(&ioc, 0, sizeof(ioc));
+ ioc.cmd = cmd;
+ ioc.buf = arg;
+ ioc.len = len;
+
ifidx = brcmf_net2idx(drvr_priv, ndev);
- if (ioc->buf != NULL)
- buflen = min_t(uint, ioc->len, BRCMF_IOCTL_MAXLEN);
+ if (ioc.buf != NULL)
+ buflen = min_t(uint, ioc.len, BRCMF_IOCTL_MAXLEN);
/* send to dongle (must be up, and wl) */
if ((drvr_priv->pub.busstate != BRCMF_BUS_DATA)) {
brcmf_dbg(ERROR, "DONGLE_DOWN\n");
- bcmerror = -EIO;
+ err = -EIO;
goto done;
}
if (!drvr_priv->pub.iswl) {
- bcmerror = -EIO;
+ err = -EIO;
goto done;
}
@@ -880,21 +886,21 @@ int brcmf_netdev_ioctl_priv(struct net_device *ndev, struct brcmf_ioctl *ioc)
* Intercept BRCMF_C_SET_KEY IOCTL - serialize M4 send and
* set key IOCTL to prevent M4 encryption.
*/
- is_set_key_cmd = ((ioc->cmd == BRCMF_C_SET_KEY) ||
- ((ioc->cmd == BRCMF_C_SET_VAR) &&
- !(strncmp("wsec_key", ioc->buf, 9))) ||
- ((ioc->cmd == BRCMF_C_SET_VAR) &&
- !(strncmp("bsscfg:wsec_key", ioc->buf, 15))));
+ is_set_key_cmd = ((ioc.cmd == BRCMF_C_SET_KEY) ||
+ ((ioc.cmd == BRCMF_C_SET_VAR) &&
+ !(strncmp("wsec_key", ioc.buf, 9))) ||
+ ((ioc.cmd == BRCMF_C_SET_VAR) &&
+ !(strncmp("bsscfg:wsec_key", ioc.buf, 15))));
if (is_set_key_cmd)
brcmf_netdev_wait_pend8021x(ndev);
- bcmerror = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, ioc, buflen);
+ err = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, buflen);
done:
- if (bcmerror > 0)
- bcmerror = 0;
+ if (err > 0)
+ err = 0;
- return bcmerror;
+ return err;
}
static int brcmf_netdev_stop(struct net_device *ndev)
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index b707bc0..b956c90 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -249,22 +249,6 @@ static const u32 __wl_cipher_suites[] = {
WLAN_CIPHER_SUITE_AES_CMAC,
};
-static s32
-brcmf_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
-{
- struct brcmf_ioctl ioc;
- s32 err = 0;
-
- memset(&ioc, 0, sizeof(ioc));
- ioc.cmd = cmd;
- ioc.buf = arg;
- ioc.len = len;
-
- err = brcmf_netdev_ioctl_priv(dev, &ioc);
-
- return err;
-}
-
/* function for reading/writing a single u32 from/to the dongle */
static int
brcmf_dev_ioctl_u32(struct net_device *ndev, u32 cmd, u32 *par)
--
1.7.1
From: Roland Vossen <[email protected]>
Structure that is send/received to/from dongle has been annotated.
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd_cdc.c | 25 +++++++++++--------------
1 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c b/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
index 6f65683..28bdf9e 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
@@ -28,11 +28,11 @@
#include "dhd_dbg.h"
struct brcmf_proto_cdc_ioctl {
- u32 cmd; /* ioctl command value */
- u32 len; /* lower 16: output buflen;
+ __le32 cmd; /* ioctl command value */
+ __le32 len; /* lower 16: output buflen;
* upper 16: input buflen (excludes header) */
- u32 flags; /* flag defns given below */
- u32 status; /* status code returned from the device */
+ __le32 flags; /* flag defns given below */
+ __le32 status; /* status code returned from the device */
};
/* Max valid buffer size that can be sent to the dongle */
@@ -47,9 +47,6 @@ struct brcmf_proto_cdc_ioctl {
#define CDCF_IOC_ID_SHIFT 16 /* ID Mask shift bits */
#define CDC_IOC_ID(flags) \
(((flags) & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT)
-#define CDC_SET_IF_IDX(hdr, idx) \
- ((hdr)->flags = (((hdr)->flags & ~CDCF_IOC_IF_MASK) | \
- ((idx) << CDCF_IOC_IF_SHIFT)))
/*
* BDC header - Broadcom specific extension of CDC.
@@ -144,7 +141,7 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd,
struct brcmf_proto_cdc_ioctl *msg = &prot->msg;
void *info;
int ret = 0, retries = 0;
- u32 id, flags = 0;
+ u32 id, flags;
brcmf_dbg(TRACE, "Enter\n");
brcmf_dbg(CTL, "cmd %d len %d\n", cmd, len);
@@ -165,9 +162,9 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd,
msg->cmd = cpu_to_le32(cmd);
msg->len = cpu_to_le32(len);
- msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT);
- CDC_SET_IF_IDX(msg, ifidx);
- msg->flags = cpu_to_le32(msg->flags);
+ flags = (++prot->reqid << CDCF_IOC_ID_SHIFT);
+ flags = (flags & ~CDCF_IOC_IF_MASK) | (ifidx << CDCF_IOC_IF_SHIFT);
+ msg->flags = cpu_to_le32(flags);
if (buf)
memcpy(prot->buf, buf, len);
@@ -233,9 +230,9 @@ int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd,
msg->cmd = cpu_to_le32(cmd);
msg->len = cpu_to_le32(len);
- msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT) | CDCF_IOC_SET;
- CDC_SET_IF_IDX(msg, ifidx);
- msg->flags = cpu_to_le32(msg->flags);
+ flags = (++prot->reqid << CDCF_IOC_ID_SHIFT) | CDCF_IOC_SET;
+ flags = (flags & ~CDCF_IOC_IF_MASK) | (ifidx << CDCF_IOC_IF_SHIFT);
+ msg->flags = cpu_to_le32(flags);
if (buf)
memcpy(prot->buf, buf, len);
--
1.7.1
From: Arend van Spriel <[email protected]>
Using a block statement to scope function variables is not
common in linux kernel development. Browsed through the brcmfmac
to remove those.
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd_common.c | 132 +++++++++++-----------
1 files changed, 66 insertions(+), 66 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_common.c b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
index c9bf92a..0c41c1c 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_common.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
@@ -198,6 +198,11 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)
BRCMF_E_PFN_SCAN_COMPLETE, "SCAN_COMPLETE"}
};
uint event_type, flags, auth_type, datalen;
+ static u32 seqnum_prev;
+ struct msgtrace_hdr hdr;
+ u32 nblost;
+ char *s, *p;
+
event_type = be32_to_cpu(event->event_type);
flags = be16_to_cpu(event->flags);
status = be32_to_cpu(event->status);
@@ -348,55 +353,52 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)
break;
case BRCMF_E_TRACE:
- {
- static u32 seqnum_prev;
- struct msgtrace_hdr hdr;
- u32 nblost;
- char *s, *p;
-
- buf = (unsigned char *) event_data;
- memcpy(&hdr, buf, sizeof(struct msgtrace_hdr));
-
- if (hdr.version != MSGTRACE_VERSION) {
- brcmf_dbg(ERROR, "MACEVENT: %s [unsupported version --> brcmf version:%d dongle version:%d]\n",
- event_name,
- MSGTRACE_VERSION, hdr.version);
- /* Reset datalen to avoid display below */
- datalen = 0;
- break;
- }
-
- /* There are 2 bytes available at the end of data */
- *(buf + sizeof(struct msgtrace_hdr)
- + be16_to_cpu(hdr.len)) = '\0';
-
- if (be32_to_cpu(hdr.discarded_bytes)
- || be32_to_cpu(hdr.discarded_printf))
- brcmf_dbg(ERROR, "WLC_E_TRACE: [Discarded traces in dongle --> discarded_bytes %d discarded_printf %d]\n",
- be32_to_cpu(hdr.discarded_bytes),
- be32_to_cpu(hdr.discarded_printf));
-
- nblost = be32_to_cpu(hdr.seqnum) - seqnum_prev - 1;
- if (nblost > 0)
- brcmf_dbg(ERROR, "WLC_E_TRACE: [Event lost --> seqnum %d nblost %d\n",
- be32_to_cpu(hdr.seqnum), nblost);
- seqnum_prev = be32_to_cpu(hdr.seqnum);
-
- /* Display the trace buffer. Advance from \n to \n to
- * avoid display big
- * printf (issue with Linux printk )
- */
- p = (char *)&buf[sizeof(struct msgtrace_hdr)];
- while ((s = strstr(p, "\n")) != NULL) {
- *s = '\0';
- printk(KERN_DEBUG"%s\n", p);
- p = s + 1;
- }
- printk(KERN_DEBUG "%s\n", p);
+ buf = (unsigned char *) event_data;
+ memcpy(&hdr, buf, sizeof(struct msgtrace_hdr));
+ if (hdr.version != MSGTRACE_VERSION) {
+ brcmf_dbg(ERROR,
+ "MACEVENT: %s [unsupported version --> brcmf"
+ " version:%d dongle version:%d]\n",
+ event_name, MSGTRACE_VERSION, hdr.version);
/* Reset datalen to avoid display below */
datalen = 0;
+ break;
+ }
+
+ /* There are 2 bytes available at the end of data */
+ *(buf + sizeof(struct msgtrace_hdr)
+ + be16_to_cpu(hdr.len)) = '\0';
+
+ if (be32_to_cpu(hdr.discarded_bytes)
+ || be32_to_cpu(hdr.discarded_printf))
+ brcmf_dbg(ERROR,
+ "WLC_E_TRACE: [Discarded traces in dongle -->"
+ " discarded_bytes %d discarded_printf %d]\n",
+ be32_to_cpu(hdr.discarded_bytes),
+ be32_to_cpu(hdr.discarded_printf));
+
+ nblost = be32_to_cpu(hdr.seqnum) - seqnum_prev - 1;
+ if (nblost > 0)
+ brcmf_dbg(ERROR, "WLC_E_TRACE: [Event lost --> seqnum "
+ " %d nblost %d\n", be32_to_cpu(hdr.seqnum),
+ nblost);
+ seqnum_prev = be32_to_cpu(hdr.seqnum);
+
+ /* Display the trace buffer. Advance from \n to \n to
+ * avoid display big
+ * printf (issue with Linux printk )
+ */
+ p = (char *)&buf[sizeof(struct msgtrace_hdr)];
+ while ((s = strstr(p, "\n")) != NULL) {
+ *s = '\0';
+ printk(KERN_DEBUG"%s\n", p);
+ p = s + 1;
}
+ printk(KERN_DEBUG "%s\n", p);
+
+ /* Reset datalen to avoid display below */
+ datalen = 0;
break;
case BRCMF_E_RSSI:
@@ -405,8 +407,9 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)
break;
default:
- brcmf_dbg(EVENT, "MACEVENT: %s %d, MAC %s, status %d, reason %d, auth %d\n",
- event_name, event_type, eabuf,
+ brcmf_dbg(EVENT,
+ "MACEVENT: %s %d, MAC %s, status %d, reason %d, "
+ "auth %d\n", event_name, event_type, eabuf,
(int)status, (int)reason, (int)auth_type);
break;
}
@@ -428,6 +431,7 @@ brcmf_c_host_event(struct brcmf_info *drvr_priv, int *ifidx, void *pktdata,
{
/* check whether packet is a BRCM event pkt */
struct brcmf_event *pvt_data = (struct brcmf_event *) pktdata;
+ struct brcmf_if_event *ifevent;
char *event_data;
u32 type, status;
u16 flags;
@@ -459,26 +463,22 @@ brcmf_c_host_event(struct brcmf_info *drvr_priv, int *ifidx, void *pktdata,
switch (type) {
case BRCMF_E_IF:
- {
- struct brcmf_if_event *ifevent =
- (struct brcmf_if_event *) event_data;
- brcmf_dbg(TRACE, "if event\n");
-
- if (ifevent->ifidx > 0 &&
- ifevent->ifidx < BRCMF_MAX_IFS) {
- if (ifevent->action == BRCMF_E_IF_ADD)
- brcmf_add_if(drvr_priv, ifevent->ifidx,
- NULL, event->ifname,
- pvt_data->eth.h_dest,
- ifevent->flags,
- ifevent->bssidx);
- else
- brcmf_del_if(drvr_priv, ifevent->ifidx);
- } else {
- brcmf_dbg(ERROR, "Invalid ifidx %d for %s\n",
- ifevent->ifidx, event->ifname);
- }
+ ifevent = (struct brcmf_if_event *) event_data;
+ brcmf_dbg(TRACE, "if event\n");
+
+ if (ifevent->ifidx > 0 && ifevent->ifidx < BRCMF_MAX_IFS) {
+ if (ifevent->action == BRCMF_E_IF_ADD)
+ brcmf_add_if(drvr_priv, ifevent->ifidx, NULL,
+ event->ifname,
+ pvt_data->eth.h_dest,
+ ifevent->flags, ifevent->bssidx);
+ else
+ brcmf_del_if(drvr_priv, ifevent->ifidx);
+ } else {
+ brcmf_dbg(ERROR, "Invalid ifidx %d for %s\n",
+ ifevent->ifidx, event->ifname);
}
+
/* send up the if event: btamp user needs it */
*ifidx = brcmf_ifname2idx(drvr_priv, event->ifname);
break;
--
1.7.1
Replaced the global variable with constant
Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 7090a36..53de5a7 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -759,9 +759,7 @@ static uint brcmf_txminmax;
int brcmf_idletime = 1;
module_param(brcmf_idletime, int, 0);
-/* SDIO Drive Strength (in milliamps) */
-uint brcmf_sdiod_drive_strength = 6;
-module_param(brcmf_sdiod_drive_strength, uint, 0);
+#define SDIO_DRIVE_STRENGTH 6 /* in milliamps */
/* Use polling */
uint brcmf_poll;
@@ -4607,7 +4605,7 @@ brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, u32 regsva)
goto fail;
}
- brcmf_sdbrcm_sdiod_drive_strength_init(bus, brcmf_sdiod_drive_strength);
+ brcmf_sdbrcm_sdiod_drive_strength_init(bus, SDIO_DRIVE_STRENGTH);
/* Get info on the ARM and SOCRAM cores... */
brcmf_sdcard_reg_read(bus->sdiodev,
--
1.7.1
From: Roland Vossen <[email protected]>
Added comments to make code more readable.
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd.h | 4 ++++
drivers/staging/brcm80211/brcmfmac/dhd_cdc.c | 5 +++++
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 2 ++
3 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index 7ca9172..7ab45d9 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -27,6 +27,9 @@
#define BRCMF_C_IOCTL_MEDLEN 1536 /* "med" ioctl buffer required */
#define BRCMF_C_IOCTL_MAXLEN 8192
+/*******************************************************************************
+ * IO codes that are interpreted by dongle firmware
+ ******************************************************************************/
#define BRCMF_C_UP 2
#define BRCMF_C_SET_PROMISC 10
#define BRCMF_C_GET_RATE 12
@@ -171,6 +174,7 @@ struct dngl_stats {
unsigned long multicast; /* multicast packets received */
};
+/* event codes sent by the dongle to this driver */
#define BRCMF_E_SET_SSID 0
#define BRCMF_E_JOIN 1
#define BRCMF_E_START 2
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c b/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
index 91b4d3c..4c171a3 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
@@ -14,6 +14,11 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+/*******************************************************************************
+ * Communicates with the dongle by using Broadcom specific ioctl codes.
+ * For certain ioctl codes, the dongle interprets string data from the host.
+ ******************************************************************************/
+
#include <linux/types.h>
#include <linux/netdevice.h>
#include <linux/sched.h>
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index d0ae2b6..45c9e78 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -14,6 +14,8 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+/* Toplevel file. Relies on dhd_linux.c to send ioctls to the dongle. */
+
#include <linux/kernel.h>
#include <linux/if_arp.h>
#include <linux/sched.h>
--
1.7.1
From: Roland Vossen <[email protected]>
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 6 +++-
drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 23 +++++++++++---------
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 19 ++++++++++-------
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 12 +++++-----
4 files changed, 34 insertions(+), 26 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index 443e3a8..1cbdb80 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -401,7 +401,9 @@ static int brcmf_sdioh_get_cisaddr(struct brcmf_sdio_dev *sdiodev, u32 regaddr)
/* read 24 bits and return valid 17 bit addr */
int i;
u32 scratch, regdata;
- u8 *ptr = (u8 *)&scratch;
+ __le32 scratch_le;
+ u8 *ptr = (u8 *)&scratch_le;
+
for (i = 0; i < 3; i++) {
if ((brcmf_sdioh_card_regread(sdiodev, 0, regaddr, 1,
®data)) != SUCCESS)
@@ -412,7 +414,7 @@ static int brcmf_sdioh_get_cisaddr(struct brcmf_sdio_dev *sdiodev, u32 regaddr)
}
/* Only the lower 17-bits are valid */
- scratch = le32_to_cpu(scratch);
+ scratch = le32_to_cpu(scratch_le);
scratch &= 0x0001FFFF;
return scratch;
}
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index 9919fa5..e1d7456 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -138,6 +138,8 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
struct net_device *dev;
struct netdev_hw_addr *ha;
u32 allmulti, cnt;
+ __le32 cnt_le;
+ __le32 allmulti_le;
struct brcmf_ioctl ioc;
char *buf, *bufp;
@@ -166,9 +168,9 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
strcpy(bufp, "mcast_list");
bufp += strlen("mcast_list") + 1;
- cnt = cpu_to_le32(cnt);
- memcpy(bufp, &cnt, sizeof(cnt));
- bufp += sizeof(cnt);
+ cnt_le = cpu_to_le32(cnt);
+ memcpy(bufp, &cnt_le, sizeof(cnt));
+ bufp += sizeof(cnt_le);
netdev_for_each_mc_addr(ha, dev) {
if (!cnt)
@@ -205,10 +207,11 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
brcmf_ifname(&drvr_priv->pub, 0));
return;
}
- allmulti = cpu_to_le32(allmulti);
+ allmulti_le = cpu_to_le32(allmulti);
if (!brcmu_mkiovar
- ("allmulti", (void *)&allmulti, sizeof(allmulti), buf, buflen)) {
+ ("allmulti", (void *)&allmulti_le,
+ sizeof(allmulti_le), buf, buflen)) {
brcmf_dbg(ERROR, "%s: mkiovar failed for allmulti, datalen %d buflen %u\n",
brcmf_ifname(&drvr_priv->pub, 0),
(int)sizeof(allmulti), buflen);
@@ -226,7 +229,7 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
if (ret < 0) {
brcmf_dbg(ERROR, "%s: set allmulti %d failed\n",
brcmf_ifname(&drvr_priv->pub, 0),
- le32_to_cpu(allmulti));
+ le32_to_cpu(allmulti_le));
}
kfree(buf);
@@ -235,19 +238,19 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
driver does */
allmulti = (dev->flags & IFF_PROMISC) ? true : false;
- allmulti = cpu_to_le32(allmulti);
+ allmulti_le = cpu_to_le32(allmulti);
memset(&ioc, 0, sizeof(ioc));
ioc.cmd = BRCMF_C_SET_PROMISC;
- ioc.buf = &allmulti;
- ioc.len = sizeof(allmulti);
+ ioc.buf = &allmulti_le;
+ ioc.len = sizeof(allmulti_le);
ioc.set = true;
ret = brcmf_proto_ioctl(&drvr_priv->pub, 0, &ioc, ioc.len);
if (ret < 0) {
brcmf_dbg(ERROR, "%s: set promisc %d failed\n",
brcmf_ifname(&drvr_priv->pub, 0),
- le32_to_cpu(allmulti));
+ le32_to_cpu(allmulti_le));
}
}
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index fb9b351..57001d4 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -2361,8 +2361,8 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_bus *bus, struct sk_buff *pkt,
/* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */
len = (u16) (pkt->len);
- *(u16 *) frame = cpu_to_le16(len);
- *(((u16 *) frame) + 1) = cpu_to_le16(~len);
+ *(__le16 *) frame = cpu_to_le16(len);
+ *(((__le16 *) frame) + 1) = cpu_to_le16(~len);
/* Software tag: channel, sequence number, data offset */
swheader =
@@ -2917,16 +2917,17 @@ static int
brcmf_sdbrcm_readshared(struct brcmf_bus *bus, struct sdpcm_shared *sh)
{
u32 addr;
+ __le32 addr_le;
int rv;
/* Read last word in memory to determine address of
sdpcm_shared structure */
- rv = brcmf_sdbrcm_membytes(bus, false, bus->ramsize - 4, (u8 *)&addr,
+ rv = brcmf_sdbrcm_membytes(bus, false, bus->ramsize - 4, (u8 *)&addr_le,
4);
if (rv < 0)
return rv;
- addr = le32_to_cpu(addr);
+ addr = le32_to_cpu(addr_le);
brcmf_dbg(INFO, "sdpcm_shared address 0x%08X\n", addr);
@@ -3273,8 +3274,8 @@ brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
/* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */
- *(u16 *) frame = cpu_to_le16((u16) msglen);
- *(((u16 *) frame) + 1) = cpu_to_le16(~msglen);
+ *(__le16 *) frame = cpu_to_le16((u16) msglen);
+ *(((__le16 *) frame) + 1) = cpu_to_le16(~msglen);
/* Software tag: channel, sequence number, data offset */
swheader =
@@ -3466,6 +3467,7 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_bus *bus)
u32 varaddr;
u8 *vbuffer;
u32 varsizew;
+ __le32 varsizew_le;
#ifdef BCMDBG
char *nvram_ularray;
#endif /* BCMDBG */
@@ -3529,10 +3531,11 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_bus *bus)
*/
if (bcmerror) {
varsizew = 0;
+ varsizew_le = cpu_to_le32(0);
} else {
varsizew = varsize / 4;
varsizew = (~varsizew << 16) | (varsizew & 0x0000FFFF);
- varsizew = cpu_to_le32(varsizew);
+ varsizew_le = cpu_to_le32(varsizew);
}
brcmf_dbg(INFO, "New varsize is %d, length token=0x%08x\n",
@@ -3540,7 +3543,7 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_bus *bus)
/* Write the length token to the last word */
bcmerror = brcmf_sdbrcm_membytes(bus, true, (bus->orig_ramsize - 4),
- (u8 *)&varsizew, 4);
+ (u8 *)&varsizew_le, 4);
return bcmerror;
}
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index 9e07f77..b4befec 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -378,7 +378,7 @@ brcmf_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval)
{
union {
s8 buf[BRCMF_C_IOCTL_SMLEN];
- s32 val;
+ __le32 val;
} var;
u32 len;
u32 data_null;
@@ -890,11 +890,11 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
/* Configure Beacon Interval for starter */
if (params->beacon_interval)
- bcnprd = cpu_to_le32(params->beacon_interval);
+ bcnprd = params->beacon_interval;
else
- bcnprd = cpu_to_le32(100);
+ bcnprd = 100;
- err = brcmf_dev_ioctl(dev, BRCM_SET_BCNPRD, &bcnprd, sizeof(bcnprd));
+ err = brcmf_dev_ioctl_u32(dev, BRCM_SET_BCNPRD, &bcnprd);
if (unlikely(err)) {
WL_ERR("WLC_SET_BCNPRD failed (%d)\n", err);
goto done;
@@ -2029,7 +2029,7 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_priv *cfg_priv,
goto CleanUp;
}
- *(u32 *)buf = cpu_to_le32(WL_BSS_INFO_MAX);
+ *(__le32 *)buf = cpu_to_le32(WL_BSS_INFO_MAX);
err = brcmf_dev_ioctl(dev, BRCMF_C_GET_BSS_INFO, buf, WL_BSS_INFO_MAX);
if (unlikely(err)) {
@@ -2098,7 +2098,7 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_priv *cfg_priv)
ssid = (struct brcmf_ssid *)brcmf_read_prof(cfg_priv, WL_PROF_SSID);
- *(u32 *)cfg_priv->extra_buf = cpu_to_le32(WL_EXTRA_BUF_MAX);
+ *(__le32 *)cfg_priv->extra_buf = cpu_to_le32(WL_EXTRA_BUF_MAX);
err = brcmf_dev_ioctl(cfg_to_ndev(cfg_priv), BRCMF_C_GET_BSS_INFO,
cfg_priv->extra_buf, WL_EXTRA_BUF_MAX);
if (unlikely(err)) {
--
1.7.1
remove unused module parameter brcmf_dongle_memsize and related code
Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd_bus.h | 3 --
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 35 +++---------------------
2 files changed, 5 insertions(+), 33 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_bus.h b/drivers/staging/brcm80211/brcmfmac/dhd_bus.h
index aa05b1c..d02cb10 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_bus.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_bus.h
@@ -24,9 +24,6 @@
* Exported from brcmf bus module (brcmf_usb, brcmf_sdio)
*/
-/* dongle ram module parameter */
-extern int brcmf_dongle_memsize;
-
/* Tx/Rx bounds module parameters */
extern uint brcmf_txbound;
extern uint brcmf_rxbound;
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 9d4850d..7090a36 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -568,7 +568,6 @@ struct brcmf_bus {
uint varsz; /* Size of variables buffer */
u32 ramsize; /* Size of RAM in SOCRAM (bytes) */
- u32 orig_ramsize; /* Size of RAM in SOCRAM (bytes) */
u32 hostintmask; /* Copy of Host Interrupt Mask */
u32 intstatus; /* Intstatus bits (events) pending */
@@ -772,11 +771,6 @@ module_param(brcmf_poll, uint, 0);
uint brcmf_intr = true;
module_param(brcmf_intr, uint, 0);
-/* override the RAM size if possible */
-#define DONGLE_MIN_MEMSIZE (128 * 1024)
-int brcmf_dongle_memsize;
-module_param(brcmf_dongle_memsize, int, 0);
-
#define RETRYCHAN(chan) ((chan) == SDPCM_EVENT_CHANNEL)
/* Retry count for register access failures */
@@ -857,17 +851,6 @@ static void brcmf_sdbrcm_pktfree2(struct brcmf_bus *bus, struct sk_buff *pkt)
brcmu_pkt_buf_free_skb(pkt);
}
-static void brcmf_sdbrcm_setmemsize(struct brcmf_bus *bus, int mem_size)
-{
- s32 min_size = DONGLE_MIN_MEMSIZE;
- /* Restrict the memsize to user specified limit */
- brcmf_dbg(ERROR, "user: Restrict the dongle ram size to %d, min %d\n",
- brcmf_dongle_memsize, min_size);
- if ((brcmf_dongle_memsize > min_size) &&
- (brcmf_dongle_memsize < (s32) bus->orig_ramsize))
- bus->ramsize = brcmf_dongle_memsize;
-}
-
static void brcmf_sdbrcm_sdlock(struct brcmf_bus *bus)
{
if (bus->threads_only)
@@ -3531,11 +3514,10 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_bus *bus)
}
/* adjust to the user specified RAM */
- brcmf_dbg(INFO, "Physical memory size: %d, usable memory size: %d\n",
- bus->orig_ramsize, bus->ramsize);
+ brcmf_dbg(INFO, "Physical memory size: %d\n", bus->ramsize);
brcmf_dbg(INFO, "Vars are at %d, orig varsize is %d\n",
varaddr, varsize);
- varsize = ((bus->orig_ramsize - 4) - varaddr);
+ varsize = ((bus->ramsize - 4) - varaddr);
/*
* Determine the length token:
@@ -3555,7 +3537,7 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_bus *bus)
varsize, varsizew);
/* Write the length token to the last word */
- bcmerror = brcmf_sdbrcm_membytes(bus, true, (bus->orig_ramsize - 4),
+ bcmerror = brcmf_sdbrcm_membytes(bus, true, (bus->ramsize - 4),
(u8 *)&varsizew_le, 4);
return bcmerror;
@@ -4630,17 +4612,11 @@ brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, u32 regsva)
/* Get info on the ARM and SOCRAM cores... */
brcmf_sdcard_reg_read(bus->sdiodev,
CORE_SB(bus->ci->armcorebase, sbidhigh), 4);
- bus->orig_ramsize = bus->ci->ramsize;
- if (!(bus->orig_ramsize)) {
+ bus->ramsize = bus->ci->ramsize;
+ if (!(bus->ramsize)) {
brcmf_dbg(ERROR, "failed to find SOCRAM memory!\n");
goto fail;
}
- bus->ramsize = bus->orig_ramsize;
- if (brcmf_dongle_memsize)
- brcmf_sdbrcm_setmemsize(bus, brcmf_dongle_memsize);
-
- brcmf_dbg(ERROR, "DHD: dongle ram size is set to %d(orig %d)\n",
- bus->ramsize, bus->orig_ramsize);
/* Set core control so an SDIO reset does a backplane reset */
reg_addr = bus->ci->buscorebase +
@@ -4819,7 +4795,6 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
*/
brcmf_txbound = BRCMF_TXBOUND;
brcmf_rxbound = BRCMF_RXBOUND;
- brcmf_dongle_memsize = 0;
brcmf_txminmax = BRCMF_TXMINMAX;
brcmf_c_init();
--
1.7.1
Use constant to replace global variable used for watchdog polling
Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 2 +-
drivers/staging/brcm80211/brcmfmac/dhd_bus.h | 6 ++--
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 45 +++++++++---------------
3 files changed, 21 insertions(+), 32 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
index d9d1592..5906337 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
@@ -375,7 +375,7 @@ void brcmf_sdio_unregister(void)
void brcmf_sdio_wdtmr_enable(struct brcmf_sdio_dev *sdiodev, bool enable)
{
if (enable)
- brcmf_sdbrcm_wd_timer(sdiodev->bus, brcmf_watchdog_ms);
+ brcmf_sdbrcm_wd_timer(sdiodev->bus, BRCMF_WD_POLL_MS);
else
brcmf_sdbrcm_wd_timer(sdiodev->bus, 0);
}
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_bus.h b/drivers/staging/brcm80211/brcmfmac/dhd_bus.h
index d02cb10..104c0e7 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_bus.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_bus.h
@@ -20,6 +20,9 @@
/* Packet alignment for most efficient SDIO (can change based on platform) */
#define BRCMF_SDALIGN (1 << 6)
+/* watchdog polling interval in ms */
+#define BRCMF_WD_POLL_MS 10
+
/*
* Exported from brcmf bus module (brcmf_usb, brcmf_sdio)
*/
@@ -28,9 +31,6 @@
extern uint brcmf_txbound;
extern uint brcmf_rxbound;
-/* Watchdog timer interval */
-extern uint brcmf_watchdog_ms;
-
/* Indicate (dis)interest in finding dongles. */
extern int brcmf_bus_register(void);
extern void brcmf_bus_unregister(void);
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 53de5a7..4033e73 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -612,6 +612,7 @@ struct brcmf_bus {
uint pollcnt; /* Count of active polls */
#ifdef BCMDBG
+ uint console_interval;
struct brcmf_console console; /* Console output polling support */
uint console_addr; /* Console address from shared struct */
#endif /* BCMDBG */
@@ -735,20 +736,10 @@ static int tx_packets[NUMPRIO];
int brcmf_watchdog_prio = 97;
module_param(brcmf_watchdog_prio, int, 0);
-/* Watchdog interval */
-uint brcmf_watchdog_ms = 10;
-module_param(brcmf_watchdog_ms, uint, 0);
-
/* DPC thread priority, -1 to use tasklet */
int brcmf_dpc_prio = 98;
module_param(brcmf_dpc_prio, int, 0);
-#ifdef BCMDBG
-/* Console poll interval */
-uint brcmf_console_ms;
-module_param(brcmf_console_ms, uint, 0);
-#endif /* BCMDBG */
-
/* Tx/Rx bounds */
uint brcmf_txbound;
uint brcmf_rxbound;
@@ -1023,7 +1014,7 @@ static int brcmf_sdbrcm_clkctl(struct brcmf_bus *bus, uint target, bool pendok)
/* Early exit if we're already there */
if (bus->clkstate == target) {
if (target == CLK_AVAIL) {
- brcmf_sdbrcm_wd_timer(bus, brcmf_watchdog_ms);
+ brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS);
bus->activity = true;
}
return 0;
@@ -1036,7 +1027,7 @@ static int brcmf_sdbrcm_clkctl(struct brcmf_bus *bus, uint target, bool pendok)
brcmf_sdbrcm_sdclk(bus, true);
/* Now request HT Avail on the backplane */
brcmf_sdbrcm_htclk(bus, true, pendok);
- brcmf_sdbrcm_wd_timer(bus, brcmf_watchdog_ms);
+ brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS);
bus->activity = true;
break;
@@ -1049,7 +1040,7 @@ static int brcmf_sdbrcm_clkctl(struct brcmf_bus *bus, uint target, bool pendok)
else
brcmf_dbg(ERROR, "request for %d -> %d\n",
bus->clkstate, target);
- brcmf_sdbrcm_wd_timer(bus, brcmf_watchdog_ms);
+ brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS);
break;
case CLK_NONE:
@@ -4038,7 +4029,7 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex)
/* Start the watchdog timer */
bus->drvr->tickcnt = 0;
- brcmf_sdbrcm_wd_timer(bus, brcmf_watchdog_ms);
+ brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS);
if (enforce_mutex)
brcmf_sdbrcm_sdlock(bus);
@@ -4207,15 +4198,15 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_pub *drvr)
}
#ifdef BCMDBG
/* Poll for console output periodically */
- if (drvr->busstate == BRCMF_BUS_DATA && brcmf_console_ms != 0) {
- bus->console.count += brcmf_watchdog_ms;
- if (bus->console.count >= brcmf_console_ms) {
- bus->console.count -= brcmf_console_ms;
+ if (drvr->busstate == BRCMF_BUS_DATA && bus->console_interval != 0) {
+ bus->console.count += BRCMF_WD_POLL_MS;
+ if (bus->console.count >= bus->console_interval) {
+ bus->console.count -= bus->console_interval;
/* Make sure backplane clock is on */
brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
if (brcmf_sdbrcm_readconsole(bus) < 0)
- brcmf_console_ms = 0; /* On error,
- stop trying */
+ /* stop on error */
+ bus->console_interval = 0;
}
}
#endif /* BCMDBG */
@@ -4226,7 +4217,7 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_pub *drvr)
bus->idlecount = 0;
if (bus->activity) {
bus->activity = false;
- brcmf_sdbrcm_wd_timer(bus, brcmf_watchdog_ms);
+ brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS);
} else {
brcmf_sdbrcm_clkctl(bus, CLK_NONE, false);
}
@@ -4723,7 +4714,7 @@ brcmf_sdbrcm_watchdog(unsigned long data)
/* Reschedule the watchdog */
if (bus->wd_timer_valid)
- mod_timer(&bus->timer, jiffies + brcmf_watchdog_ms * HZ / 1000);
+ mod_timer(&bus->timer, jiffies + BRCMF_WD_POLL_MS * HZ / 1000);
}
static void
@@ -5017,7 +5008,7 @@ int brcmf_bus_devreset(struct brcmf_pub *drvr, u8 flag)
brcmf_dbg(ERROR, "Set DEVRESET=false invoked when device is on\n");
bcmerror = -EIO;
}
- brcmf_sdbrcm_wd_timer(bus, brcmf_watchdog_ms);
+ brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS);
}
return bcmerror;
}
@@ -5038,9 +5029,7 @@ brcmf_sdbrcm_wd_timer(struct brcmf_bus *bus, uint wdtick)
}
if (wdtick) {
- brcmf_watchdog_ms = (uint) wdtick;
-
- if (bus->save_ms != brcmf_watchdog_ms) {
+ if (bus->save_ms != BRCMF_WD_POLL_MS) {
if (bus->wd_timer_valid == true)
/* Stop timer and restart at new value */
del_timer_sync(&bus->timer);
@@ -5049,13 +5038,13 @@ brcmf_sdbrcm_wd_timer(struct brcmf_bus *bus, uint wdtick)
dynamically changed or in the first instance
*/
bus->timer.expires =
- jiffies + brcmf_watchdog_ms * HZ / 1000;
+ jiffies + BRCMF_WD_POLL_MS * HZ / 1000;
add_timer(&bus->timer);
} else {
/* Re arm the timer, at last watchdog period */
mod_timer(&bus->timer,
- jiffies + brcmf_watchdog_ms * HZ / 1000);
+ jiffies + BRCMF_WD_POLL_MS * HZ / 1000);
}
bus->wd_timer_valid = true;
--
1.7.1
Use work queue to defer cfg80211 event handle jobs
Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 85 +++++-----------------
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h | 3 +-
2 files changed, 21 insertions(+), 67 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index 5e86e21..2dd28a2 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -3248,69 +3248,30 @@ static void brcmf_put_event(struct brcmf_cfg80211_event_q *e)
kfree(e);
}
-static s32 brcmf_event_handler(void *data)
+static void brcmf_cfg80211_event_handler(struct work_struct *work)
{
struct brcmf_cfg80211_priv *cfg_priv =
- (struct brcmf_cfg80211_priv *)data;
- struct sched_param param = {.sched_priority = MAX_RT_PRIO - 1 };
+ container_of(work, struct brcmf_cfg80211_priv,
+ event_work);
struct brcmf_cfg80211_event_q *e;
- DECLARE_WAITQUEUE(wait, current);
- sched_setscheduler(current, SCHED_FIFO, ¶m);
- allow_signal(SIGTERM);
- add_wait_queue(&cfg_priv->event_waitq, &wait);
- while (1) {
- prepare_to_wait(&cfg_priv->event_waitq, &wait,
- TASK_INTERRUPTIBLE);
-
- schedule();
-
- if (kthread_should_stop())
- break;
-
- e = brcmf_deq_event(cfg_priv);
- if (unlikely(!e)) {
- WL_ERR("event queue empty...\n");
- continue;
- }
-
- do {
- WL_INFO("event type (%d)\n", e->etype);
- if (cfg_priv->el.handler[e->etype])
- cfg_priv->el.handler[e->etype](cfg_priv,
- cfg_to_ndev(cfg_priv),
- &e->emsg, e->edata);
- else
- WL_INFO("Unknown Event (%d): ignoring\n",
- e->etype);
- brcmf_put_event(e);
- } while ((e = brcmf_deq_event(cfg_priv)));
+ e = brcmf_deq_event(cfg_priv);
+ if (unlikely(!e)) {
+ WL_ERR("event queue empty...\n");
+ return;
}
- finish_wait(&cfg_priv->event_waitq, &wait);
- WL_INFO("was terminated\n");
- return 0;
-}
-static s32 brcmf_create_event_handler(struct brcmf_cfg80211_priv *cfg_priv)
-{
- init_waitqueue_head(&cfg_priv->event_waitq);
- cfg_priv->event_tsk = kthread_run(brcmf_event_handler, cfg_priv,
- "wl_event_handler");
- if (IS_ERR(cfg_priv->event_tsk)) {
- cfg_priv->event_tsk = NULL;
- WL_ERR("failed to create event thread\n");
- return -ENOMEM;
- }
- return 0;
-}
+ do {
+ WL_INFO("event type (%d)\n", e->etype);
+ if (cfg_priv->el.handler[e->etype])
+ cfg_priv->el.handler[e->etype](cfg_priv,
+ cfg_to_ndev(cfg_priv),
+ &e->emsg, e->edata);
+ else
+ WL_INFO("Unknown Event (%d): ignoring\n", e->etype);
+ brcmf_put_event(e);
+ } while ((e = brcmf_deq_event(cfg_priv)));
-static void brcmf_destroy_event_handler(struct brcmf_cfg80211_priv *cfg_priv)
-{
- if (cfg_priv->event_tsk) {
- send_sig(SIGTERM, cfg_priv->event_tsk, 1);
- kthread_stop(cfg_priv->event_tsk);
- cfg_priv->event_tsk = NULL;
- }
}
static void brcmf_init_eq(struct brcmf_cfg80211_priv *cfg_priv)
@@ -3352,8 +3313,7 @@ static s32 wl_init_priv(struct brcmf_cfg80211_priv *cfg_priv)
err = brcmf_init_priv_mem(cfg_priv);
if (unlikely(err))
return err;
- if (unlikely(brcmf_create_event_handler(cfg_priv)))
- return -ENOMEM;
+ INIT_WORK(&cfg_priv->event_work, brcmf_cfg80211_event_handler);
brcmf_init_eloop_handler(&cfg_priv->el);
mutex_init(&cfg_priv->usr_sync);
err = brcmf_init_iscan(cfg_priv);
@@ -3368,7 +3328,7 @@ static s32 wl_init_priv(struct brcmf_cfg80211_priv *cfg_priv)
static void wl_deinit_priv(struct brcmf_cfg80211_priv *cfg_priv)
{
- brcmf_destroy_event_handler(cfg_priv);
+ cancel_work_sync(&cfg_priv->event_work);
cfg_priv->dongle_up = false; /* dongle down */
brcmf_flush_eq(cfg_priv);
brcmf_link_down(cfg_priv);
@@ -3438,11 +3398,6 @@ void brcmf_cfg80211_detach(struct brcmf_cfg80211_dev *cfg_dev)
kfree(cfg_dev);
}
-static void brcmf_wakeup_event(struct brcmf_cfg80211_priv *cfg_priv)
-{
- wake_up(&cfg_priv->event_waitq);
-}
-
void
brcmf_cfg80211_event(struct net_device *ndev,
const struct brcmf_event_msg *e, void *data)
@@ -3451,7 +3406,7 @@ brcmf_cfg80211_event(struct net_device *ndev,
struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev);
if (likely(!brcmf_enq_event(cfg_priv, event_type, e)))
- brcmf_wakeup_event(cfg_priv);
+ schedule_work(&cfg_priv->event_work);
}
static s32 brcmf_dongle_mode(struct net_device *ndev, s32 iftype)
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
index d27d4e6..79806c0 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
@@ -298,8 +298,7 @@ struct brcmf_cfg80211_priv {
struct brcmf_cfg80211_iscan_ctrl *iscan; /* iscan controller */
struct brcmf_cfg80211_connect_info conn_info; /* association info */
struct brcmf_cfg80211_pmk_list *pmk_list; /* wpa2 pmk list */
- struct task_struct *event_tsk; /* task of main event handler thread */
- wait_queue_head_t event_waitq; /* wait queue for main event handling */
+ struct work_struct event_work; /* event handler work struct */
unsigned long status; /* current dongle status */
void *pub;
u32 channel; /* current channel */
--
1.7.1
From: Roland Vossen <[email protected]>
Structures received from dongle have been annotated.
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd.h | 14 ++++++------
drivers/staging/brcm80211/brcmfmac/dhd_cdc.c | 3 +-
drivers/staging/brcm80211/brcmfmac/dhd_common.c | 21 ++++++++++---------
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 24 +++++++++++-----------
4 files changed, 32 insertions(+), 30 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index da53dd0..c368f71 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -134,13 +134,13 @@
#define BRCMF_EVENT_MSG_GROUP 0x04
struct brcmf_event_msg {
- u16 version;
- u16 flags;
- u32 event_type;
- u32 status;
- u32 reason;
- u32 auth_type;
- u32 datalen;
+ __be16 version;
+ __be16 flags;
+ __be32 event_type;
+ __be32 status;
+ __be32 reason;
+ __be32 auth_type;
+ __be32 datalen;
u8 addr[ETH_ALEN];
char ifname[IFNAMSIZ];
} __packed;
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c b/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
index 0d8389e..6f65683 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
@@ -322,7 +322,8 @@ brcmf_proto_ioctl(struct brcmf_pub *drvr, int ifidx, struct brcmf_ioctl *ioc,
/* Intercept the wme_dp ioctl here */
if (!ret && ioc->cmd == BRCMF_C_SET_VAR &&
!strcmp(ioc->buf, "wme_dp")) {
- int slen, val = 0;
+ int slen;
+ __le32 val = 0;
slen = strlen("wme_dp") + 1;
if (len >= (int)(slen + sizeof(int)))
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_common.c b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
index 02c022a..c9bf92a 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_common.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
@@ -53,15 +53,15 @@ static const char brcmf_version[] =
struct msgtrace_hdr {
u8 version;
u8 spare;
- u16 len; /* Len of the trace */
- u32 seqnum; /* Sequence number of message. Useful
+ __be16 len; /* Len of the trace */
+ __be32 seqnum; /* Sequence number of message. Useful
* if the messsage has been lost
* because of DMA error or a bus reset
* (ex: SDIO Func2)
*/
- u32 discarded_bytes; /* Number of discarded bytes because of
+ __be32 discarded_bytes; /* Number of discarded bytes because of
trace overflow */
- u32 discarded_printf; /* Number of discarded printf
+ __be32 discarded_printf; /* Number of discarded printf
because of trace overflow */
} __packed;
@@ -401,7 +401,7 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)
case BRCMF_E_RSSI:
brcmf_dbg(EVENT, "MACEVENT: %s %d\n",
- event_name, be32_to_cpu(*((int *)event_data)));
+ event_name, be32_to_cpu(*((__be32 *)event_data)));
break;
default:
@@ -498,14 +498,15 @@ brcmf_c_host_event(struct brcmf_info *drvr_priv, int *ifidx, void *pktdata,
/* put it back to BRCMF_E_NDIS_LINK */
if (type == BRCMF_E_NDIS_LINK) {
- u32 temp;
+ u32 temp1;
+ __be32 temp2;
- temp = get_unaligned_be32(&event->event_type);
+ temp1 = get_unaligned_be32(&event->event_type);
brcmf_dbg(TRACE, "Converted to WLC_E_LINK type %d\n",
- temp);
+ temp1);
- temp = be32_to_cpu(BRCMF_E_NDIS_LINK);
- memcpy((void *)(&pvt_data->msg.event_type), &temp,
+ temp2 = cpu_to_be32(BRCMF_E_NDIS_LINK);
+ memcpy((void *)(&pvt_data->msg.event_type), &temp2,
sizeof(pvt_data->msg.event_type));
}
break;
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 720f567..fb9b351 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -63,10 +63,10 @@ struct brcmf_trap {
#define CBUF_LEN (128)
-struct rte_log {
- u32 buf; /* Can't be pointer on (64-bit) hosts */
- uint buf_size;
- uint idx;
+struct rte_log_le {
+ __le32 buf; /* Can't be pointer on (64-bit) hosts */
+ __le32 buf_size;
+ __le32 idx;
char *_buf_compat; /* Redundant pointer for backward compat. */
};
@@ -89,7 +89,7 @@ struct rte_console {
* Output will be lost if the output wraps around faster than the host
* polls.
*/
- struct rte_log log;
+ struct rte_log_le log_le;
/* Console input line buffer
* Characters are read one at a time into cbuf
@@ -512,7 +512,7 @@ struct sdpcmd_regs {
struct brcmf_console {
uint count; /* Poll interval msec counter */
uint log_addr; /* Log struct address (fixed) */
- struct rte_log log; /* Log struct (host copy) */
+ struct rte_log_le log_le; /* Log struct (host copy) */
uint bufsize; /* Size of log buffer */
u8 *buf; /* Log buffer (host copy) */
uint last; /* Last buffer read index */
@@ -3153,21 +3153,21 @@ static int brcmf_sdbrcm_readconsole(struct brcmf_bus *bus)
return 0;
/* Read console log struct */
- addr = bus->console_addr + offsetof(struct rte_console, log);
- rv = brcmf_sdbrcm_membytes(bus, false, addr, (u8 *)&c->log,
- sizeof(c->log));
+ addr = bus->console_addr + offsetof(struct rte_console, log_le);
+ rv = brcmf_sdbrcm_membytes(bus, false, addr, (u8 *)&c->log_le,
+ sizeof(c->log_le));
if (rv < 0)
return rv;
/* Allocate console buffer (one time only) */
if (c->buf == NULL) {
- c->bufsize = le32_to_cpu(c->log.buf_size);
+ c->bufsize = le32_to_cpu(c->log_le.buf_size);
c->buf = kmalloc(c->bufsize, GFP_ATOMIC);
if (c->buf == NULL)
return -ENOMEM;
}
- idx = le32_to_cpu(c->log.idx);
+ idx = le32_to_cpu(c->log_le.idx);
/* Protect against corrupt value */
if (idx > c->bufsize)
@@ -3179,7 +3179,7 @@ static int brcmf_sdbrcm_readconsole(struct brcmf_bus *bus)
return 0;
/* Read the console buffer */
- addr = le32_to_cpu(c->log.buf);
+ addr = le32_to_cpu(c->log_le.buf);
rv = brcmf_sdbrcm_membytes(bus, false, addr, c->buf, c->bufsize);
if (rv < 0)
return rv;
--
1.7.1
From: Roland Vossen <[email protected]>
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/Makefile | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/Makefile b/drivers/staging/brcm80211/brcmfmac/Makefile
index 3d0878f..a1b7637 100644
--- a/drivers/staging/brcm80211/brcmfmac/Makefile
+++ b/drivers/staging/brcm80211/brcmfmac/Makefile
@@ -30,3 +30,4 @@ DHDOFILES = \
obj-$(CONFIG_BRCMFMAC) += brcmfmac.o
brcmfmac-objs += $(DHDOFILES)
+ccflags-y += -D__CHECK_ENDIAN__
--
1.7.1
From: Roland Vossen <[email protected]>
By deleting three redundant functions. The spinlock was related to
event queue operation. Event queue data members were also renamed
to make their function more clear.
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 49 ++++++++--------------
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h | 6 +-
2 files changed, 20 insertions(+), 35 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index 2dd28a2..0bda00c 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -3181,21 +3181,6 @@ init_priv_mem_out:
return -ENOMEM;
}
-static void brcmf_lock_eq(struct brcmf_cfg80211_priv *cfg_priv)
-{
- spin_lock_irq(&cfg_priv->eq_lock);
-}
-
-static void brcmf_unlock_eq(struct brcmf_cfg80211_priv *cfg_priv)
-{
- spin_unlock_irq(&cfg_priv->eq_lock);
-}
-
-static void brcmf_init_eq_lock(struct brcmf_cfg80211_priv *cfg_priv)
-{
- spin_lock_init(&cfg_priv->eq_lock);
-}
-
/*
* retrieve first queued event from head
*/
@@ -3205,13 +3190,13 @@ static struct brcmf_cfg80211_event_q *brcmf_deq_event(
{
struct brcmf_cfg80211_event_q *e = NULL;
- brcmf_lock_eq(cfg_priv);
- if (likely(!list_empty(&cfg_priv->eq_list))) {
- e = list_first_entry(&cfg_priv->eq_list,
- struct brcmf_cfg80211_event_q, eq_list);
- list_del(&e->eq_list);
+ spin_lock_irq(&cfg_priv->evt_q_lock);
+ if (likely(!list_empty(&cfg_priv->evt_q_list))) {
+ e = list_first_entry(&cfg_priv->evt_q_list,
+ struct brcmf_cfg80211_event_q, evt_q_list);
+ list_del(&e->evt_q_list);
}
- brcmf_unlock_eq(cfg_priv);
+ spin_unlock_irq(&cfg_priv->evt_q_lock);
return e;
}
@@ -3236,9 +3221,9 @@ brcmf_enq_event(struct brcmf_cfg80211_priv *cfg_priv, u32 event,
e->etype = event;
memcpy(&e->emsg, msg, sizeof(struct brcmf_event_msg));
- brcmf_lock_eq(cfg_priv);
- list_add_tail(&e->eq_list, &cfg_priv->eq_list);
- brcmf_unlock_eq(cfg_priv);
+ spin_lock_irq(&cfg_priv->evt_q_lock);
+ list_add_tail(&e->evt_q_list, &cfg_priv->evt_q_list);
+ spin_unlock_irq(&cfg_priv->evt_q_lock);
return err;
}
@@ -3276,22 +3261,22 @@ static void brcmf_cfg80211_event_handler(struct work_struct *work)
static void brcmf_init_eq(struct brcmf_cfg80211_priv *cfg_priv)
{
- brcmf_init_eq_lock(cfg_priv);
- INIT_LIST_HEAD(&cfg_priv->eq_list);
+ spin_lock_init(&cfg_priv->evt_q_lock);
+ INIT_LIST_HEAD(&cfg_priv->evt_q_list);
}
static void brcmf_flush_eq(struct brcmf_cfg80211_priv *cfg_priv)
{
struct brcmf_cfg80211_event_q *e;
- brcmf_lock_eq(cfg_priv);
- while (!list_empty(&cfg_priv->eq_list)) {
- e = list_first_entry(&cfg_priv->eq_list,
- struct brcmf_cfg80211_event_q, eq_list);
- list_del(&e->eq_list);
+ spin_lock_irq(&cfg_priv->evt_q_lock);
+ while (!list_empty(&cfg_priv->evt_q_list)) {
+ e = list_first_entry(&cfg_priv->evt_q_list,
+ struct brcmf_cfg80211_event_q, evt_q_list);
+ list_del(&e->evt_q_list);
kfree(e);
}
- brcmf_unlock_eq(cfg_priv);
+ spin_unlock_irq(&cfg_priv->evt_q_lock);
}
static s32 wl_init_priv(struct brcmf_cfg80211_priv *cfg_priv)
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
index 79806c0..14a32e1 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
@@ -199,7 +199,7 @@ struct brcmf_cfg80211_ie {
/* event queue for cfg80211 main event */
struct brcmf_cfg80211_event_q {
- struct list_head eq_list;
+ struct list_head evt_q_list;
u32 etype;
struct brcmf_event_msg emsg;
s8 edata[1];
@@ -282,8 +282,8 @@ struct brcmf_cfg80211_priv {
struct cfg80211_scan_request *scan_request; /* scan request
object */
struct brcmf_cfg80211_event_loop el; /* main event loop */
- struct list_head eq_list; /* used for event queue */
- spinlock_t eq_lock; /* for event queue synchronization */
+ struct list_head evt_q_list; /* used for event queue */
+ spinlock_t evt_q_lock; /* for event queue synchronization */
struct mutex usr_sync; /* maily for dongle up/down synchronization */
struct brcmf_scan_results *bss_list; /* bss_list holding scanned
ap information */
--
1.7.1
Use constant for idle time setting.
Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd.h | 1 +
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 5 +----
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index 1e18ad0..7ca9172 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -808,5 +808,6 @@ extern void brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg,
#define BRCMF_IDLE_IMMEDIATE (-1)
#define BRCMF_IDLE_ACTIVE 0 /* Do not request any SD clock change
when idle */
+#define BRCMF_IDLE_INTERVAL 1
#endif /* _BRCMF_H_ */
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 4033e73..57049ec 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -747,9 +747,6 @@ module_param(brcmf_txbound, uint, 0);
module_param(brcmf_rxbound, uint, 0);
static uint brcmf_txminmax;
-int brcmf_idletime = 1;
-module_param(brcmf_idletime, int, 0);
-
#define SDIO_DRIVE_STRENGTH 6 /* in milliamps */
/* Use polling */
@@ -4650,7 +4647,7 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus)
/* ...and initialize clock/power states */
bus->clkstate = CLK_SDONLY;
- bus->idletime = (s32) brcmf_idletime;
+ bus->idletime = BRCMF_IDLE_INTERVAL;
bus->idleclock = BRCMF_IDLE_ACTIVE;
/* Query the F2 block size, set roundup accordingly */
--
1.7.1
From: Roland Vossen <[email protected]>
kzalloc/kmalloc already reports an allocation failure themselves.
Reported-by: Dan Carpenter <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd_cdc.c | 4 +-
drivers/staging/brcm80211/brcmfmac/dhd_common.c | 13 ++----
drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 19 ++------
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 26 ++---------
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 50 ++++++----------------
drivers/staging/brcm80211/brcmsmac/ampdu.c | 6 +--
drivers/staging/brcm80211/brcmsmac/antsel.c | 5 +--
drivers/staging/brcm80211/brcmsmac/channel.c | 5 +--
drivers/staging/brcm80211/brcmsmac/dma.c | 16 +------
drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 11 +----
drivers/staging/brcm80211/brcmsmac/nicpci.c | 3 +-
drivers/staging/brcm80211/brcmsmac/phy_shim.c | 7 +--
12 files changed, 41 insertions(+), 124 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c b/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
index 28bdf9e..91b4d3c 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
@@ -417,10 +417,8 @@ int brcmf_proto_attach(struct brcmf_pub *drvr)
struct brcmf_proto *cdc;
cdc = kzalloc(sizeof(struct brcmf_proto), GFP_ATOMIC);
- if (!cdc) {
- brcmf_dbg(ERROR, "kmalloc failed\n");
+ if (!cdc)
goto fail;
- }
/* ensure that the msg buf directly follows the cdc msg struct */
if ((unsigned long)(&cdc->msg + 1) != (unsigned long)cdc->buf) {
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_common.c b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
index 0c41c1c..963d1a9 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_common.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
@@ -562,10 +562,9 @@ brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg, int enable,
struct brcmf_pkt_filter_enable *pkt_filterp;
arg_save = kmalloc(strlen(arg) + 1, GFP_ATOMIC);
- if (!arg_save) {
- brcmf_dbg(ERROR, "kmalloc failed\n");
+ if (!arg_save)
goto fail;
- }
+
arg_org = arg_save;
memcpy(arg_save, arg, strlen(arg) + 1);
@@ -635,18 +634,14 @@ void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg)
char *arg_save = NULL, *arg_org = NULL;
arg_save = kstrdup(arg, GFP_ATOMIC);
- if (!arg_save) {
- brcmf_dbg(ERROR, "kmalloc failed\n");
+ if (!arg_save)
goto fail;
- }
arg_org = arg_save;
buf = kmalloc(PKTFILTER_BUF_SIZE, GFP_ATOMIC);
- if (!buf) {
- brcmf_dbg(ERROR, "kmalloc failed\n");
+ if (!buf)
goto fail;
- }
argv[i] = strsep(&arg_save, " ");
while (argv[i++])
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index cc8564a..659a9c2 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -159,11 +159,8 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
buflen = sizeof("mcast_list") + sizeof(cnt) + (cnt * ETH_ALEN);
bufp = buf = kmalloc(buflen, GFP_ATOMIC);
- if (!bufp) {
- brcmf_dbg(ERROR, "%s: out of memory for mcast_list, cnt %d\n",
- brcmf_ifname(&drvr_priv->pub, 0), cnt);
+ if (!bufp)
return;
- }
strcpy(bufp, "mcast_list");
bufp += strlen("mcast_list") + 1;
@@ -202,11 +199,9 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
buflen = sizeof("allmulti") + sizeof(allmulti);
buf = kmalloc(buflen, GFP_ATOMIC);
- if (!buf) {
- brcmf_dbg(ERROR, "%s: out of memory for allmulti\n",
- brcmf_ifname(&drvr_priv->pub, 0));
+ if (!buf)
return;
- }
+
allmulti_le = cpu_to_le32(allmulti);
if (!brcmu_mkiovar
@@ -963,10 +958,8 @@ brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, struct net_device *net,
ifp = drvr_priv->iflist[ifidx];
if (!ifp) {
ifp = kmalloc(sizeof(struct brcmf_if), GFP_ATOMIC);
- if (!ifp) {
- brcmf_dbg(ERROR, "OOM - struct brcmf_if\n");
+ if (!ifp)
return -ENOMEM;
- }
}
memset(ifp, 0, sizeof(struct brcmf_if));
@@ -1019,10 +1012,8 @@ struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, uint bus_hdrlen)
/* Allocate primary brcmf_info */
drvr_priv = kzalloc(sizeof(struct brcmf_info), GFP_ATOMIC);
- if (!drvr_priv) {
- brcmf_dbg(ERROR, "OOM - alloc brcmf_info\n");
+ if (!drvr_priv)
goto fail;
- }
/*
* Save the brcmf_info into the priv
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 66ab752..9f8bcb3 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -2956,10 +2956,8 @@ static int brcmf_sdbrcm_mem_dump(struct brcmf_bus *bus)
/* Get full mem size */
size = bus->ramsize;
buf = kmalloc(size, GFP_ATOMIC);
- if (!buf) {
- brcmf_dbg(ERROR, "Out of memory (%d bytes)\n", size);
+ if (!buf)
return -1;
- }
/* Read mem content */
printk(KERN_DEBUG "Dump dongle memory");
@@ -3013,7 +3011,6 @@ static int brcmf_sdbrcm_checkdied(struct brcmf_bus *bus, u8 *data, uint size)
size = msize;
mbuffer = data = kmalloc(msize, GFP_ATOMIC);
if (mbuffer == NULL) {
- brcmf_dbg(ERROR, "kmalloc(%d) failed\n", msize);
bcmerror = -ENOMEM;
goto done;
}
@@ -3021,7 +3018,6 @@ static int brcmf_sdbrcm_checkdied(struct brcmf_bus *bus, u8 *data, uint size)
str = kmalloc(maxstrlen, GFP_ATOMIC);
if (str == NULL) {
- brcmf_dbg(ERROR, "kmalloc(%d) failed\n", maxstrlen);
bcmerror = -ENOMEM;
goto done;
}
@@ -3737,8 +3733,6 @@ static int brcmf_sdbrcm_download_code_file(struct brcmf_bus *bus)
memptr = memblock = kmalloc(MEMBLOCK + BRCMF_SDALIGN, GFP_ATOMIC);
if (memblock == NULL) {
- brcmf_dbg(ERROR, "Failed to allocate memory %d bytes\n",
- MEMBLOCK);
ret = -ENOMEM;
goto err;
}
@@ -3837,8 +3831,6 @@ static int brcmf_sdbrcm_download_nvram(struct brcmf_bus *bus)
memblock = kmalloc(MEMBLOCK, GFP_ATOMIC);
if (memblock == NULL) {
- brcmf_dbg(ERROR, "Failed to allocate memory %d bytes\n",
- MEMBLOCK);
ret = -ENOMEM;
goto err;
}
@@ -4254,18 +4246,13 @@ static bool brcmf_sdbrcm_probe_malloc(struct brcmf_bus *bus)
roundup((bus->drvr->maxctl + SDPCM_HDRLEN),
ALIGNMENT) + BRCMF_SDALIGN;
bus->rxbuf = kmalloc(bus->rxblen, GFP_ATOMIC);
- if (!(bus->rxbuf)) {
- brcmf_dbg(ERROR, "kmalloc of %d-byte rxbuf failed\n",
- bus->rxblen);
+ if (!(bus->rxbuf))
goto fail;
- }
}
/* Allocate buffer to receive glomed packet */
bus->databuf = kmalloc(MAX_DATA_BUF, GFP_ATOMIC);
if (!(bus->databuf)) {
- brcmf_dbg(ERROR, "kmalloc of %d-byte databuf failed\n",
- MAX_DATA_BUF);
/* release rxbuf which was already located as above */
if (!bus->rxblen)
kfree(bus->rxbuf);
@@ -4457,10 +4444,8 @@ brcmf_sdbrcm_chip_attach(struct brcmf_bus *bus, u32 regs)
/* alloc chip_info_t */
ci = kzalloc(sizeof(struct chip_info), GFP_ATOMIC);
- if (NULL == ci) {
- brcmf_dbg(ERROR, "malloc failed!\n");
+ if (NULL == ci)
return -ENOMEM;
- }
/* bus/core/clk setup for register access */
/* Try forcing SDIO core to do ALPAvail request only */
@@ -4785,10 +4770,9 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
/* Allocate private bus interface state */
bus = kzalloc(sizeof(struct brcmf_bus), GFP_ATOMIC);
- if (!bus) {
- brcmf_dbg(ERROR, "kmalloc of struct dhd_bus failed\n");
+ if (!bus)
goto fail;
- }
+
bus->sdiodev = sdiodev;
sdiodev->bus = bus;
bus->txbound = BRCMF_TXBOUND;
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index 6acaaae..d0ae2b6 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -2023,7 +2023,6 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_priv *cfg_priv,
buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL);
if (buf == NULL) {
- WL_ERR("kzalloc() failed\n");
err = -ENOMEM;
goto CleanUp;
}
@@ -2660,10 +2659,9 @@ static struct wireless_dev *brcmf_alloc_wdev(s32 sizeof_iface,
s32 err = 0;
wdev = kzalloc(sizeof(*wdev), GFP_KERNEL);
- if (!wdev) {
- WL_ERR("Could not allocate wireless device\n");
+ if (!wdev)
return ERR_PTR(-ENOMEM);
- }
+
wdev->wiphy =
wiphy_new(&wl_cfg80211_ops,
sizeof(struct brcmf_cfg80211_priv) + sizeof_iface);
@@ -3124,51 +3122,33 @@ static void brcmf_deinit_priv_mem(struct brcmf_cfg80211_priv *cfg_priv)
static s32 brcmf_init_priv_mem(struct brcmf_cfg80211_priv *cfg_priv)
{
cfg_priv->scan_results = kzalloc(WL_SCAN_BUF_MAX, GFP_KERNEL);
- if (!cfg_priv->scan_results) {
- WL_ERR("Scan results alloc failed\n");
+ if (!cfg_priv->scan_results)
goto init_priv_mem_out;
- }
cfg_priv->conf = kzalloc(sizeof(*cfg_priv->conf), GFP_KERNEL);
- if (!cfg_priv->conf) {
- WL_ERR("wl_conf alloc failed\n");
+ if (!cfg_priv->conf)
goto init_priv_mem_out;
- }
cfg_priv->profile = kzalloc(sizeof(*cfg_priv->profile), GFP_KERNEL);
- if (!cfg_priv->profile) {
- WL_ERR("wl_profile alloc failed\n");
+ if (!cfg_priv->profile)
goto init_priv_mem_out;
- }
cfg_priv->bss_info = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL);
- if (!cfg_priv->bss_info) {
- WL_ERR("Bss information alloc failed\n");
+ if (!cfg_priv->bss_info)
goto init_priv_mem_out;
- }
cfg_priv->scan_req_int = kzalloc(sizeof(*cfg_priv->scan_req_int),
GFP_KERNEL);
- if (!cfg_priv->scan_req_int) {
- WL_ERR("Scan req alloc failed\n");
+ if (!cfg_priv->scan_req_int)
goto init_priv_mem_out;
- }
cfg_priv->ioctl_buf = kzalloc(WL_IOCTL_LEN_MAX, GFP_KERNEL);
- if (!cfg_priv->ioctl_buf) {
- WL_ERR("Ioctl buf alloc failed\n");
+ if (!cfg_priv->ioctl_buf)
goto init_priv_mem_out;
- }
cfg_priv->extra_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL);
- if (!cfg_priv->extra_buf) {
- WL_ERR("Extra buf alloc failed\n");
+ if (!cfg_priv->extra_buf)
goto init_priv_mem_out;
- }
cfg_priv->iscan = kzalloc(sizeof(*cfg_priv->iscan), GFP_KERNEL);
- if (!cfg_priv->iscan) {
- WL_ERR("Iscan buf alloc failed\n");
+ if (!cfg_priv->iscan)
goto init_priv_mem_out;
- }
cfg_priv->pmk_list = kzalloc(sizeof(*cfg_priv->pmk_list), GFP_KERNEL);
- if (!cfg_priv->pmk_list) {
- WL_ERR("pmk list alloc failed\n");
+ if (!cfg_priv->pmk_list)
goto init_priv_mem_out;
- }
return 0;
@@ -3210,10 +3190,8 @@ brcmf_enq_event(struct brcmf_cfg80211_priv *cfg_priv, u32 event,
s32 err = 0;
e = kzalloc(sizeof(struct brcmf_cfg80211_event_q), GFP_KERNEL);
- if (!e) {
- WL_ERR("event alloc failed\n");
+ if (!e)
return -ENOMEM;
- }
e->etype = event;
memcpy(&e->emsg, msg, sizeof(struct brcmf_event_msg));
@@ -3333,10 +3311,8 @@ struct brcmf_cfg80211_dev *brcmf_cfg80211_attach(struct net_device *ndev,
return NULL;
}
cfg_dev = kzalloc(sizeof(struct brcmf_cfg80211_dev), GFP_KERNEL);
- if (!cfg_dev) {
- WL_ERR("wl_cfg80211_dev is invalid\n");
+ if (!cfg_dev)
return NULL;
- }
wdev = brcmf_alloc_wdev(sizeof(struct brcmf_cfg80211_iface), busdev);
if (IS_ERR(wdev)) {
diff --git a/drivers/staging/brcm80211/brcmsmac/ampdu.c b/drivers/staging/brcm80211/brcmsmac/ampdu.c
index d221a3a..b94d60c 100644
--- a/drivers/staging/brcm80211/brcmsmac/ampdu.c
+++ b/drivers/staging/brcm80211/brcmsmac/ampdu.c
@@ -227,11 +227,9 @@ struct ampdu_info *brcms_c_ampdu_attach(struct brcms_c_info *wlc)
int i;
ampdu = kzalloc(sizeof(struct ampdu_info), GFP_ATOMIC);
- if (!ampdu) {
- wiphy_err(wlc->wiphy, "wl%d: brcms_c_ampdu_attach: out of mem"
- "\n", wlc->pub->unit);
+ if (!ampdu)
return NULL;
- }
+
ampdu->wlc = wlc;
for (i = 0; i < AMPDU_MAX_SCB_TID; i++)
diff --git a/drivers/staging/brcm80211/brcmsmac/antsel.c b/drivers/staging/brcm80211/brcmsmac/antsel.c
index 29b51a1..c61c520 100644
--- a/drivers/staging/brcm80211/brcmsmac/antsel.c
+++ b/drivers/staging/brcm80211/brcmsmac/antsel.c
@@ -110,11 +110,8 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc)
struct antsel_info *asi;
asi = kzalloc(sizeof(struct antsel_info), GFP_ATOMIC);
- if (!asi) {
- wiphy_err(wlc->wiphy, "wl%d: brcms_c_antsel_attach: out of "
- "mem\n", wlc->pub->unit);
+ if (!asi)
return NULL;
- }
asi->wlc = wlc;
asi->pub = wlc->pub;
diff --git a/drivers/staging/brcm80211/brcmsmac/channel.c b/drivers/staging/brcm80211/brcmsmac/channel.c
index af01c9d..a9defe2 100644
--- a/drivers/staging/brcm80211/brcmsmac/channel.c
+++ b/drivers/staging/brcm80211/brcmsmac/channel.c
@@ -1090,11 +1090,8 @@ struct brcms_cm_info *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc)
BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit);
wlc_cm = kzalloc(sizeof(struct brcms_cm_info), GFP_ATOMIC);
- if (wlc_cm == NULL) {
- wiphy_err(wlc->wiphy, "wl%d: %s: out of memory", pub->unit,
- __func__);
+ if (wlc_cm == NULL)
return NULL;
- }
wlc_cm->pub = pub;
wlc_cm->wlc = wlc;
wlc->cmi = wlc_cm;
diff --git a/drivers/staging/brcm80211/brcmsmac/dma.c b/drivers/staging/brcm80211/brcmsmac/dma.c
index 06990b3..714c74c 100644
--- a/drivers/staging/brcm80211/brcmsmac/dma.c
+++ b/drivers/staging/brcm80211/brcmsmac/dma.c
@@ -559,12 +559,8 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,
/* allocate private info structure */
di = kzalloc(sizeof(struct dma_info), GFP_ATOMIC);
- if (di == NULL) {
-#ifdef BCMDBG
- printk(KERN_ERR "dma_attach: out of memory\n");
-#endif
+ if (di == NULL)
return NULL;
- }
di->msg_level = msg_level ? msg_level : &dma_msg_level;
@@ -651,22 +647,16 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,
if (ntxd) {
size = ntxd * sizeof(void *);
di->txp = kzalloc(size, GFP_ATOMIC);
- if (di->txp == NULL) {
- DMA_ERROR(("%s: dma_attach: out of tx memory\n",
- di->name));
+ if (di->txp == NULL)
goto fail;
- }
}
/* allocate rx packet pointer vector */
if (nrxd) {
size = nrxd * sizeof(void *);
di->rxp = kzalloc(size, GFP_ATOMIC);
- if (di->rxp == NULL) {
- DMA_ERROR(("%s: dma_attach: out of rx memory\n",
- di->name));
+ if (di->rxp == NULL)
goto fail;
- }
}
/*
diff --git a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
index 65d30b5..32d7abf 100644
--- a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
@@ -1541,11 +1541,8 @@ struct brcms_timer *brcms_init_timer(struct brcms_info *wl,
struct brcms_timer *t;
t = kzalloc(sizeof(struct brcms_timer), GFP_ATOMIC);
- if (!t) {
- wiphy_err(wl->wiphy, "wl%d: brcms_init_timer: out of memory\n",
- wl->pub->unit);
+ if (!t)
return NULL;
- }
init_timer(&t->timer);
t->timer.data = (unsigned long) t;
@@ -1659,11 +1656,9 @@ int brcms_ucode_init_buf(struct brcms_info *wl, void **pbuf, u32 idx)
pdata = wl->fw.fw_bin[i]->data +
le32_to_cpu(hdr->offset);
*pbuf = kmalloc(len, GFP_ATOMIC);
- if (*pbuf == NULL) {
- wiphy_err(wl->wiphy, "fail to alloc %d"
- " bytes\n", len);
+ if (*pbuf == NULL)
goto fail;
- }
+
memcpy(*pbuf, pdata, len);
return 0;
}
diff --git a/drivers/staging/brcm80211/brcmsmac/nicpci.c b/drivers/staging/brcm80211/brcmsmac/nicpci.c
index a2cab5c..f5a2695 100644
--- a/drivers/staging/brcm80211/brcmsmac/nicpci.c
+++ b/drivers/staging/brcm80211/brcmsmac/nicpci.c
@@ -245,9 +245,8 @@ 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) {
+ if (pi == NULL)
return NULL;
- }
pi->sih = sih;
pi->dev = pdev;
diff --git a/drivers/staging/brcm80211/brcmsmac/phy_shim.c b/drivers/staging/brcm80211/brcmsmac/phy_shim.c
index 31c9374..e0c19b6 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy_shim.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy_shim.c
@@ -41,12 +41,9 @@ struct phy_shim_info *wlc_phy_shim_attach(struct brcms_hardware *wlc_hw,
struct phy_shim_info *physhim = NULL;
physhim = kzalloc(sizeof(struct phy_shim_info), GFP_ATOMIC);
- if (!physhim) {
- wiphy_err(wlc_hw->wlc->wiphy,
- "wl%d: wlc_phy_shim_attach: out of mem\n",
- wlc_hw->unit);
+ if (!physhim)
return NULL;
- }
+
physhim->wlc_hw = wlc_hw;
physhim->wlc = wlc;
physhim->wl = wl;
--
1.7.1