Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 296329
b: refs/heads/master
c: 3c500a3
h: refs/heads/master
i:
  296327: 7b40013
v: v3
  • Loading branch information
Russell King committed Feb 9, 2012
1 parent 8335927 commit 7e2c2fb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 04b7fc4dec4fcb61dbe022bbaffda8ea37c39430
refs/heads/master: 3c500a35544d6270b127bce7d4c5a15ef454b9e2
18 changes: 11 additions & 7 deletions trunk/drivers/net/irda/sa1100_ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ static int tx_lpm;
static int max_rate = 4000000;

struct sa1100_buf {
struct device *dev;
struct sk_buff *skb;
struct scatterlist sg;
dma_regs_t *regs;
Expand Down Expand Up @@ -99,7 +100,7 @@ static int sa1100_irda_rx_alloc(struct sa1100_irda *si)
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;
}
Expand Down Expand Up @@ -295,7 +296,7 @@ static void sa1100_irda_firtxdma_irq(void *id)
/* 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;
Expand All @@ -317,7 +318,7 @@ static int sa1100_irda_fir_tx_start(struct sk_buff *skb, struct net_device *dev,

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++;
Expand Down Expand Up @@ -359,7 +360,7 @@ static void sa1100_irda_fir_error(struct sa1100_irda *si, struct net_device *dev
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 {
/*
Expand Down Expand Up @@ -407,7 +408,7 @@ static void sa1100_irda_fir_error(struct sa1100_irda *si, struct net_device *dev
* 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);
}
}

Expand Down Expand Up @@ -726,6 +727,9 @@ static int sa1100_irda_start(struct net_device *dev)
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.
*/
Expand Down Expand Up @@ -783,15 +787,15 @@ static int sa1100_irda_stop(struct net_device *dev)
*/
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;
Expand Down

0 comments on commit 7e2c2fb

Please sign in to comment.