static int max_rate = 4000000;
struct sa1100_buf {
+ struct device *dev;
struct sk_buff *skb;
struct scatterlist sg;
dma_regs_t *regs;
skb_reserve(si->dma_rx.skb, 1);
sg_set_buf(&si->dma_rx.sg, si->dma_rx.skb->data, HPSIR_MAX_RXLEN);
- if (dma_map_sg(si->dev, &si->dma_rx.sg, 1, DMA_FROM_DEVICE) == 0) {
+ if (dma_map_sg(si->dma_rx.dev, &si->dma_rx.sg, 1, DMA_FROM_DEVICE) == 0) {
dev_kfree_skb_any(si->dma_rx.skb);
return -ENOMEM;
}
/* Account and free the packet. */
skb = si->dma_tx.skb;
if (skb) {
- dma_unmap_sg(si->dev, &si->dma_tx.sg, 1,
+ dma_unmap_sg(si->dma_tx.dev, &si->dma_tx.sg, 1,
DMA_TO_DEVICE);
dev->stats.tx_packets ++;
dev->stats.tx_bytes += skb->len;
si->dma_tx.skb = skb;
sg_set_buf(&si->dma_tx.sg, skb->data, skb->len);
- if (dma_map_sg(si->dev, &si->dma_tx.sg, 1, DMA_TO_DEVICE) == 0) {
+ if (dma_map_sg(si->dma_tx.dev, &si->dma_tx.sg, 1, DMA_TO_DEVICE) == 0) {
si->dma_tx.skb = NULL;
netif_wake_queue(dev);
dev->stats.tx_dropped++;
len = dma_addr - sg_dma_address(&si->dma_rx.sg);
if (len > HPSIR_MAX_RXLEN)
len = HPSIR_MAX_RXLEN;
- dma_unmap_sg(si->dev, &si->dma_rx.sg, 1, DMA_FROM_DEVICE);
+ dma_unmap_sg(si->dma_rx.dev, &si->dma_rx.sg, 1, DMA_FROM_DEVICE);
do {
/*
* Remap the buffer - it was previously mapped, and we
* hope that this succeeds.
*/
- dma_map_sg(si->dev, &si->dma_rx.sg, 1, DMA_FROM_DEVICE);
+ dma_map_sg(si->dma_rx.dev, &si->dma_rx.sg, 1, DMA_FROM_DEVICE);
}
}
if (err)
goto err_tx_dma;
+ si->dma_rx.dev = si->dev;
+ si->dma_tx.dev = si->dev;
+
/*
* Setup the serial port for the specified speed.
*/
*/
skb = si->dma_rx.skb;
if (skb) {
- dma_unmap_sg(si->dev, &si->dma_rx.sg, 1,
+ dma_unmap_sg(si->dma_rx.dev, &si->dma_rx.sg, 1,
DMA_FROM_DEVICE);
dev_kfree_skb(skb);
si->dma_rx.skb = NULL;
skb = si->dma_tx.skb;
if (skb) {
- dma_unmap_sg(si->dev, &si->dma_tx.sg, 1,
+ dma_unmap_sg(si->dma_tx.dev, &si->dma_tx.sg, 1,
DMA_TO_DEVICE);
dev_kfree_skb(skb);
si->dma_tx.skb = NULL;