X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fnet%2Firda%2Fnsc-ircc.c;h=c1e79f5168c9a4c21bf6b0f1458e21c6bd5bad5c;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=2248e661fb565b16d2baf1fe823efd72863391a5;hpb=db216c3d5e4c040e557a50f8f5d35d5c415e8c1c;p=linux-2.6.git diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c index 2248e661f..c1e79f516 100644 --- a/drivers/net/irda/nsc-ircc.c +++ b/drivers/net/irda/nsc-ircc.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -307,8 +308,9 @@ static int __init nsc_ircc_open(int i, chipio_t *info) self->tx_buff.truesize = 14384; /* Allocate memory if needed */ - self->rx_buff.head = (__u8 *) kmalloc(self->rx_buff.truesize, - GFP_KERNEL|GFP_DMA); + self->rx_buff.head = + dma_alloc_coherent(NULL, self->rx_buff.truesize, + &self->rx_buff_dma, GFP_KERNEL); if (self->rx_buff.head == NULL) { err = -ENOMEM; goto out2; @@ -316,8 +318,9 @@ static int __init nsc_ircc_open(int i, chipio_t *info) } memset(self->rx_buff.head, 0, self->rx_buff.truesize); - self->tx_buff.head = (__u8 *) kmalloc(self->tx_buff.truesize, - GFP_KERNEL|GFP_DMA); + self->tx_buff.head = + dma_alloc_coherent(NULL, self->tx_buff.truesize, + &self->tx_buff_dma, GFP_KERNEL); if (self->tx_buff.head == NULL) { err = -ENOMEM; goto out3; @@ -368,9 +371,11 @@ static int __init nsc_ircc_open(int i, chipio_t *info) return 0; out4: - kfree(self->tx_buff.head); + dma_free_coherent(NULL, self->tx_buff.truesize, + self->tx_buff.head, self->tx_buff_dma); out3: - kfree(self->rx_buff.head); + dma_free_coherent(NULL, self->rx_buff.truesize, + self->rx_buff.head, self->rx_buff_dma); out2: release_region(self->io.fir_base, self->io.fir_ext); out1: @@ -404,10 +409,12 @@ static int __exit nsc_ircc_close(struct nsc_ircc_cb *self) release_region(self->io.fir_base, self->io.fir_ext); if (self->tx_buff.head) - kfree(self->tx_buff.head); + dma_free_coherent(NULL, self->tx_buff.truesize, + self->tx_buff.head, self->tx_buff_dma); if (self->rx_buff.head) - kfree(self->rx_buff.head); + dma_free_coherent(NULL, self->rx_buff.truesize, + self->rx_buff.head, self->rx_buff_dma); dev_self[self->index] = NULL; free_netdev(self->netdev); @@ -1409,7 +1416,8 @@ static void nsc_ircc_dma_xmit(struct nsc_ircc_cb *self, int iobase) outb(ECR1_DMASWP|ECR1_DMANF|ECR1_EXT_SL, iobase+ECR1); irda_setup_dma(self->io.dma, - self->tx_fifo.queue[self->tx_fifo.ptr].start, + ((u8 *)self->tx_fifo.queue[self->tx_fifo.ptr].start - + self->tx_buff.head) + self->tx_buff_dma, self->tx_fifo.queue[self->tx_fifo.ptr].len, DMA_TX_MODE); @@ -1566,8 +1574,8 @@ static int nsc_ircc_dma_receive(struct nsc_ircc_cb *self) self->st_fifo.len = self->st_fifo.pending_bytes = 0; self->st_fifo.tail = self->st_fifo.head = 0; - irda_setup_dma(self->io.dma, self->rx_buff.data, - self->rx_buff.truesize, DMA_RX_MODE); + irda_setup_dma(self->io.dma, self->rx_buff_dma, self->rx_buff.truesize, + DMA_RX_MODE); /* Enable DMA */ switch_bank(iobase, BANK0);