Commit c9be7049 authored by Arend van Spriel's avatar Arend van Spriel Committed by Greg Kroah-Hartman

staging: brcm80211: replace BUS_SWAP32 macro with cpu_to_le32()

The macro BUS_SWAP32(a) expanded to (a) which was fine for a little
endian system. For big endian platform this should do as the name
implies. As the driver is intended for PCI which is little-endian
the macro cpu_to_le32() can be used instead.
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: default avatarHenry Ptasinski <henryp@broadcom.com>
Reviewed-by: default avatarRoland Vossen <rvossen@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 303a1e5c
...@@ -580,10 +580,10 @@ dma64_dd_upd(struct dma_info *di, struct dma64desc *ddring, ...@@ -580,10 +580,10 @@ dma64_dd_upd(struct dma_info *di, struct dma64desc *ddring,
#else #else
if ((di->dataoffsetlow == 0) || !(pa & PCI32ADDR_HIGH)) { if ((di->dataoffsetlow == 0) || !(pa & PCI32ADDR_HIGH)) {
#endif /* defined(__mips__) && defined(IL_BIGENDIAN) */ #endif /* defined(__mips__) && defined(IL_BIGENDIAN) */
ddring[outidx].addrlow = BUS_SWAP32(pa + di->dataoffsetlow); ddring[outidx].addrlow = cpu_to_le32(pa + di->dataoffsetlow);
ddring[outidx].addrhigh = BUS_SWAP32(di->dataoffsethigh); ddring[outidx].addrhigh = cpu_to_le32(di->dataoffsethigh);
ddring[outidx].ctrl1 = BUS_SWAP32(*flags); ddring[outidx].ctrl1 = cpu_to_le32(*flags);
ddring[outidx].ctrl2 = BUS_SWAP32(ctrl2); ddring[outidx].ctrl2 = cpu_to_le32(ctrl2);
} else { } else {
/* address extension for 32-bit PCI */ /* address extension for 32-bit PCI */
u32 ae; u32 ae;
...@@ -592,15 +592,15 @@ dma64_dd_upd(struct dma_info *di, struct dma64desc *ddring, ...@@ -592,15 +592,15 @@ dma64_dd_upd(struct dma_info *di, struct dma64desc *ddring,
pa &= ~PCI32ADDR_HIGH; pa &= ~PCI32ADDR_HIGH;
ctrl2 |= (ae << D64_CTRL2_AE_SHIFT) & D64_CTRL2_AE; ctrl2 |= (ae << D64_CTRL2_AE_SHIFT) & D64_CTRL2_AE;
ddring[outidx].addrlow = BUS_SWAP32(pa + di->dataoffsetlow); ddring[outidx].addrlow = cpu_to_le32(pa + di->dataoffsetlow);
ddring[outidx].addrhigh = BUS_SWAP32(di->dataoffsethigh); ddring[outidx].addrhigh = cpu_to_le32(di->dataoffsethigh);
ddring[outidx].ctrl1 = BUS_SWAP32(*flags); ddring[outidx].ctrl1 = cpu_to_le32(*flags);
ddring[outidx].ctrl2 = BUS_SWAP32(ctrl2); ddring[outidx].ctrl2 = cpu_to_le32(ctrl2);
} }
if (di->dma.dmactrlflags & DMA_CTRL_PEN) { if (di->dma.dmactrlflags & DMA_CTRL_PEN) {
if (DMA64_DD_PARITY(&ddring[outidx])) if (DMA64_DD_PARITY(&ddring[outidx]))
ddring[outidx].ctrl2 = ddring[outidx].ctrl2 =
BUS_SWAP32(ctrl2 | D64_CTRL2_PARITY); cpu_to_le32(ctrl2 | D64_CTRL2_PARITY);
} }
} }
...@@ -1339,7 +1339,7 @@ int dma_txfast(struct dma_pub *pub, struct sk_buff *p0, bool commit) ...@@ -1339,7 +1339,7 @@ int dma_txfast(struct dma_pub *pub, struct sk_buff *p0, bool commit)
/* if last txd eof not set, fix it */ /* if last txd eof not set, fix it */
if (!(flags & D64_CTRL1_EOF)) if (!(flags & D64_CTRL1_EOF))
di->txd64[PREVTXD(txout)].ctrl1 = di->txd64[PREVTXD(txout)].ctrl1 =
BUS_SWAP32(flags | D64_CTRL1_IOC | D64_CTRL1_EOF); cpu_to_le32(flags | D64_CTRL1_IOC | D64_CTRL1_EOF);
/* save the packet */ /* save the packet */
di->txp[PREVTXD(txout)] = p0; di->txp[PREVTXD(txout)] = p0;
...@@ -1424,7 +1424,7 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range) ...@@ -1424,7 +1424,7 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range)
struct dma_seg_map *map = NULL; struct dma_seg_map *map = NULL;
uint size, j, nsegs; uint size, j, nsegs;
pa = BUS_SWAP32(di->txd64[i].addrlow) - di->dataoffsetlow; pa = cpu_to_le32(di->txd64[i].addrlow) - di->dataoffsetlow;
if (DMASGLIST_ENAB) { if (DMASGLIST_ENAB) {
map = &di->txp_dmah[i]; map = &di->txp_dmah[i];
...@@ -1432,7 +1432,7 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range) ...@@ -1432,7 +1432,7 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range)
nsegs = map->nsegs; nsegs = map->nsegs;
} else { } else {
size = size =
(BUS_SWAP32(di->txd64[i].ctrl2) & (cpu_to_le32(di->txd64[i].ctrl2) &
D64_CTRL2_BC_MASK); D64_CTRL2_BC_MASK);
nsegs = 1; nsegs = 1;
} }
...@@ -1487,7 +1487,7 @@ static struct sk_buff *dma64_getnextrxp(struct dma_info *di, bool forceall) ...@@ -1487,7 +1487,7 @@ static struct sk_buff *dma64_getnextrxp(struct dma_info *di, bool forceall)
rxp = di->rxp[i]; rxp = di->rxp[i];
di->rxp[i] = NULL; di->rxp[i] = NULL;
pa = BUS_SWAP32(di->rxd64[i].addrlow) - di->dataoffsetlow; pa = cpu_to_le32(di->rxd64[i].addrlow) - di->dataoffsetlow;
/* clear this packet from the descriptor ring */ /* clear this packet from the descriptor ring */
pci_unmap_single(di->pbus, pa, di->rxbufsize, PCI_DMA_FROMDEVICE); pci_unmap_single(di->pbus, pa, di->rxbufsize, PCI_DMA_FROMDEVICE);
......
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