Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4b5adc73 authored by Arend Van Spriel's avatar Arend Van Spriel Committed by Kalle Valo
Browse files

brcmfmac: move allocation of control rx buffer to brcmf_sdio_bus_preinit()



Allocate the control rx buffer needed for firmware control interface
during brcmf_sdio_bus_preinit(). This relies on common layer setting
struct brcmf_bus::maxctl during brcmf_attach(). By moving the allocation
we can move brcmf_attach() in subsequent change.

Reviewed-by: default avatarHante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: default avatarFranky Lin <franky.lin@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent da472385
Loading
Loading
Loading
Loading
+12 −14
Original line number Diff line number Diff line
@@ -1707,7 +1707,6 @@ brcmf_sdio_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff)
	int sdret;

	brcmf_dbg(TRACE, "Enter\n");

	if (bus->rxblen)
		buf = vzalloc(bus->rxblen);
	if (!buf)
@@ -3411,6 +3410,18 @@ static int brcmf_sdio_bus_preinit(struct device *dev)
	u32 value;
	int err;

	/* maxctl provided by common layer */
	if (WARN_ON(!bus_if->maxctl))
		return -EINVAL;

	/* Allocate control receive buffer */
	bus_if->maxctl += bus->roundup;
	value = roundup((bus_if->maxctl + SDPCM_HDRLEN), ALIGNMENT);
	value += bus->head_align;
	bus->rxbuf = kmalloc(value, GFP_ATOMIC);
	if (bus->rxbuf)
		bus->rxblen = value;

	/* the commands below use the terms tx and rx from
	 * a device perspective, ie. bus:txglom affects the
	 * bus transfers from device to host.
@@ -4208,19 +4219,6 @@ struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
	bus->blocksize = bus->sdiodev->func2->cur_blksize;
	bus->roundup = min(max_roundup, bus->blocksize);

	/* Allocate buffers */
	if (bus->sdiodev->bus_if->maxctl) {
		bus->sdiodev->bus_if->maxctl += bus->roundup;
		bus->rxblen =
		    roundup((bus->sdiodev->bus_if->maxctl + SDPCM_HDRLEN),
			    ALIGNMENT) + bus->head_align;
		bus->rxbuf = kmalloc(bus->rxblen, GFP_ATOMIC);
		if (!(bus->rxbuf)) {
			brcmf_err("rxbuf allocation failed\n");
			goto fail;
		}
	}

	sdio_claim_host(bus->sdiodev->func1);

	/* Disable F2 to clear any intermediate frame state on the dongle */