aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
diff options
context:
space:
mode:
authorArend van Spriel <arend@broadcom.com>2011-10-18 08:03:09 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-11-08 15:54:09 -0500
commit20e5ca16397648811a9e1ad531360c843e005a57 (patch)
tree45b2f3ed8e7ab1159a220a469057c766025e296a /drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
parent1433c59bcc404cd4bd54333d23ce06242d8e32b7 (diff)
brcm80211: util: move brcmu_pktfrombuf() function to brcmfmac
The function brcmu_pktfrombuf was only used in the brcmfmac source and has been moved there. It has been refactored to match its use. Reported-by: Johannes Berg <johannes@sipsolutions.net> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c')
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
index 313b8bf592d1..5ca7ae203089 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
@@ -1222,6 +1222,28 @@ static void brcmf_sdbrcm_rxfail(struct brcmf_bus *bus, bool abort, bool rtx)
1222 bus->drvr->busstate = BRCMF_BUS_DOWN; 1222 bus->drvr->busstate = BRCMF_BUS_DOWN;
1223} 1223}
1224 1224
1225/* copy a buffer into a pkt buffer chain */
1226static uint brcmf_sdbrcm_glom_from_buf(struct brcmf_bus *bus, uint len)
1227{
1228 uint n, ret = 0;
1229 struct sk_buff *p;
1230 u8 *buf;
1231
1232 p = bus->glom;
1233 buf = bus->dataptr;
1234
1235 /* copy the data */
1236 for (; p && len; p = p->next) {
1237 n = min_t(uint, p->len, len);
1238 memcpy(p->data, buf, n);
1239 buf += n;
1240 len -= n;
1241 ret += n;
1242 }
1243
1244 return ret;
1245}
1246
1225static u8 brcmf_sdbrcm_rxglom(struct brcmf_bus *bus, u8 rxseq) 1247static u8 brcmf_sdbrcm_rxglom(struct brcmf_bus *bus, u8 rxseq)
1226{ 1248{
1227 u16 dlen, totlen; 1249 u16 dlen, totlen;
@@ -1354,8 +1376,7 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_bus *bus, u8 rxseq)
1354 SDIO_FUNC_2, 1376 SDIO_FUNC_2,
1355 F2SYNC, bus->dataptr, dlen, 1377 F2SYNC, bus->dataptr, dlen,
1356 NULL); 1378 NULL);
1357 sublen = (u16) brcmu_pktfrombuf(pfirst, 0, dlen, 1379 sublen = (u16) brcmf_sdbrcm_glom_from_buf(bus, dlen);
1358 bus->dataptr);
1359 if (sublen != dlen) { 1380 if (sublen != dlen) {
1360 brcmf_dbg(ERROR, "FAILED TO COPY, dlen %d sublen %d\n", 1381 brcmf_dbg(ERROR, "FAILED TO COPY, dlen %d sublen %d\n",
1361 dlen, sublen); 1382 dlen, sublen);