aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-08-27 21:37:58 -0400
committerDavid S. Miller <davem@davemloft.net>2008-08-29 05:13:12 -0400
commit7a715f46012f3552294154978aed59cba9804928 (patch)
tree9e7079ae4ad370b63ac6c8a4face573d6cf60533 /drivers
parent5778002874de0fb7e3d8c4a0a4afb6b1a6297069 (diff)
sparc: Make SBUS DMA interfaces take struct device.
This is the first step in converting all the SBUS drivers over to generic dma_*(). Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/atm/fore200e.c34
-rw-r--r--drivers/net/myri_sbus.c27
-rw-r--r--drivers/net/sunbmac.c28
-rw-r--r--drivers/net/sunhme.c36
-rw-r--r--drivers/net/sunhme.h1
-rw-r--r--drivers/net/sunlance.c5
-rw-r--r--drivers/net/sunqe.c12
-rw-r--r--drivers/scsi/qlogicpti.c21
-rw-r--r--drivers/scsi/sun_esp.c23
9 files changed, 112 insertions, 75 deletions
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index 73338d231db9..c5ab44fc13df 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -678,7 +678,9 @@ fore200e_sba_write(u32 val, volatile u32 __iomem *addr)
678static u32 678static u32
679fore200e_sba_dma_map(struct fore200e* fore200e, void* virt_addr, int size, int direction) 679fore200e_sba_dma_map(struct fore200e* fore200e, void* virt_addr, int size, int direction)
680{ 680{
681 u32 dma_addr = sbus_map_single((struct sbus_dev*)fore200e->bus_dev, virt_addr, size, direction); 681 struct sbus_dev *sdev = fore200e->bus_dev;
682 struct device *dev = &sdev->ofdev.dev;
683 u32 dma_addr = sbus_map_single(dev, virt_addr, size, direction);
682 684
683 DPRINTK(3, "SBUS DVMA mapping: virt_addr = 0x%p, size = %d, direction = %d --> dma_addr = 0x%08x\n", 685 DPRINTK(3, "SBUS DVMA mapping: virt_addr = 0x%p, size = %d, direction = %d --> dma_addr = 0x%08x\n",
684 virt_addr, size, direction, dma_addr); 686 virt_addr, size, direction, dma_addr);
@@ -690,27 +692,36 @@ fore200e_sba_dma_map(struct fore200e* fore200e, void* virt_addr, int size, int d
690static void 692static void
691fore200e_sba_dma_unmap(struct fore200e* fore200e, u32 dma_addr, int size, int direction) 693fore200e_sba_dma_unmap(struct fore200e* fore200e, u32 dma_addr, int size, int direction)
692{ 694{
695 struct sbus_dev *sdev = fore200e->bus_dev;
696 struct device *dev = &sdev->ofdev.dev;
697
693 DPRINTK(3, "SBUS DVMA unmapping: dma_addr = 0x%08x, size = %d, direction = %d,\n", 698 DPRINTK(3, "SBUS DVMA unmapping: dma_addr = 0x%08x, size = %d, direction = %d,\n",
694 dma_addr, size, direction); 699 dma_addr, size, direction);
695 700
696 sbus_unmap_single((struct sbus_dev*)fore200e->bus_dev, dma_addr, size, direction); 701 sbus_unmap_single(dev, dma_addr, size, direction);
697} 702}
698 703
699 704
700static void 705static void
701fore200e_sba_dma_sync_for_cpu(struct fore200e* fore200e, u32 dma_addr, int size, int direction) 706fore200e_sba_dma_sync_for_cpu(struct fore200e* fore200e, u32 dma_addr, int size, int direction)
702{ 707{
708 struct sbus_dev *sdev = fore200e->bus_dev;
709 struct device *dev = &sdev->ofdev.dev;
710
703 DPRINTK(3, "SBUS DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction); 711 DPRINTK(3, "SBUS DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction);
704 712
705 sbus_dma_sync_single_for_cpu((struct sbus_dev*)fore200e->bus_dev, dma_addr, size, direction); 713 sbus_dma_sync_single_for_cpu(dev, dma_addr, size, direction);
706} 714}
707 715
708static void 716static void
709fore200e_sba_dma_sync_for_device(struct fore200e* fore200e, u32 dma_addr, int size, int direction) 717fore200e_sba_dma_sync_for_device(struct fore200e* fore200e, u32 dma_addr, int size, int direction)
710{ 718{
719 struct sbus_dev *sdev = fore200e->bus_dev;
720 struct device *dev = &sdev->ofdev.dev;
721
711 DPRINTK(3, "SBUS DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction); 722 DPRINTK(3, "SBUS DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction);
712 723
713 sbus_dma_sync_single_for_device((struct sbus_dev*)fore200e->bus_dev, dma_addr, size, direction); 724 sbus_dma_sync_single_for_device(dev, dma_addr, size, direction);
714} 725}
715 726
716 727
@@ -721,11 +732,13 @@ static int
721fore200e_sba_dma_chunk_alloc(struct fore200e* fore200e, struct chunk* chunk, 732fore200e_sba_dma_chunk_alloc(struct fore200e* fore200e, struct chunk* chunk,
722 int size, int nbr, int alignment) 733 int size, int nbr, int alignment)
723{ 734{
735 struct sbus_dev *sdev = (struct sbus_dev *) fore200e->bus_dev;
736 struct device *dev = &sdev->ofdev.dev;
737
724 chunk->alloc_size = chunk->align_size = size * nbr; 738 chunk->alloc_size = chunk->align_size = size * nbr;
725 739
726 /* returned chunks are page-aligned */ 740 /* returned chunks are page-aligned */
727 chunk->alloc_addr = sbus_alloc_consistent((struct sbus_dev*)fore200e->bus_dev, 741 chunk->alloc_addr = sbus_alloc_consistent(dev, chunk->alloc_size,
728 chunk->alloc_size,
729 &chunk->dma_addr); 742 &chunk->dma_addr);
730 743
731 if ((chunk->alloc_addr == NULL) || (chunk->dma_addr == 0)) 744 if ((chunk->alloc_addr == NULL) || (chunk->dma_addr == 0))
@@ -742,10 +755,11 @@ fore200e_sba_dma_chunk_alloc(struct fore200e* fore200e, struct chunk* chunk,
742static void 755static void
743fore200e_sba_dma_chunk_free(struct fore200e* fore200e, struct chunk* chunk) 756fore200e_sba_dma_chunk_free(struct fore200e* fore200e, struct chunk* chunk)
744{ 757{
745 sbus_free_consistent((struct sbus_dev*)fore200e->bus_dev, 758 struct sbus_dev *sdev = (struct sbus_dev *) fore200e->bus_dev;
746 chunk->alloc_size, 759 struct device *dev = &sdev->ofdev.dev;
747 chunk->alloc_addr, 760
748 chunk->dma_addr); 761 sbus_free_consistent(dev, chunk->alloc_size,
762 chunk->alloc_addr, chunk->dma_addr);
749} 763}
750 764
751 765
diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c
index 656a260fc956..c17462159d9d 100644
--- a/drivers/net/myri_sbus.c
+++ b/drivers/net/myri_sbus.c
@@ -243,7 +243,8 @@ static void myri_clean_rings(struct myri_eth *mp)
243 u32 dma_addr; 243 u32 dma_addr;
244 244
245 dma_addr = sbus_readl(&rxd->myri_scatters[0].addr); 245 dma_addr = sbus_readl(&rxd->myri_scatters[0].addr);
246 sbus_unmap_single(mp->myri_sdev, dma_addr, RX_ALLOC_SIZE, SBUS_DMA_FROMDEVICE); 246 sbus_unmap_single(&mp->myri_sdev->ofdev.dev, dma_addr,
247 RX_ALLOC_SIZE, SBUS_DMA_FROMDEVICE);
247 dev_kfree_skb(mp->rx_skbs[i]); 248 dev_kfree_skb(mp->rx_skbs[i]);
248 mp->rx_skbs[i] = NULL; 249 mp->rx_skbs[i] = NULL;
249 } 250 }
@@ -259,7 +260,9 @@ static void myri_clean_rings(struct myri_eth *mp)
259 u32 dma_addr; 260 u32 dma_addr;
260 261
261 dma_addr = sbus_readl(&txd->myri_gathers[0].addr); 262 dma_addr = sbus_readl(&txd->myri_gathers[0].addr);
262 sbus_unmap_single(mp->myri_sdev, dma_addr, (skb->len + 3) & ~3, SBUS_DMA_TODEVICE); 263 sbus_unmap_single(&mp->myri_sdev->ofdev.dev, dma_addr,
264 (skb->len + 3) & ~3,
265 SBUS_DMA_TODEVICE);
263 dev_kfree_skb(mp->tx_skbs[i]); 266 dev_kfree_skb(mp->tx_skbs[i]);
264 mp->tx_skbs[i] = NULL; 267 mp->tx_skbs[i] = NULL;
265 } 268 }
@@ -288,7 +291,9 @@ static void myri_init_rings(struct myri_eth *mp, int from_irq)
288 skb->dev = dev; 291 skb->dev = dev;
289 skb_put(skb, RX_ALLOC_SIZE); 292 skb_put(skb, RX_ALLOC_SIZE);
290 293
291 dma_addr = sbus_map_single(mp->myri_sdev, skb->data, RX_ALLOC_SIZE, SBUS_DMA_FROMDEVICE); 294 dma_addr = sbus_map_single(&mp->myri_sdev->ofdev.dev,
295 skb->data, RX_ALLOC_SIZE,
296 SBUS_DMA_FROMDEVICE);
292 sbus_writel(dma_addr, &rxd[i].myri_scatters[0].addr); 297 sbus_writel(dma_addr, &rxd[i].myri_scatters[0].addr);
293 sbus_writel(RX_ALLOC_SIZE, &rxd[i].myri_scatters[0].len); 298 sbus_writel(RX_ALLOC_SIZE, &rxd[i].myri_scatters[0].len);
294 sbus_writel(i, &rxd[i].ctx); 299 sbus_writel(i, &rxd[i].ctx);
@@ -344,7 +349,8 @@ static void myri_tx(struct myri_eth *mp, struct net_device *dev)
344 349
345 DTX(("SKB[%d] ", entry)); 350 DTX(("SKB[%d] ", entry));
346 dma_addr = sbus_readl(&sq->myri_txd[entry].myri_gathers[0].addr); 351 dma_addr = sbus_readl(&sq->myri_txd[entry].myri_gathers[0].addr);
347 sbus_unmap_single(mp->myri_sdev, dma_addr, skb->len, SBUS_DMA_TODEVICE); 352 sbus_unmap_single(&mp->myri_sdev->ofdev.dev, dma_addr,
353 skb->len, SBUS_DMA_TODEVICE);
348 dev_kfree_skb(skb); 354 dev_kfree_skb(skb);
349 mp->tx_skbs[entry] = NULL; 355 mp->tx_skbs[entry] = NULL;
350 dev->stats.tx_packets++; 356 dev->stats.tx_packets++;
@@ -423,7 +429,7 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev)
423 429
424 /* Check for errors. */ 430 /* Check for errors. */
425 DRX(("rxd[%d]: %p len[%d] csum[%08x] ", entry, rxd, len, csum)); 431 DRX(("rxd[%d]: %p len[%d] csum[%08x] ", entry, rxd, len, csum));
426 sbus_dma_sync_single_for_cpu(mp->myri_sdev, 432 sbus_dma_sync_single_for_cpu(&mp->myri_sdev->ofdev.dev,
427 sbus_readl(&rxd->myri_scatters[0].addr), 433 sbus_readl(&rxd->myri_scatters[0].addr),
428 RX_ALLOC_SIZE, SBUS_DMA_FROMDEVICE); 434 RX_ALLOC_SIZE, SBUS_DMA_FROMDEVICE);
429 if (len < (ETH_HLEN + MYRI_PAD_LEN) || (skb->data[0] != MYRI_PAD_LEN)) { 435 if (len < (ETH_HLEN + MYRI_PAD_LEN) || (skb->data[0] != MYRI_PAD_LEN)) {
@@ -442,7 +448,7 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev)
442 drops++; 448 drops++;
443 DRX(("DROP ")); 449 DRX(("DROP "));
444 dev->stats.rx_dropped++; 450 dev->stats.rx_dropped++;
445 sbus_dma_sync_single_for_device(mp->myri_sdev, 451 sbus_dma_sync_single_for_device(&mp->myri_sdev->ofdev.dev,
446 sbus_readl(&rxd->myri_scatters[0].addr), 452 sbus_readl(&rxd->myri_scatters[0].addr),
447 RX_ALLOC_SIZE, 453 RX_ALLOC_SIZE,
448 SBUS_DMA_FROMDEVICE); 454 SBUS_DMA_FROMDEVICE);
@@ -464,14 +470,14 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev)
464 DRX(("skb_alloc(FAILED) ")); 470 DRX(("skb_alloc(FAILED) "));
465 goto drop_it; 471 goto drop_it;
466 } 472 }
467 sbus_unmap_single(mp->myri_sdev, 473 sbus_unmap_single(&mp->myri_sdev->ofdev.dev,
468 sbus_readl(&rxd->myri_scatters[0].addr), 474 sbus_readl(&rxd->myri_scatters[0].addr),
469 RX_ALLOC_SIZE, 475 RX_ALLOC_SIZE,
470 SBUS_DMA_FROMDEVICE); 476 SBUS_DMA_FROMDEVICE);
471 mp->rx_skbs[index] = new_skb; 477 mp->rx_skbs[index] = new_skb;
472 new_skb->dev = dev; 478 new_skb->dev = dev;
473 skb_put(new_skb, RX_ALLOC_SIZE); 479 skb_put(new_skb, RX_ALLOC_SIZE);
474 dma_addr = sbus_map_single(mp->myri_sdev, 480 dma_addr = sbus_map_single(&mp->myri_sdev->ofdev.dev,
475 new_skb->data, 481 new_skb->data,
476 RX_ALLOC_SIZE, 482 RX_ALLOC_SIZE,
477 SBUS_DMA_FROMDEVICE); 483 SBUS_DMA_FROMDEVICE);
@@ -500,7 +506,7 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev)
500 506
501 /* Reuse original ring buffer. */ 507 /* Reuse original ring buffer. */
502 DRX(("reuse ")); 508 DRX(("reuse "));
503 sbus_dma_sync_single_for_device(mp->myri_sdev, 509 sbus_dma_sync_single_for_device(&mp->myri_sdev->ofdev.dev,
504 sbus_readl(&rxd->myri_scatters[0].addr), 510 sbus_readl(&rxd->myri_scatters[0].addr),
505 RX_ALLOC_SIZE, 511 RX_ALLOC_SIZE,
506 SBUS_DMA_FROMDEVICE); 512 SBUS_DMA_FROMDEVICE);
@@ -652,7 +658,8 @@ static int myri_start_xmit(struct sk_buff *skb, struct net_device *dev)
652 sbus_writew((skb->data[4] << 8) | skb->data[5], &txd->addr[3]); 658 sbus_writew((skb->data[4] << 8) | skb->data[5], &txd->addr[3]);
653 } 659 }
654 660
655 dma_addr = sbus_map_single(mp->myri_sdev, skb->data, len, SBUS_DMA_TODEVICE); 661 dma_addr = sbus_map_single(&mp->myri_sdev->ofdev.dev, skb->data,
662 len, SBUS_DMA_TODEVICE);
656 sbus_writel(dma_addr, &txd->myri_gathers[0].addr); 663 sbus_writel(dma_addr, &txd->myri_gathers[0].addr);
657 sbus_writel(len, &txd->myri_gathers[0].len); 664 sbus_writel(len, &txd->myri_gathers[0].len);
658 sbus_writel(1, &txd->num_sg); 665 sbus_writel(1, &txd->num_sg);
diff --git a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c
index 0e4a88d16327..b92218c2f76c 100644
--- a/drivers/net/sunbmac.c
+++ b/drivers/net/sunbmac.c
@@ -239,7 +239,7 @@ static void bigmac_init_rings(struct bigmac *bp, int from_irq)
239 skb_reserve(skb, 34); 239 skb_reserve(skb, 34);
240 240
241 bb->be_rxd[i].rx_addr = 241 bb->be_rxd[i].rx_addr =
242 sbus_map_single(bp->bigmac_sdev, skb->data, 242 sbus_map_single(&bp->bigmac_sdev->ofdev.dev, skb->data,
243 RX_BUF_ALLOC_SIZE - 34, 243 RX_BUF_ALLOC_SIZE - 34,
244 SBUS_DMA_FROMDEVICE); 244 SBUS_DMA_FROMDEVICE);
245 bb->be_rxd[i].rx_flags = 245 bb->be_rxd[i].rx_flags =
@@ -776,7 +776,7 @@ static void bigmac_tx(struct bigmac *bp)
776 skb = bp->tx_skbs[elem]; 776 skb = bp->tx_skbs[elem];
777 bp->enet_stats.tx_packets++; 777 bp->enet_stats.tx_packets++;
778 bp->enet_stats.tx_bytes += skb->len; 778 bp->enet_stats.tx_bytes += skb->len;
779 sbus_unmap_single(bp->bigmac_sdev, 779 sbus_unmap_single(&bp->bigmac_sdev->ofdev.dev,
780 this->tx_addr, skb->len, 780 this->tx_addr, skb->len,
781 SBUS_DMA_TODEVICE); 781 SBUS_DMA_TODEVICE);
782 782
@@ -831,7 +831,7 @@ static void bigmac_rx(struct bigmac *bp)
831 drops++; 831 drops++;
832 goto drop_it; 832 goto drop_it;
833 } 833 }
834 sbus_unmap_single(bp->bigmac_sdev, 834 sbus_unmap_single(&bp->bigmac_sdev->ofdev.dev,
835 this->rx_addr, 835 this->rx_addr,
836 RX_BUF_ALLOC_SIZE - 34, 836 RX_BUF_ALLOC_SIZE - 34,
837 SBUS_DMA_FROMDEVICE); 837 SBUS_DMA_FROMDEVICE);
@@ -839,10 +839,11 @@ static void bigmac_rx(struct bigmac *bp)
839 new_skb->dev = bp->dev; 839 new_skb->dev = bp->dev;
840 skb_put(new_skb, ETH_FRAME_LEN); 840 skb_put(new_skb, ETH_FRAME_LEN);
841 skb_reserve(new_skb, 34); 841 skb_reserve(new_skb, 34);
842 this->rx_addr = sbus_map_single(bp->bigmac_sdev, 842 this->rx_addr =
843 new_skb->data, 843 sbus_map_single(&bp->bigmac_sdev->ofdev.dev,
844 RX_BUF_ALLOC_SIZE - 34, 844 new_skb->data,
845 SBUS_DMA_FROMDEVICE); 845 RX_BUF_ALLOC_SIZE - 34,
846 SBUS_DMA_FROMDEVICE);
846 this->rx_flags = 847 this->rx_flags =
847 (RXD_OWN | ((RX_BUF_ALLOC_SIZE - 34) & RXD_LENGTH)); 848 (RXD_OWN | ((RX_BUF_ALLOC_SIZE - 34) & RXD_LENGTH));
848 849
@@ -857,11 +858,11 @@ static void bigmac_rx(struct bigmac *bp)
857 } 858 }
858 skb_reserve(copy_skb, 2); 859 skb_reserve(copy_skb, 2);
859 skb_put(copy_skb, len); 860 skb_put(copy_skb, len);
860 sbus_dma_sync_single_for_cpu(bp->bigmac_sdev, 861 sbus_dma_sync_single_for_cpu(&bp->bigmac_sdev->ofdev.dev,
861 this->rx_addr, len, 862 this->rx_addr, len,
862 SBUS_DMA_FROMDEVICE); 863 SBUS_DMA_FROMDEVICE);
863 skb_copy_to_linear_data(copy_skb, (unsigned char *)skb->data, len); 864 skb_copy_to_linear_data(copy_skb, (unsigned char *)skb->data, len);
864 sbus_dma_sync_single_for_device(bp->bigmac_sdev, 865 sbus_dma_sync_single_for_device(&bp->bigmac_sdev->ofdev.dev,
865 this->rx_addr, len, 866 this->rx_addr, len,
866 SBUS_DMA_FROMDEVICE); 867 SBUS_DMA_FROMDEVICE);
867 868
@@ -959,7 +960,8 @@ static int bigmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
959 u32 mapping; 960 u32 mapping;
960 961
961 len = skb->len; 962 len = skb->len;
962 mapping = sbus_map_single(bp->bigmac_sdev, skb->data, len, SBUS_DMA_TODEVICE); 963 mapping = sbus_map_single(&bp->bigmac_sdev->ofdev.dev, skb->data,
964 len, SBUS_DMA_TODEVICE);
963 965
964 /* Avoid a race... */ 966 /* Avoid a race... */
965 spin_lock_irq(&bp->lock); 967 spin_lock_irq(&bp->lock);
@@ -1183,7 +1185,7 @@ static int __devinit bigmac_ether_init(struct sbus_dev *qec_sdev)
1183 bigmac_stop(bp); 1185 bigmac_stop(bp);
1184 1186
1185 /* Allocate transmit/receive descriptor DVMA block. */ 1187 /* Allocate transmit/receive descriptor DVMA block. */
1186 bp->bmac_block = sbus_alloc_consistent(bp->bigmac_sdev, 1188 bp->bmac_block = sbus_alloc_consistent(&bp->bigmac_sdev->ofdev.dev,
1187 PAGE_SIZE, 1189 PAGE_SIZE,
1188 &bp->bblock_dvma); 1190 &bp->bblock_dvma);
1189 if (bp->bmac_block == NULL || bp->bblock_dvma == 0) { 1191 if (bp->bmac_block == NULL || bp->bblock_dvma == 0) {
@@ -1245,7 +1247,7 @@ fail_and_cleanup:
1245 sbus_iounmap(bp->tregs, TCVR_REG_SIZE); 1247 sbus_iounmap(bp->tregs, TCVR_REG_SIZE);
1246 1248
1247 if (bp->bmac_block) 1249 if (bp->bmac_block)
1248 sbus_free_consistent(bp->bigmac_sdev, 1250 sbus_free_consistent(&bp->bigmac_sdev->ofdev.dev,
1249 PAGE_SIZE, 1251 PAGE_SIZE,
1250 bp->bmac_block, 1252 bp->bmac_block,
1251 bp->bblock_dvma); 1253 bp->bblock_dvma);
@@ -1280,7 +1282,7 @@ static int __devexit bigmac_sbus_remove(struct of_device *dev)
1280 sbus_iounmap(bp->creg, CREG_REG_SIZE); 1282 sbus_iounmap(bp->creg, CREG_REG_SIZE);
1281 sbus_iounmap(bp->bregs, BMAC_REG_SIZE); 1283 sbus_iounmap(bp->bregs, BMAC_REG_SIZE);
1282 sbus_iounmap(bp->tregs, TCVR_REG_SIZE); 1284 sbus_iounmap(bp->tregs, TCVR_REG_SIZE);
1283 sbus_free_consistent(bp->bigmac_sdev, 1285 sbus_free_consistent(&bp->bigmac_sdev->ofdev.dev,
1284 PAGE_SIZE, 1286 PAGE_SIZE,
1285 bp->bmac_block, 1287 bp->bmac_block,
1286 bp->bblock_dvma); 1288 bp->bblock_dvma);
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index b79d5f018f79..cd93fc5e826a 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -251,13 +251,13 @@ static u32 pci_hme_read_desc32(hme32 *p)
251#define hme_read_desc32(__hp, __p) \ 251#define hme_read_desc32(__hp, __p) \
252 ((__hp)->read_desc32(__p)) 252 ((__hp)->read_desc32(__p))
253#define hme_dma_map(__hp, __ptr, __size, __dir) \ 253#define hme_dma_map(__hp, __ptr, __size, __dir) \
254 ((__hp)->dma_map((__hp)->happy_dev, (__ptr), (__size), (__dir))) 254 ((__hp)->dma_map((__hp)->dma_dev, (__ptr), (__size), (__dir)))
255#define hme_dma_unmap(__hp, __addr, __size, __dir) \ 255#define hme_dma_unmap(__hp, __addr, __size, __dir) \
256 ((__hp)->dma_unmap((__hp)->happy_dev, (__addr), (__size), (__dir))) 256 ((__hp)->dma_unmap((__hp)->dma_dev, (__addr), (__size), (__dir)))
257#define hme_dma_sync_for_cpu(__hp, __addr, __size, __dir) \ 257#define hme_dma_sync_for_cpu(__hp, __addr, __size, __dir) \
258 ((__hp)->dma_sync_for_cpu((__hp)->happy_dev, (__addr), (__size), (__dir))) 258 ((__hp)->dma_sync_for_cpu((__hp)->dma_dev, (__addr), (__size), (__dir)))
259#define hme_dma_sync_for_device(__hp, __addr, __size, __dir) \ 259#define hme_dma_sync_for_device(__hp, __addr, __size, __dir) \
260 ((__hp)->dma_sync_for_device((__hp)->happy_dev, (__addr), (__size), (__dir))) 260 ((__hp)->dma_sync_for_device((__hp)->dma_dev, (__addr), (__size), (__dir)))
261#else 261#else
262#ifdef CONFIG_SBUS 262#ifdef CONFIG_SBUS
263/* SBUS only compilation */ 263/* SBUS only compilation */
@@ -277,13 +277,13 @@ do { (__txd)->tx_addr = (__force hme32)(u32)(__addr); \
277} while(0) 277} while(0)
278#define hme_read_desc32(__hp, __p) ((__force u32)(hme32)*(__p)) 278#define hme_read_desc32(__hp, __p) ((__force u32)(hme32)*(__p))
279#define hme_dma_map(__hp, __ptr, __size, __dir) \ 279#define hme_dma_map(__hp, __ptr, __size, __dir) \
280 sbus_map_single((__hp)->happy_dev, (__ptr), (__size), (__dir)) 280 sbus_map_single((__hp)->dma_dev, (__ptr), (__size), (__dir))
281#define hme_dma_unmap(__hp, __addr, __size, __dir) \ 281#define hme_dma_unmap(__hp, __addr, __size, __dir) \
282 sbus_unmap_single((__hp)->happy_dev, (__addr), (__size), (__dir)) 282 sbus_unmap_single((__hp)->dma_dev, (__addr), (__size), (__dir))
283#define hme_dma_sync_for_cpu(__hp, __addr, __size, __dir) \ 283#define hme_dma_sync_for_cpu(__hp, __addr, __size, __dir) \
284 sbus_dma_sync_single_for_cpu((__hp)->happy_dev, (__addr), (__size), (__dir)) 284 sbus_dma_sync_single_for_cpu((__hp)->dma_dev, (__addr), (__size), (__dir))
285#define hme_dma_sync_for_device(__hp, __addr, __size, __dir) \ 285#define hme_dma_sync_for_device(__hp, __addr, __size, __dir) \
286 sbus_dma_sync_single_for_device((__hp)->happy_dev, (__addr), (__size), (__dir)) 286 sbus_dma_sync_single_for_device((__hp)->dma_dev, (__addr), (__size), (__dir))
287#else 287#else
288/* PCI only compilation */ 288/* PCI only compilation */
289#define hme_write32(__hp, __reg, __val) \ 289#define hme_write32(__hp, __reg, __val) \
@@ -305,13 +305,13 @@ static inline u32 hme_read_desc32(struct happy_meal *hp, hme32 *p)
305 return le32_to_cpup((__le32 *)p); 305 return le32_to_cpup((__le32 *)p);
306} 306}
307#define hme_dma_map(__hp, __ptr, __size, __dir) \ 307#define hme_dma_map(__hp, __ptr, __size, __dir) \
308 pci_map_single((__hp)->happy_dev, (__ptr), (__size), (__dir)) 308 pci_map_single((__hp)->dma_dev, (__ptr), (__size), (__dir))
309#define hme_dma_unmap(__hp, __addr, __size, __dir) \ 309#define hme_dma_unmap(__hp, __addr, __size, __dir) \
310 pci_unmap_single((__hp)->happy_dev, (__addr), (__size), (__dir)) 310 pci_unmap_single((__hp)->dma_dev, (__addr), (__size), (__dir))
311#define hme_dma_sync_for_cpu(__hp, __addr, __size, __dir) \ 311#define hme_dma_sync_for_cpu(__hp, __addr, __size, __dir) \
312 pci_dma_sync_single_for_cpu((__hp)->happy_dev, (__addr), (__size), (__dir)) 312 pci_dma_sync_single_for_cpu((__hp)->dma_dev, (__addr), (__size), (__dir))
313#define hme_dma_sync_for_device(__hp, __addr, __size, __dir) \ 313#define hme_dma_sync_for_device(__hp, __addr, __size, __dir) \
314 pci_dma_sync_single_for_device((__hp)->happy_dev, (__addr), (__size), (__dir)) 314 pci_dma_sync_single_for_device((__hp)->dma_dev, (__addr), (__size), (__dir))
315#endif 315#endif
316#endif 316#endif
317 317
@@ -2716,6 +2716,7 @@ static int __devinit happy_meal_sbus_probe_one(struct sbus_dev *sdev, int is_qfe
2716 hp = dev->priv; 2716 hp = dev->priv;
2717 2717
2718 hp->happy_dev = sdev; 2718 hp->happy_dev = sdev;
2719 hp->dma_dev = &sdev->ofdev.dev;
2719 2720
2720 spin_lock_init(&hp->happy_lock); 2721 spin_lock_init(&hp->happy_lock);
2721 2722
@@ -2785,7 +2786,7 @@ static int __devinit happy_meal_sbus_probe_one(struct sbus_dev *sdev, int is_qfe
2785 hp->happy_bursts = of_getintprop_default(sdev->bus->ofdev.node, 2786 hp->happy_bursts = of_getintprop_default(sdev->bus->ofdev.node,
2786 "burst-sizes", 0x00); 2787 "burst-sizes", 0x00);
2787 2788
2788 hp->happy_block = sbus_alloc_consistent(hp->happy_dev, 2789 hp->happy_block = sbus_alloc_consistent(hp->dma_dev,
2789 PAGE_SIZE, 2790 PAGE_SIZE,
2790 &hp->hblock_dvma); 2791 &hp->hblock_dvma);
2791 err = -ENOMEM; 2792 err = -ENOMEM;
@@ -2860,7 +2861,7 @@ static int __devinit happy_meal_sbus_probe_one(struct sbus_dev *sdev, int is_qfe
2860 return 0; 2861 return 0;
2861 2862
2862err_out_free_consistent: 2863err_out_free_consistent:
2863 sbus_free_consistent(hp->happy_dev, 2864 sbus_free_consistent(hp->dma_dev,
2864 PAGE_SIZE, 2865 PAGE_SIZE,
2865 hp->happy_block, 2866 hp->happy_block,
2866 hp->hblock_dvma); 2867 hp->hblock_dvma);
@@ -3035,6 +3036,7 @@ static int __devinit happy_meal_pci_probe(struct pci_dev *pdev,
3035 memset(hp, 0, sizeof(*hp)); 3036 memset(hp, 0, sizeof(*hp));
3036 3037
3037 hp->happy_dev = pdev; 3038 hp->happy_dev = pdev;
3039 hp->dma_dev = pdev;
3038 3040
3039 spin_lock_init(&hp->happy_lock); 3041 spin_lock_init(&hp->happy_lock);
3040 3042
@@ -3231,12 +3233,12 @@ static void __devexit happy_meal_pci_remove(struct pci_dev *pdev)
3231 3233
3232 unregister_netdev(net_dev); 3234 unregister_netdev(net_dev);
3233 3235
3234 pci_free_consistent(hp->happy_dev, 3236 pci_free_consistent(hp->dma_dev,
3235 PAGE_SIZE, 3237 PAGE_SIZE,
3236 hp->happy_block, 3238 hp->happy_block,
3237 hp->hblock_dvma); 3239 hp->hblock_dvma);
3238 iounmap(hp->gregs); 3240 iounmap(hp->gregs);
3239 pci_release_regions(hp->happy_dev); 3241 pci_release_regions(hp->dma_dev);
3240 3242
3241 free_netdev(net_dev); 3243 free_netdev(net_dev);
3242 3244
@@ -3306,7 +3308,7 @@ static int __devexit hme_sbus_remove(struct of_device *dev)
3306 sbus_iounmap(hp->erxregs, ERX_REG_SIZE); 3308 sbus_iounmap(hp->erxregs, ERX_REG_SIZE);
3307 sbus_iounmap(hp->bigmacregs, BMAC_REG_SIZE); 3309 sbus_iounmap(hp->bigmacregs, BMAC_REG_SIZE);
3308 sbus_iounmap(hp->tcvregs, TCVR_REG_SIZE); 3310 sbus_iounmap(hp->tcvregs, TCVR_REG_SIZE);
3309 sbus_free_consistent(hp->happy_dev, 3311 sbus_free_consistent(hp->dma_dev,
3310 PAGE_SIZE, 3312 PAGE_SIZE,
3311 hp->happy_block, 3313 hp->happy_block,
3312 hp->hblock_dvma); 3314 hp->hblock_dvma);
diff --git a/drivers/net/sunhme.h b/drivers/net/sunhme.h
index 4da5539fac7b..756e96e5ef4b 100644
--- a/drivers/net/sunhme.h
+++ b/drivers/net/sunhme.h
@@ -413,6 +413,7 @@ struct happy_meal {
413 413
414 /* This is either a sbus_dev or a pci_dev. */ 414 /* This is either a sbus_dev or a pci_dev. */
415 void *happy_dev; 415 void *happy_dev;
416 void *dma_dev;
416 417
417 spinlock_t happy_lock; 418 spinlock_t happy_lock;
418 419
diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c
index 24ffecb1ce23..4f4baf9f4ec8 100644
--- a/drivers/net/sunlance.c
+++ b/drivers/net/sunlance.c
@@ -1283,7 +1283,7 @@ static void lance_free_hwresources(struct lance_private *lp)
1283 sbus_iounmap(lp->init_block_iomem, 1283 sbus_iounmap(lp->init_block_iomem,
1284 sizeof(struct lance_init_block)); 1284 sizeof(struct lance_init_block));
1285 } else if (lp->init_block_mem) { 1285 } else if (lp->init_block_mem) {
1286 sbus_free_consistent(lp->sdev, 1286 sbus_free_consistent(&lp->sdev->ofdev.dev,
1287 sizeof(struct lance_init_block), 1287 sizeof(struct lance_init_block),
1288 lp->init_block_mem, 1288 lp->init_block_mem,
1289 lp->init_block_dvma); 1289 lp->init_block_dvma);
@@ -1384,7 +1384,8 @@ static int __devinit sparc_lance_probe_one(struct sbus_dev *sdev,
1384 lp->tx = lance_tx_pio; 1384 lp->tx = lance_tx_pio;
1385 } else { 1385 } else {
1386 lp->init_block_mem = 1386 lp->init_block_mem =
1387 sbus_alloc_consistent(sdev, sizeof(struct lance_init_block), 1387 sbus_alloc_consistent(&sdev->ofdev.dev,
1388 sizeof(struct lance_init_block),
1388 &lp->init_block_dvma); 1389 &lp->init_block_dvma);
1389 if (!lp->init_block_mem || lp->init_block_dvma == 0) { 1390 if (!lp->init_block_mem || lp->init_block_dvma == 0) {
1390 printk(KERN_ERR "SunLance: Cannot allocate consistent DMA memory.\n"); 1391 printk(KERN_ERR "SunLance: Cannot allocate consistent DMA memory.\n");
diff --git a/drivers/net/sunqe.c b/drivers/net/sunqe.c
index e811331d4608..ac8049cab247 100644
--- a/drivers/net/sunqe.c
+++ b/drivers/net/sunqe.c
@@ -879,10 +879,10 @@ static int __devinit qec_ether_init(struct sbus_dev *sdev)
879 goto fail; 879 goto fail;
880 } 880 }
881 881
882 qe->qe_block = sbus_alloc_consistent(qe->qe_sdev, 882 qe->qe_block = sbus_alloc_consistent(&qe->qe_sdev->ofdev.dev,
883 PAGE_SIZE, 883 PAGE_SIZE,
884 &qe->qblock_dvma); 884 &qe->qblock_dvma);
885 qe->buffers = sbus_alloc_consistent(qe->qe_sdev, 885 qe->buffers = sbus_alloc_consistent(&qe->qe_sdev->ofdev.dev,
886 sizeof(struct sunqe_buffers), 886 sizeof(struct sunqe_buffers),
887 &qe->buffers_dvma); 887 &qe->buffers_dvma);
888 if (qe->qe_block == NULL || qe->qblock_dvma == 0 || 888 if (qe->qe_block == NULL || qe->qblock_dvma == 0 ||
@@ -926,12 +926,12 @@ fail:
926 if (qe->mregs) 926 if (qe->mregs)
927 sbus_iounmap(qe->mregs, MREGS_REG_SIZE); 927 sbus_iounmap(qe->mregs, MREGS_REG_SIZE);
928 if (qe->qe_block) 928 if (qe->qe_block)
929 sbus_free_consistent(qe->qe_sdev, 929 sbus_free_consistent(&qe->qe_sdev->ofdev.dev,
930 PAGE_SIZE, 930 PAGE_SIZE,
931 qe->qe_block, 931 qe->qe_block,
932 qe->qblock_dvma); 932 qe->qblock_dvma);
933 if (qe->buffers) 933 if (qe->buffers)
934 sbus_free_consistent(qe->qe_sdev, 934 sbus_free_consistent(&qe->qe_sdev->ofdev.dev,
935 sizeof(struct sunqe_buffers), 935 sizeof(struct sunqe_buffers),
936 qe->buffers, 936 qe->buffers,
937 qe->buffers_dvma); 937 qe->buffers_dvma);
@@ -957,11 +957,11 @@ static int __devexit qec_sbus_remove(struct of_device *dev)
957 957
958 sbus_iounmap(qp->qcregs, CREG_REG_SIZE); 958 sbus_iounmap(qp->qcregs, CREG_REG_SIZE);
959 sbus_iounmap(qp->mregs, MREGS_REG_SIZE); 959 sbus_iounmap(qp->mregs, MREGS_REG_SIZE);
960 sbus_free_consistent(qp->qe_sdev, 960 sbus_free_consistent(&qp->qe_sdev->ofdev.dev,
961 PAGE_SIZE, 961 PAGE_SIZE,
962 qp->qe_block, 962 qp->qe_block,
963 qp->qblock_dvma); 963 qp->qblock_dvma);
964 sbus_free_consistent(qp->qe_sdev, 964 sbus_free_consistent(&qp->qe_sdev->ofdev.dev,
965 sizeof(struct sunqe_buffers), 965 sizeof(struct sunqe_buffers),
966 qp->buffers, 966 qp->buffers,
967 qp->buffers_dvma); 967 qp->buffers_dvma);
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index 4a1cf6377f6c..f010506af884 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -788,7 +788,7 @@ static int __devinit qpti_map_queues(struct qlogicpti *qpti)
788 struct sbus_dev *sdev = qpti->sdev; 788 struct sbus_dev *sdev = qpti->sdev;
789 789
790#define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN) 790#define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN)
791 qpti->res_cpu = sbus_alloc_consistent(sdev, 791 qpti->res_cpu = sbus_alloc_consistent(&sdev->ofdev.dev,
792 QSIZE(RES_QUEUE_LEN), 792 QSIZE(RES_QUEUE_LEN),
793 &qpti->res_dvma); 793 &qpti->res_dvma);
794 if (qpti->res_cpu == NULL || 794 if (qpti->res_cpu == NULL ||
@@ -797,12 +797,12 @@ static int __devinit qpti_map_queues(struct qlogicpti *qpti)
797 return -1; 797 return -1;
798 } 798 }
799 799
800 qpti->req_cpu = sbus_alloc_consistent(sdev, 800 qpti->req_cpu = sbus_alloc_consistent(&sdev->ofdev.dev,
801 QSIZE(QLOGICPTI_REQ_QUEUE_LEN), 801 QSIZE(QLOGICPTI_REQ_QUEUE_LEN),
802 &qpti->req_dvma); 802 &qpti->req_dvma);
803 if (qpti->req_cpu == NULL || 803 if (qpti->req_cpu == NULL ||
804 qpti->req_dvma == 0) { 804 qpti->req_dvma == 0) {
805 sbus_free_consistent(sdev, QSIZE(RES_QUEUE_LEN), 805 sbus_free_consistent(&sdev->ofdev.dev, QSIZE(RES_QUEUE_LEN),
806 qpti->res_cpu, qpti->res_dvma); 806 qpti->res_cpu, qpti->res_dvma);
807 printk("QPTI: Cannot map request queue.\n"); 807 printk("QPTI: Cannot map request queue.\n");
808 return -1; 808 return -1;
@@ -875,8 +875,9 @@ static inline int load_cmd(struct scsi_cmnd *Cmnd, struct Command_Entry *cmd,
875 int sg_count; 875 int sg_count;
876 876
877 sg = scsi_sglist(Cmnd); 877 sg = scsi_sglist(Cmnd);
878 sg_count = sbus_map_sg(qpti->sdev, sg, scsi_sg_count(Cmnd), 878 sg_count = sbus_map_sg(&qpti->sdev->ofdev.dev, sg,
879 Cmnd->sc_data_direction); 879 scsi_sg_count(Cmnd),
880 Cmnd->sc_data_direction);
880 881
881 ds = cmd->dataseg; 882 ds = cmd->dataseg;
882 cmd->segment_cnt = sg_count; 883 cmd->segment_cnt = sg_count;
@@ -1151,7 +1152,7 @@ static struct scsi_cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti)
1151 Cmnd->result = DID_ERROR << 16; 1152 Cmnd->result = DID_ERROR << 16;
1152 1153
1153 if (scsi_bufflen(Cmnd)) 1154 if (scsi_bufflen(Cmnd))
1154 sbus_unmap_sg(qpti->sdev, 1155 sbus_unmap_sg(&qpti->sdev->ofdev.dev,
1155 scsi_sglist(Cmnd), scsi_sg_count(Cmnd), 1156 scsi_sglist(Cmnd), scsi_sg_count(Cmnd),
1156 Cmnd->sc_data_direction); 1157 Cmnd->sc_data_direction);
1157 1158
@@ -1356,10 +1357,10 @@ static int __devinit qpti_sbus_probe(struct of_device *dev, const struct of_devi
1356 1357
1357fail_unmap_queues: 1358fail_unmap_queues:
1358#define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN) 1359#define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN)
1359 sbus_free_consistent(qpti->sdev, 1360 sbus_free_consistent(&qpti->sdev->ofdev.dev,
1360 QSIZE(RES_QUEUE_LEN), 1361 QSIZE(RES_QUEUE_LEN),
1361 qpti->res_cpu, qpti->res_dvma); 1362 qpti->res_cpu, qpti->res_dvma);
1362 sbus_free_consistent(qpti->sdev, 1363 sbus_free_consistent(&qpti->sdev->ofdev.dev,
1363 QSIZE(QLOGICPTI_REQ_QUEUE_LEN), 1364 QSIZE(QLOGICPTI_REQ_QUEUE_LEN),
1364 qpti->req_cpu, qpti->req_dvma); 1365 qpti->req_cpu, qpti->req_dvma);
1365#undef QSIZE 1366#undef QSIZE
@@ -1394,10 +1395,10 @@ static int __devexit qpti_sbus_remove(struct of_device *dev)
1394 free_irq(qpti->irq, qpti); 1395 free_irq(qpti->irq, qpti);
1395 1396
1396#define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN) 1397#define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN)
1397 sbus_free_consistent(qpti->sdev, 1398 sbus_free_consistent(&qpti->sdev->ofdev.dev,
1398 QSIZE(RES_QUEUE_LEN), 1399 QSIZE(RES_QUEUE_LEN),
1399 qpti->res_cpu, qpti->res_dvma); 1400 qpti->res_cpu, qpti->res_dvma);
1400 sbus_free_consistent(qpti->sdev, 1401 sbus_free_consistent(&qpti->sdev->ofdev.dev,
1401 QSIZE(QLOGICPTI_REQ_QUEUE_LEN), 1402 QSIZE(QLOGICPTI_REQ_QUEUE_LEN),
1402 qpti->req_cpu, qpti->req_dvma); 1403 qpti->req_cpu, qpti->req_dvma);
1403#undef QSIZE 1404#undef QSIZE
diff --git a/drivers/scsi/sun_esp.c b/drivers/scsi/sun_esp.c
index d110b94f111e..35b6e2ccc394 100644
--- a/drivers/scsi/sun_esp.c
+++ b/drivers/scsi/sun_esp.c
@@ -101,7 +101,7 @@ static int __devinit esp_sbus_map_command_block(struct esp *esp)
101{ 101{
102 struct sbus_dev *sdev = esp->dev; 102 struct sbus_dev *sdev = esp->dev;
103 103
104 esp->command_block = sbus_alloc_consistent(sdev, 16, 104 esp->command_block = sbus_alloc_consistent(&sdev->ofdev.dev, 16,
105 &esp->command_block_dma); 105 &esp->command_block_dma);
106 if (!esp->command_block) 106 if (!esp->command_block)
107 return -ENOMEM; 107 return -ENOMEM;
@@ -223,25 +223,33 @@ static u8 sbus_esp_read8(struct esp *esp, unsigned long reg)
223static dma_addr_t sbus_esp_map_single(struct esp *esp, void *buf, 223static dma_addr_t sbus_esp_map_single(struct esp *esp, void *buf,
224 size_t sz, int dir) 224 size_t sz, int dir)
225{ 225{
226 return sbus_map_single(esp->dev, buf, sz, dir); 226 struct sbus_dev *sdev = esp->dev;
227
228 return sbus_map_single(&sdev->ofdev.dev, buf, sz, dir);
227} 229}
228 230
229static int sbus_esp_map_sg(struct esp *esp, struct scatterlist *sg, 231static int sbus_esp_map_sg(struct esp *esp, struct scatterlist *sg,
230 int num_sg, int dir) 232 int num_sg, int dir)
231{ 233{
232 return sbus_map_sg(esp->dev, sg, num_sg, dir); 234 struct sbus_dev *sdev = esp->dev;
235
236 return sbus_map_sg(&sdev->ofdev.dev, sg, num_sg, dir);
233} 237}
234 238
235static void sbus_esp_unmap_single(struct esp *esp, dma_addr_t addr, 239static void sbus_esp_unmap_single(struct esp *esp, dma_addr_t addr,
236 size_t sz, int dir) 240 size_t sz, int dir)
237{ 241{
238 sbus_unmap_single(esp->dev, addr, sz, dir); 242 struct sbus_dev *sdev = esp->dev;
243
244 sbus_unmap_single(&sdev->ofdev.dev, addr, sz, dir);
239} 245}
240 246
241static void sbus_esp_unmap_sg(struct esp *esp, struct scatterlist *sg, 247static void sbus_esp_unmap_sg(struct esp *esp, struct scatterlist *sg,
242 int num_sg, int dir) 248 int num_sg, int dir)
243{ 249{
244 sbus_unmap_sg(esp->dev, sg, num_sg, dir); 250 struct sbus_dev *sdev = esp->dev;
251
252 sbus_unmap_sg(&sdev->ofdev.dev, sg, num_sg, dir);
245} 253}
246 254
247static int sbus_esp_irq_pending(struct esp *esp) 255static int sbus_esp_irq_pending(struct esp *esp)
@@ -550,7 +558,7 @@ static int __devinit esp_sbus_probe_one(struct device *dev,
550fail_free_irq: 558fail_free_irq:
551 free_irq(host->irq, esp); 559 free_irq(host->irq, esp);
552fail_unmap_command_block: 560fail_unmap_command_block:
553 sbus_free_consistent(esp->dev, 16, 561 sbus_free_consistent(&esp_dev->ofdev.dev, 16,
554 esp->command_block, 562 esp->command_block,
555 esp->command_block_dma); 563 esp->command_block_dma);
556fail_unmap_regs: 564fail_unmap_regs:
@@ -589,6 +597,7 @@ static int __devinit esp_sbus_probe(struct of_device *dev, const struct of_devic
589static int __devexit esp_sbus_remove(struct of_device *dev) 597static int __devexit esp_sbus_remove(struct of_device *dev)
590{ 598{
591 struct esp *esp = dev_get_drvdata(&dev->dev); 599 struct esp *esp = dev_get_drvdata(&dev->dev);
600 struct sbus_dev *sdev = esp->dev;
592 struct of_device *dma_of = esp->dma; 601 struct of_device *dma_of = esp->dma;
593 unsigned int irq = esp->host->irq; 602 unsigned int irq = esp->host->irq;
594 u32 val; 603 u32 val;
@@ -600,7 +609,7 @@ static int __devexit esp_sbus_remove(struct of_device *dev)
600 dma_write32(val & ~DMA_INT_ENAB, DMA_CSR); 609 dma_write32(val & ~DMA_INT_ENAB, DMA_CSR);
601 610
602 free_irq(irq, esp); 611 free_irq(irq, esp);
603 sbus_free_consistent(esp->dev, 16, 612 sbus_free_consistent(&sdev->ofdev.dev, 16,
604 esp->command_block, 613 esp->command_block,
605 esp->command_block_dma); 614 esp->command_block_dma);
606 sbus_iounmap(esp->regs, SBUS_ESP_REG_SIZE); 615 sbus_iounmap(esp->regs, SBUS_ESP_REG_SIZE);