#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>
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;
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;
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:
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);
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;
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
/*