Skip to content

Commit

Permalink
staging: brcm80211: Remove abstractions for pci_(un)map_single
Browse files Browse the repository at this point in the history
The driver had abstracted DMA mapping functions. As abstraction
is not required for the linux driver, these have been removed
and replaced by native linux functions.

Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Brett Rudley authored and Greg Kroah-Hartman committed Mar 1, 2011
1 parent 2d586ea commit 9010c46
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 38 deletions.
10 changes: 0 additions & 10 deletions drivers/staging/brcm80211/include/osl.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,6 @@ extern void osl_dma_free_consistent(struct osl_info *osh, void *va,
#define DMA_TX 1 /* TX direction for DMA */
#define DMA_RX 2 /* RX direction for DMA */

/* map/unmap shared (dma-able) memory */
#define DMA_MAP(osh, va, size, direction, p, dmah) \
osl_dma_map((osh), (va), (size), (direction))
#define DMA_UNMAP(osh, pa, size, direction, p, dmah) \
osl_dma_unmap((osh), (pa), (size), (direction))
extern uint osl_dma_map(struct osl_info *osh, void *va, uint size,
int direction);
extern void osl_dma_unmap(struct osl_info *osh, uint pa, uint size,
int direction);

/* register access macros */
#if defined(BCMSDIO)
#ifdef BRCM_FULLMAC
Expand Down
15 changes: 7 additions & 8 deletions drivers/staging/brcm80211/util/hnddma.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ typedef struct dma_info {
uint *msg_level; /* message level pointer */
char name[MAXNAMEL]; /* callers name for diag msgs */

void *osh; /* os handle */
struct osl_info *osh; /* os handle */
si_t *sih; /* sb handle */

bool dma64; /* this dma engine is operating in 64-bit mode */
Expand Down Expand Up @@ -866,8 +866,8 @@ static bool BCMFASTPATH _dma_rxfill(dma_info_t *di)
memset(&di->rxp_dmah[rxout], 0,
sizeof(hnddma_seg_map_t));

pa = DMA_MAP(di->osh, p->data,
di->rxbufsize, DMA_RX, p, &di->rxp_dmah[rxout]);
pa = pci_map_single(di->osh->pdev, p->data,
di->rxbufsize, PCI_DMA_FROMDEVICE);

ASSERT(IS_ALIGNED(PHYSADDRLO(pa), 4));

Expand Down Expand Up @@ -1383,7 +1383,7 @@ static int dma64_txunframed(dma_info_t *di, void *buf, uint len, bool commit)
if (len == 0)
return 0;

pa = DMA_MAP(di->osh, buf, len, DMA_TX, NULL, &di->txp_dmah[txout]);
pa = pci_map_single(di->osh->pdev, buf, len, PCI_DMA_TODEVICE);

flags = (D64_CTRL1_SOF | D64_CTRL1_IOC | D64_CTRL1_EOF);

Expand Down Expand Up @@ -1463,8 +1463,7 @@ static int BCMFASTPATH dma64_txfast(dma_info_t *di, struct sk_buff *p0,
memset(&di->txp_dmah[txout], 0,
sizeof(hnddma_seg_map_t));

pa = DMA_MAP(di->osh, data, len, DMA_TX, p,
&di->txp_dmah[txout]);
pa = pci_map_single(di->osh->pdev, data, len, PCI_DMA_TODEVICE);

if (DMASGLIST_ENAB) {
map = &di->txp_dmah[txout];
Expand Down Expand Up @@ -1626,7 +1625,7 @@ static void *BCMFASTPATH dma64_getnexttxp(dma_info_t *di, txd_range_t range)
i = NEXTTXD(i);
}

DMA_UNMAP(di->osh, pa, size, DMA_TX, txp, map);
pci_unmap_single(di->osh->pdev, pa, size, PCI_DMA_TODEVICE);
}

di->txin = i;
Expand Down Expand Up @@ -1677,7 +1676,7 @@ static void *BCMFASTPATH dma64_getnextrxp(dma_info_t *di, bool forceall)
di->dataoffsethigh));

/* clear this packet from the descriptor ring */
DMA_UNMAP(di->osh, pa, di->rxbufsize, DMA_RX, rxp, &di->rxp_dmah[i]);
pci_unmap_single(di->osh->pdev, pa, di->rxbufsize, PCI_DMA_FROMDEVICE);

W_SM(&di->rxd64[i].addrlow, 0xdeadbeef);
W_SM(&di->rxd64[i].addrhigh, 0xdeadbeef);
Expand Down
20 changes: 0 additions & 20 deletions drivers/staging/brcm80211/util/linux_osl.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,26 +161,6 @@ void osl_dma_free_consistent(struct osl_info *osh, void *va, uint size,
pci_free_consistent(osh->pdev, size, va, (dma_addr_t) pa);
}

uint BCMFASTPATH osl_dma_map(struct osl_info *osh, void *va, uint size,
int direction)
{
int dir;

ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
dir = (direction == DMA_TX) ? PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE;
return pci_map_single(osh->pdev, va, size, dir);
}

void BCMFASTPATH osl_dma_unmap(struct osl_info *osh, uint pa, uint size,
int direction)
{
int dir;

ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
dir = (direction == DMA_TX) ? PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE;
pci_unmap_single(osh->pdev, (u32) pa, size, dir);
}

#if defined(BCMDBG_ASSERT)
void osl_assert(char *exp, char *file, int line)
{
Expand Down

0 comments on commit 9010c46

Please sign in to comment.