Commit 1bb1f384 authored by Arend van Spriel's avatar Arend van Spriel Committed by John W. Linville
Browse files

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: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: default avatarFranky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent c0e89f08
Loading
Loading
Loading
Loading
+8 −11
Original line number Diff line number Diff line
@@ -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);
@@ -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,
@@ -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;
}

+0 −3
Original line number Diff line number Diff line
@@ -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;