VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / drivers / net / irda / w83977af_ir.c
index 1d4382b..64d8d3f 100644 (file)
@@ -50,6 +50,7 @@
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/rtnetlink.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/io.h>
 #include <asm/dma.h>
@@ -207,8 +208,9 @@ int w83977af_open(int i, unsigned int iobase, unsigned int irq,
        self->tx_buff.truesize = 4000;
        
        /* 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_out1;
@@ -216,8 +218,9 @@ int w83977af_open(int i, unsigned int iobase, unsigned int irq,
 
        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_out2;
@@ -252,9 +255,11 @@ int w83977af_open(int i, unsigned int iobase, unsigned int irq,
        
        return 0;
 err_out3:
-       kfree(self->tx_buff.head);
+       dma_free_coherent(NULL, self->tx_buff.truesize,
+                         self->tx_buff.head, self->tx_buff_dma);
 err_out2:      
-       kfree(self->rx_buff.head);
+       dma_free_coherent(NULL, self->rx_buff.truesize,
+                         self->rx_buff.head, self->rx_buff_dma);
 err_out1:
        free_netdev(dev);
 err_out:
@@ -297,10 +302,12 @@ static int w83977af_close(struct w83977af_ir *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);
 
        free_netdev(self->netdev);
 
@@ -606,10 +613,10 @@ static void w83977af_dma_write(struct w83977af_ir *self, int iobase)
        disable_dma(self->io.dma);
        clear_dma_ff(self->io.dma);
        set_dma_mode(self->io.dma, DMA_MODE_READ);
-       set_dma_addr(self->io.dma, isa_virt_to_bus(self->tx_buff.data));
+       set_dma_addr(self->io.dma, self->tx_buff_dma);
        set_dma_count(self->io.dma, self->tx_buff.len);
 #else
-       irda_setup_dma(self->io.dma, self->tx_buff.data, self->tx_buff.len, 
+       irda_setup_dma(self->io.dma, self->tx_buff_dma, self->tx_buff.len,
                       DMA_MODE_WRITE); 
 #endif
        self->io.direction = IO_XMIT;
@@ -763,10 +770,10 @@ int w83977af_dma_receive(struct w83977af_ir *self)
        disable_dma(self->io.dma);
        clear_dma_ff(self->io.dma);
        set_dma_mode(self->io.dma, DMA_MODE_READ);
-       set_dma_addr(self->io.dma, isa_virt_to_bus(self->rx_buff.data));
+       set_dma_addr(self->io.dma, self->rx_buff_dma);
        set_dma_count(self->io.dma, self->rx_buff.truesize);
 #else
-       irda_setup_dma(self->io.dma, self->rx_buff.data, self->rx_buff.truesize, 
+       irda_setup_dma(self->io.dma, self->rx_buff_dma, self->rx_buff.truesize,
                       DMA_MODE_READ);
 #endif
        /*