diff options
author | Arend Van Spriel <arend.vanspriel@broadcom.com> | 2018-03-22 21:28:27 +0100 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2018-03-27 12:04:31 +0300 |
commit | 2baa3aaee27f137b8db9a9224d0fe9b281d28e34 (patch) | |
tree | bb0013d09fb3d92ae88935bc7f4a6c7cfb8f4496 /drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | |
parent | d09ae51a4b676151edaf572bcd5f272b5532639f (diff) | |
download | lwn-2baa3aaee27f137b8db9a9224d0fe9b281d28e34.tar.gz lwn-2baa3aaee27f137b8db9a9224d0fe9b281d28e34.zip |
brcmfmac: introduce brcmf_fw_alloc_request() function
The function brcmf_fw_alloc_request() takes a list of required files
and allocated the struct brcmf_fw_request instance accordingly. The
request can be modified by the caller before being passed to the
brcmf_fw_request_firmwares() function.
Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c')
-rw-r--r-- | drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c index ab68eb1f04e4..24dbf7ea2301 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -4155,6 +4155,28 @@ fail: device_release_driver(dev); } +static struct brcmf_fw_request * +brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus) +{ + struct brcmf_fw_request *fwreq; + struct brcmf_fw_name fwnames[] = { + { ".bin", bus->sdiodev->fw_name }, + { ".txt", bus->sdiodev->nvram_name }, + }; + + fwreq = brcmf_fw_alloc_request(bus->ci->chip, bus->ci->chiprev, + brcmf_sdio_fwnames, + ARRAY_SIZE(brcmf_sdio_fwnames), + fwnames, ARRAY_SIZE(fwnames)); + if (!fwreq) + return NULL; + + fwreq->items[BRCMF_SDIO_FW_CODE].type = BRCMF_FW_TYPE_BINARY; + fwreq->items[BRCMF_SDIO_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; + + return fwreq; +} + struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) { int ret; @@ -4243,26 +4265,12 @@ struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) brcmf_dbg(INFO, "completed!!\n"); - ret = brcmf_fw_map_chip_to_name(bus->ci->chip, bus->ci->chiprev, - brcmf_sdio_fwnames, - ARRAY_SIZE(brcmf_sdio_fwnames), - sdiodev->fw_name, sdiodev->nvram_name); - if (ret) - goto fail; - - fwreq = kzalloc(sizeof(fwreq) + 2 * sizeof(struct brcmf_fw_item), - GFP_KERNEL); + fwreq = brcmf_sdio_prepare_fw_request(bus); if (!fwreq) { ret = -ENOMEM; goto fail; } - fwreq->items[BRCMF_SDIO_FW_CODE].path = sdiodev->fw_name; - fwreq->items[BRCMF_SDIO_FW_CODE].type = BRCMF_FW_TYPE_BINARY; - fwreq->items[BRCMF_SDIO_FW_NVRAM].path = sdiodev->nvram_name; - fwreq->items[BRCMF_SDIO_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; - fwreq->n_items = 2; - ret = brcmf_fw_get_firmwares(sdiodev->dev, fwreq, brcmf_sdio_firmware_callback); if (ret != 0) { |