Skip to content

Commit 1bb1f38

Browse files
Arend van Spriellinvjw
authored andcommitted
brcm80211: fmac: update bus state in common driver part
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 <[email protected]> Reviewed-by: Franky (Zhenhui) Lin <[email protected]> Signed-off-by: Arend van Spriel <[email protected]> Signed-off-by: John W. Linville <[email protected]>
1 parent c0e89f0 commit 1bb1f38

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -796,18 +796,19 @@ static int brcmf_netdev_open(struct net_device *ndev)
796796
{
797797
struct brcmf_if *ifp = netdev_priv(ndev);
798798
struct brcmf_pub *drvr = ifp->drvr;
799+
struct brcmf_bus *bus_if = drvr->bus_if;
799800
u32 toe_ol;
800801
s32 ret = 0;
801802

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

804805
if (ifp->idx == 0) { /* do it only for primary eth0 */
805-
/* try to bring up bus */
806-
ret = brcmf_bus_start(drvr->dev);
807-
if (ret != 0) {
808-
brcmf_dbg(ERROR, "failed with code %d\n", ret);
809-
return -1;
806+
/* If bus is not ready, can't continue */
807+
if (bus_if->state != BRCMF_BUS_DATA) {
808+
brcmf_dbg(ERROR, "failed bus is not ready\n");
809+
return -EAGAIN;
810810
}
811+
811812
atomic_set(&drvr->pend_8021x_cnt, 0);
812813

813814
memcpy(ndev->dev_addr, drvr->mac, ETH_ALEN);
@@ -979,12 +980,6 @@ int brcmf_bus_start(struct device *dev)
979980
return ret;
980981
}
981982

982-
/* If bus is not ready, can't come up */
983-
if (bus_if->state != BRCMF_BUS_DATA) {
984-
brcmf_dbg(ERROR, "failed bus is not ready\n");
985-
return -ENODEV;
986-
}
987-
988983
brcmf_c_mkiovar("event_msgs", drvr->eventmask, BRCMF_EVENTING_MASK_LEN,
989984
iovbuf, sizeof(iovbuf));
990985
brcmf_proto_cdc_query_dcmd(drvr, 0, BRCMF_C_GET_VAR, iovbuf,
@@ -1021,6 +1016,8 @@ int brcmf_bus_start(struct device *dev)
10211016
if (ret < 0)
10221017
return ret;
10231018

1019+
/* signal bus ready */
1020+
bus_if->state = BRCMF_BUS_DATA;
10241021
return 0;
10251022
}
10261023

drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3464,9 +3464,6 @@ static int brcmf_sdbrcm_bus_init(struct device *dev)
34643464

34653465
brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
34663466
SBSDIO_WATERMARK, 8, &err);
3467-
3468-
/* Set bus state according to enable result */
3469-
bus_if->state = BRCMF_BUS_DATA;
34703467
} else {
34713468
/* Disable F2 again */
34723469
enable = SDIO_FUNC_ENABLE_1;

0 commit comments

Comments
 (0)