Skip to content

Commit

Permalink
brcm80211: fmac: update bus state in common driver part
Browse files Browse the repository at this point in the history
The bus state is updated in the sdio bus init function, but it is
better to do it when the brcmf_bus_start() function is completed
successfully. The brcmf_netdev_open() function will return -EAGAIN
until the state is updated instead of calling brcmf_bus_start() to
avoid reentering that function.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Arend van Spriel authored and John W. Linville committed Feb 22, 2012
1 parent c0e89f0 commit 1bb1f38
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
19 changes: 8 additions & 11 deletions drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,18 +796,19 @@ static int brcmf_netdev_open(struct net_device *ndev)
{
struct brcmf_if *ifp = netdev_priv(ndev);
struct brcmf_pub *drvr = ifp->drvr;
struct brcmf_bus *bus_if = drvr->bus_if;
u32 toe_ol;
s32 ret = 0;

brcmf_dbg(TRACE, "ifidx %d\n", ifp->idx);

if (ifp->idx == 0) { /* do it only for primary eth0 */
/* try to bring up bus */
ret = brcmf_bus_start(drvr->dev);
if (ret != 0) {
brcmf_dbg(ERROR, "failed with code %d\n", ret);
return -1;
/* If bus is not ready, can't continue */
if (bus_if->state != BRCMF_BUS_DATA) {
brcmf_dbg(ERROR, "failed bus is not ready\n");
return -EAGAIN;
}

atomic_set(&drvr->pend_8021x_cnt, 0);

memcpy(ndev->dev_addr, drvr->mac, ETH_ALEN);
Expand Down Expand Up @@ -979,12 +980,6 @@ int brcmf_bus_start(struct device *dev)
return ret;
}

/* If bus is not ready, can't come up */
if (bus_if->state != BRCMF_BUS_DATA) {
brcmf_dbg(ERROR, "failed bus is not ready\n");
return -ENODEV;
}

brcmf_c_mkiovar("event_msgs", drvr->eventmask, BRCMF_EVENTING_MASK_LEN,
iovbuf, sizeof(iovbuf));
brcmf_proto_cdc_query_dcmd(drvr, 0, BRCMF_C_GET_VAR, iovbuf,
Expand Down Expand Up @@ -1021,6 +1016,8 @@ int brcmf_bus_start(struct device *dev)
if (ret < 0)
return ret;

/* signal bus ready */
bus_if->state = BRCMF_BUS_DATA;
return 0;
}

Expand Down
3 changes: 0 additions & 3 deletions drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -3464,9 +3464,6 @@ static int brcmf_sdbrcm_bus_init(struct device *dev)

brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
SBSDIO_WATERMARK, 8, &err);

/* Set bus state according to enable result */
bus_if->state = BRCMF_BUS_DATA;
} else {
/* Disable F2 again */
enable = SDIO_FUNC_ENABLE_1;
Expand Down

0 comments on commit 1bb1f38

Please sign in to comment.