]> git.karo-electronics.de Git - linux-beck.git/commitdiff
brcmfmac: simplify sdio code download routine.
authorHante Meuleman <meuleman@broadcom.com>
Wed, 29 Jan 2014 14:32:17 +0000 (15:32 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 12 Feb 2014 20:31:50 +0000 (15:31 -0500)
brcmf_sdio_download_code_file is using a loop to send small blobs
of data. This is unnecessarily complex and was simplified with this
patch.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c

index d78fffb43964a0429b91a09ffa69d60550348a51..be2ec8a55e766faeac8711017441a927b805de35 100644 (file)
@@ -3291,32 +3291,17 @@ static int brcmf_sdio_download_code_file(struct brcmf_sdio *bus,
                                         const struct firmware *fw)
 {
        int err;
-       int offset;
-       int address;
-       int len;
 
        brcmf_dbg(TRACE, "Enter\n");
 
-       err = 0;
-       offset = 0;
-       address = bus->ci->rambase;
-       while (offset < fw->size) {
-               len = ((offset + MEMBLOCK) < fw->size) ? MEMBLOCK :
-                     fw->size - offset;
-               err = brcmf_sdiod_ramrw(bus->sdiodev, true, address,
-                                       (u8 *)&fw->data[offset], len);
-               if (err) {
-                       brcmf_err("error %d on writing %d membytes at 0x%08x\n",
-                                 err, len, address);
-                       return err;
-               }
-               offset += len;
-               address += len;
-       }
-       if (!err)
-               if (!brcmf_sdio_verifymemory(bus->sdiodev, bus->ci->rambase,
-                                            (u8 *)fw->data, fw->size))
-                       err = -EIO;
+       err = brcmf_sdiod_ramrw(bus->sdiodev, true, bus->ci->rambase,
+                               (u8 *)fw->data, fw->size);
+       if (err)
+               brcmf_err("error %d on writing %d membytes at 0x%08x\n",
+                         err, (int)fw->size, bus->ci->rambase);
+       else if (!brcmf_sdio_verifymemory(bus->sdiodev, bus->ci->rambase,
+                                         (u8 *)fw->data, fw->size))
+               err = -EIO;
 
        return err;
 }