Commit a7cdd821 authored by Arend van Spriel's avatar Arend van Spriel Committed by John W. Linville

brcmfmac: reduce function parameters in sdio send/receive calls

The SDIO send and receive functions in bcmsdh.c are always called
with the same parameters. For the driver there is no use-case
to call them otherwise so remove those parameters from function
prototypes.
Reviewed-by: default avatarFranky Lin <frankyl@broadcom.com>
Reviewed-by: default avatarHante Meuleman <meuleman@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent a39be27b
...@@ -679,9 +679,7 @@ static int brcmf_sdiod_sglist_rw(struct brcmf_sdio_dev *sdiodev, uint fn, ...@@ -679,9 +679,7 @@ static int brcmf_sdiod_sglist_rw(struct brcmf_sdio_dev *sdiodev, uint fn,
return ret; return ret;
} }
int int brcmf_sdiod_recv_buf(struct brcmf_sdio_dev *sdiodev, u8 *buf, uint nbytes)
brcmf_sdiod_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
uint flags, u8 *buf, uint nbytes)
{ {
struct sk_buff *mypkt; struct sk_buff *mypkt;
int err; int err;
...@@ -693,7 +691,7 @@ brcmf_sdiod_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, ...@@ -693,7 +691,7 @@ brcmf_sdiod_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
return -EIO; return -EIO;
} }
err = brcmf_sdiod_recv_pkt(sdiodev, addr, fn, flags, mypkt); err = brcmf_sdiod_recv_pkt(sdiodev, mypkt);
if (!err) if (!err)
memcpy(buf, mypkt->data, nbytes); memcpy(buf, mypkt->data, nbytes);
...@@ -701,50 +699,47 @@ brcmf_sdiod_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, ...@@ -701,50 +699,47 @@ brcmf_sdiod_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
return err; return err;
} }
int int brcmf_sdiod_recv_pkt(struct brcmf_sdio_dev *sdiodev, struct sk_buff *pkt)
brcmf_sdiod_recv_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
uint flags, struct sk_buff *pkt)
{ {
uint width; u32 addr = sdiodev->sbwad;
int err = 0; int err = 0;
brcmf_dbg(SDIO, "fun = %d, addr = 0x%x, size = %d\n", brcmf_dbg(SDIO, "addr = 0x%x, size = %d\n", addr, pkt->len);
fn, addr, pkt->len);
width = (flags & SDIO_REQ_4BYTE) ? 4 : 2; err = brcmf_sdiod_addrprep(sdiodev, 4, &addr);
err = brcmf_sdiod_addrprep(sdiodev, width, &addr);
if (err) if (err)
goto done; goto done;
err = brcmf_sdiod_buffrw(sdiodev, fn, false, addr, pkt); err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_2, false, addr, pkt);
done: done:
return err; return err;
} }
int brcmf_sdiod_recv_chain(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, int brcmf_sdiod_recv_chain(struct brcmf_sdio_dev *sdiodev,
uint flags, struct sk_buff_head *pktq, uint totlen) struct sk_buff_head *pktq, uint totlen)
{ {
struct sk_buff *glom_skb; struct sk_buff *glom_skb;
struct sk_buff *skb; struct sk_buff *skb;
uint width; u32 addr = sdiodev->sbwad;
int err = 0; int err = 0;
brcmf_dbg(SDIO, "fun = %d, addr = 0x%x, size = %d\n", brcmf_dbg(SDIO, "addr = 0x%x, size = %d\n",
fn, addr, pktq->qlen); addr, pktq->qlen);
width = (flags & SDIO_REQ_4BYTE) ? 4 : 2; err = brcmf_sdiod_addrprep(sdiodev, 4, &addr);
err = brcmf_sdiod_addrprep(sdiodev, width, &addr);
if (err) if (err)
goto done; goto done;
if (pktq->qlen == 1) if (pktq->qlen == 1)
err = brcmf_sdiod_buffrw(sdiodev, fn, false, addr, pktq->next); err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_2, false, addr,
pktq->next);
else if (!sdiodev->sg_support) { else if (!sdiodev->sg_support) {
glom_skb = brcmu_pkt_buf_get_skb(totlen); glom_skb = brcmu_pkt_buf_get_skb(totlen);
if (!glom_skb) if (!glom_skb)
return -ENOMEM; return -ENOMEM;
err = brcmf_sdiod_buffrw(sdiodev, fn, false, addr, glom_skb); err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_2, false, addr,
glom_skb);
if (err) if (err)
goto done; goto done;
...@@ -753,18 +748,17 @@ int brcmf_sdiod_recv_chain(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, ...@@ -753,18 +748,17 @@ int brcmf_sdiod_recv_chain(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
skb_pull(glom_skb, skb->len); skb_pull(glom_skb, skb->len);
} }
} else } else
err = brcmf_sdiod_sglist_rw(sdiodev, fn, false, addr, pktq); err = brcmf_sdiod_sglist_rw(sdiodev, SDIO_FUNC_2, false, addr,
pktq);
done: done:
return err; return err;
} }
int int brcmf_sdiod_send_buf(struct brcmf_sdio_dev *sdiodev, u8 *buf, uint nbytes)
brcmf_sdiod_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
uint flags, u8 *buf, uint nbytes)
{ {
struct sk_buff *mypkt; struct sk_buff *mypkt;
uint width; u32 addr = sdiodev->sbwad;
int err; int err;
mypkt = brcmu_pkt_buf_get_skb(nbytes); mypkt = brcmu_pkt_buf_get_skb(nbytes);
...@@ -776,41 +770,40 @@ brcmf_sdiod_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, ...@@ -776,41 +770,40 @@ brcmf_sdiod_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
memcpy(mypkt->data, buf, nbytes); memcpy(mypkt->data, buf, nbytes);
width = (flags & SDIO_REQ_4BYTE) ? 4 : 2; err = brcmf_sdiod_addrprep(sdiodev, 4, &addr);
err = brcmf_sdiod_addrprep(sdiodev, width, &addr);
if (!err) if (!err)
err = brcmf_sdiod_buffrw(sdiodev, fn, true, addr, mypkt); err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_2, true, addr,
mypkt);
brcmu_pkt_buf_free_skb(mypkt); brcmu_pkt_buf_free_skb(mypkt);
return err; return err;
} }
int int brcmf_sdiod_send_pkt(struct brcmf_sdio_dev *sdiodev,
brcmf_sdiod_send_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, struct sk_buff_head *pktq)
uint flags, struct sk_buff_head *pktq)
{ {
struct sk_buff *skb; struct sk_buff *skb;
uint width; u32 addr = sdiodev->sbwad;
int err; int err;
brcmf_dbg(SDIO, "fun = %d, addr = 0x%x, size = %d\n", brcmf_dbg(SDIO, "addr = 0x%x, size = %d\n", addr, pktq->qlen);
fn, addr, pktq->qlen);
width = (flags & SDIO_REQ_4BYTE) ? 4 : 2; err = brcmf_sdiod_addrprep(sdiodev, 4, &addr);
err = brcmf_sdiod_addrprep(sdiodev, width, &addr);
if (err) if (err)
return err; return err;
if (pktq->qlen == 1 || !sdiodev->sg_support) if (pktq->qlen == 1 || !sdiodev->sg_support)
skb_queue_walk(pktq, skb) { skb_queue_walk(pktq, skb) {
err = brcmf_sdiod_buffrw(sdiodev, fn, true, addr, skb); err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_2, true,
addr, skb);
if (err) if (err)
break; break;
} }
else else
err = brcmf_sdiod_sglist_rw(sdiodev, fn, true, addr, pktq); err = brcmf_sdiod_sglist_rw(sdiodev, SDIO_FUNC_2, true, addr,
pktq);
return err; return err;
} }
......
...@@ -1419,8 +1419,6 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) ...@@ -1419,8 +1419,6 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
*/ */
sdio_claim_host(bus->sdiodev->func[1]); sdio_claim_host(bus->sdiodev->func[1]);
errcode = brcmf_sdiod_recv_chain(bus->sdiodev, errcode = brcmf_sdiod_recv_chain(bus->sdiodev,
bus->sdiodev->sbwad,
SDIO_FUNC_2, F2SYNC,
&bus->glom, dlen); &bus->glom, dlen);
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
bus->sdcnt.f2rxdata++; bus->sdcnt.f2rxdata++;
...@@ -1615,8 +1613,7 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff) ...@@ -1615,8 +1613,7 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff)
} }
/* Read remain of frame body */ /* Read remain of frame body */
sdret = brcmf_sdiod_recv_buf(bus->sdiodev, bus->sdiodev->sbwad, sdret = brcmf_sdiod_recv_buf(bus->sdiodev, rbuf, rdlen);
SDIO_FUNC_2, F2SYNC, rbuf, rdlen);
bus->sdcnt.f2rxdata++; bus->sdcnt.f2rxdata++;
/* Control frame failures need retransmission */ /* Control frame failures need retransmission */
...@@ -1702,8 +1699,6 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) ...@@ -1702,8 +1699,6 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
sdio_claim_host(bus->sdiodev->func[1]); sdio_claim_host(bus->sdiodev->func[1]);
if (!rd->len) { if (!rd->len) {
ret = brcmf_sdiod_recv_buf(bus->sdiodev, ret = brcmf_sdiod_recv_buf(bus->sdiodev,
bus->sdiodev->sbwad,
SDIO_FUNC_2, F2SYNC,
bus->rxhdr, BRCMF_FIRSTREAD); bus->rxhdr, BRCMF_FIRSTREAD);
bus->sdcnt.f2rxhdrs++; bus->sdcnt.f2rxhdrs++;
if (ret < 0) { if (ret < 0) {
...@@ -1760,8 +1755,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) ...@@ -1760,8 +1755,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
skb_pull(pkt, head_read); skb_pull(pkt, head_read);
pkt_align(pkt, rd->len_left, bus->head_align); pkt_align(pkt, rd->len_left, bus->head_align);
ret = brcmf_sdiod_recv_pkt(bus->sdiodev, bus->sdiodev->sbwad, ret = brcmf_sdiod_recv_pkt(bus->sdiodev, pkt);
SDIO_FUNC_2, F2SYNC, pkt);
bus->sdcnt.f2rxdata++; bus->sdcnt.f2rxdata++;
sdio_release_host(bus->sdiodev->func[1]); sdio_release_host(bus->sdiodev->func[1]);
...@@ -2116,8 +2110,7 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_sdio *bus, struct sk_buff_head *pktq, ...@@ -2116,8 +2110,7 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_sdio *bus, struct sk_buff_head *pktq,
goto done; goto done;
sdio_claim_host(bus->sdiodev->func[1]); sdio_claim_host(bus->sdiodev->func[1]);
ret = brcmf_sdiod_send_pkt(bus->sdiodev, bus->sdiodev->sbwad, ret = brcmf_sdiod_send_pkt(bus->sdiodev, pktq);
SDIO_FUNC_2, F2SYNC, pktq);
bus->sdcnt.f2txdata++; bus->sdcnt.f2txdata++;
if (ret < 0) { if (ret < 0) {
...@@ -2481,9 +2474,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) ...@@ -2481,9 +2474,7 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
int i; int i;
sdio_claim_host(bus->sdiodev->func[1]); sdio_claim_host(bus->sdiodev->func[1]);
err = brcmf_sdiod_send_buf(bus->sdiodev, bus->sdiodev->sbwad, err = brcmf_sdiod_send_buf(bus->sdiodev, bus->ctrl_frame_buf,
SDIO_FUNC_2, F2SYNC,
bus->ctrl_frame_buf,
(u32)bus->ctrl_frame_len); (u32)bus->ctrl_frame_len);
if (err < 0) { if (err < 0) {
...@@ -2700,8 +2691,7 @@ static int brcmf_tx_frame(struct brcmf_sdio *bus, u8 *frame, u16 len) ...@@ -2700,8 +2691,7 @@ static int brcmf_tx_frame(struct brcmf_sdio *bus, u8 *frame, u16 len)
int ret; int ret;
bus->ctrl_frame_stat = false; bus->ctrl_frame_stat = false;
ret = brcmf_sdiod_send_buf(bus->sdiodev, bus->sdiodev->sbwad, ret = brcmf_sdiod_send_buf(bus->sdiodev, frame, len);
SDIO_FUNC_2, F2SYNC, frame, len);
if (ret < 0) { if (ret < 0) {
/* On failure, abort the command and terminate the frame */ /* On failure, abort the command and terminate the frame */
......
...@@ -197,7 +197,6 @@ void brcmf_sdiod_regwl(struct brcmf_sdio_dev *sdiodev, u32 addr, u32 data, ...@@ -197,7 +197,6 @@ void brcmf_sdiod_regwl(struct brcmf_sdio_dev *sdiodev, u32 addr, u32 data,
/* Buffer transfer to/from device (client) core via cmd53. /* Buffer transfer to/from device (client) core via cmd53.
* fn: function number * fn: function number
* addr: backplane address (i.e. >= regsva from attach)
* flags: backplane width, address increment, sync/async * flags: backplane width, address increment, sync/async
* buf: pointer to memory data buffer * buf: pointer to memory data buffer
* nbytes: number of bytes to transfer to/from buf * nbytes: number of bytes to transfer to/from buf
...@@ -207,17 +206,14 @@ void brcmf_sdiod_regwl(struct brcmf_sdio_dev *sdiodev, u32 addr, u32 data, ...@@ -207,17 +206,14 @@ void brcmf_sdiod_regwl(struct brcmf_sdio_dev *sdiodev, u32 addr, u32 data,
* Returns 0 or error code. * Returns 0 or error code.
* NOTE: Async operation is not currently supported. * NOTE: Async operation is not currently supported.
*/ */
int brcmf_sdiod_send_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, int brcmf_sdiod_send_pkt(struct brcmf_sdio_dev *sdiodev,
uint flags, struct sk_buff_head *pktq); struct sk_buff_head *pktq);
int brcmf_sdiod_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, int brcmf_sdiod_send_buf(struct brcmf_sdio_dev *sdiodev, u8 *buf, uint nbytes);
uint flags, u8 *buf, uint nbytes);
int brcmf_sdiod_recv_pkt(struct brcmf_sdio_dev *sdiodev, struct sk_buff *pkt);
int brcmf_sdiod_recv_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, int brcmf_sdiod_recv_buf(struct brcmf_sdio_dev *sdiodev, u8 *buf, uint nbytes);
uint flags, struct sk_buff *pkt); int brcmf_sdiod_recv_chain(struct brcmf_sdio_dev *sdiodev,
int brcmf_sdiod_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, struct sk_buff_head *pktq, uint totlen);
uint flags, u8 *buf, uint nbytes);
int brcmf_sdiod_recv_chain(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
uint flags, struct sk_buff_head *pktq, uint totlen);
/* Flags bits */ /* Flags bits */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment