VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / drivers / net / irda / ali-ircc.c
index ad4ab63..6a10d96 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/init.h>
 #include <linux/rtnetlink.h>
 #include <linux/serial_reg.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/io.h>
 #include <asm/dma.h>
@@ -304,16 +305,18 @@ static int ali_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 err_out2;
        }
        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 err_out3;
@@ -362,9 +365,11 @@ static int ali_ircc_open(int i, chipio_t *info)
        return 0;
 
  err_out4:
-       kfree(self->tx_buff.head);
+       dma_free_coherent(NULL, self->tx_buff.truesize,
+                         self->tx_buff.head, self->tx_buff_dma);
  err_out3:
-       kfree(self->rx_buff.head);
+       dma_free_coherent(NULL, self->rx_buff.truesize,
+                         self->rx_buff.head, self->rx_buff_dma);
  err_out2:
        release_region(self->io.fir_base, self->io.fir_ext);
  err_out1:
@@ -398,10 +403,12 @@ static int __exit ali_ircc_close(struct ali_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);
@@ -1572,7 +1579,8 @@ static void ali_ircc_dma_xmit(struct ali_ircc_cb *self)
        self->io.direction = IO_XMIT;
        
        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);
                
@@ -1724,8 +1732,8 @@ static int ali_ircc_dma_receive(struct ali_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);
         
        /* Set Receive Mode,Brick Wall */
        //switch_bank(iobase, BANK0);