aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sparc/include/asm/sbus_32.h20
-rw-r--r--arch/sparc/include/asm/sbus_64.h48
-rw-r--r--arch/sparc/kernel/ioport.c43
-rw-r--r--arch/sparc/kernel/sparc_ksyms.c2
-rw-r--r--arch/sparc64/kernel/sparc64_ksyms.c2
-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
-rw-r--r--sound/core/memalloc.c6
-rw-r--r--sound/sparc/dbri.c15
16 files changed, 167 insertions, 156 deletions
diff --git a/arch/sparc/include/asm/sbus_32.h b/arch/sparc/include/asm/sbus_32.h
index a7b4fa21931d..61d99f1bb23c 100644
--- a/arch/sparc/include/asm/sbus_32.h
+++ b/arch/sparc/include/asm/sbus_32.h
@@ -109,8 +109,8 @@ extern void sbus_set_sbus64(struct sbus_dev *, int);
109extern void sbus_fill_device_irq(struct sbus_dev *); 109extern void sbus_fill_device_irq(struct sbus_dev *);
110 110
111/* These yield IOMMU mappings in consistent mode. */ 111/* These yield IOMMU mappings in consistent mode. */
112extern void *sbus_alloc_consistent(struct sbus_dev *, long, u32 *dma_addrp); 112extern void *sbus_alloc_consistent(struct device *, long, u32 *dma_addrp);
113extern void sbus_free_consistent(struct sbus_dev *, long, void *, u32); 113extern void sbus_free_consistent(struct device *, long, void *, u32);
114void prom_adjust_ranges(struct linux_prom_ranges *, int, 114void prom_adjust_ranges(struct linux_prom_ranges *, int,
115 struct linux_prom_ranges *, int); 115 struct linux_prom_ranges *, int);
116 116
@@ -120,18 +120,14 @@ void prom_adjust_ranges(struct linux_prom_ranges *, int,
120#define SBUS_DMA_NONE DMA_NONE 120#define SBUS_DMA_NONE DMA_NONE
121 121
122/* All the rest use streaming mode mappings. */ 122/* All the rest use streaming mode mappings. */
123extern dma_addr_t sbus_map_single(struct sbus_dev *, void *, size_t, int); 123extern dma_addr_t sbus_map_single(struct device *, void *, size_t, int);
124extern void sbus_unmap_single(struct sbus_dev *, dma_addr_t, size_t, int); 124extern void sbus_unmap_single(struct device *, dma_addr_t, size_t, int);
125extern int sbus_map_sg(struct sbus_dev *, struct scatterlist *, int, int); 125extern int sbus_map_sg(struct device *, struct scatterlist *, int, int);
126extern void sbus_unmap_sg(struct sbus_dev *, struct scatterlist *, int, int); 126extern void sbus_unmap_sg(struct device *, struct scatterlist *, int, int);
127 127
128/* Finally, allow explicit synchronization of streamable mappings. */ 128/* Finally, allow explicit synchronization of streamable mappings. */
129extern void sbus_dma_sync_single_for_cpu(struct sbus_dev *, dma_addr_t, size_t, int); 129extern void sbus_dma_sync_single_for_cpu(struct device *, dma_addr_t, size_t, int);
130#define sbus_dma_sync_single sbus_dma_sync_single_for_cpu 130extern void sbus_dma_sync_single_for_device(struct device *, dma_addr_t, size_t, int);
131extern void sbus_dma_sync_single_for_device(struct sbus_dev *, dma_addr_t, size_t, int);
132extern void sbus_dma_sync_sg_for_cpu(struct sbus_dev *, struct scatterlist *, int, int);
133#define sbus_dma_sync_sg sbus_dma_sync_sg_for_cpu
134extern void sbus_dma_sync_sg_for_device(struct sbus_dev *, struct scatterlist *, int, int);
135 131
136/* Eric Brower (ebrower@usa.net) 132/* Eric Brower (ebrower@usa.net)
137 * Translate SBus interrupt levels to ino values-- 133 * Translate SBus interrupt levels to ino values--
diff --git a/arch/sparc/include/asm/sbus_64.h b/arch/sparc/include/asm/sbus_64.h
index b606c14343fb..b22e99da49d8 100644
--- a/arch/sparc/include/asm/sbus_64.h
+++ b/arch/sparc/include/asm/sbus_64.h
@@ -100,17 +100,16 @@ extern struct sbus_bus *sbus_root;
100extern void sbus_set_sbus64(struct sbus_dev *, int); 100extern void sbus_set_sbus64(struct sbus_dev *, int);
101extern void sbus_fill_device_irq(struct sbus_dev *); 101extern void sbus_fill_device_irq(struct sbus_dev *);
102 102
103static inline void *sbus_alloc_consistent(struct sbus_dev *sdev , size_t size, 103static inline void *sbus_alloc_consistent(struct device *dev , size_t size,
104 dma_addr_t *dma_handle) 104 dma_addr_t *dma_handle)
105{ 105{
106 return dma_alloc_coherent(&sdev->ofdev.dev, size, 106 return dma_alloc_coherent(dev, size, dma_handle, GFP_ATOMIC);
107 dma_handle, GFP_ATOMIC);
108} 107}
109 108
110static inline void sbus_free_consistent(struct sbus_dev *sdev, size_t size, 109static inline void sbus_free_consistent(struct device *dev, size_t size,
111 void *vaddr, dma_addr_t dma_handle) 110 void *vaddr, dma_addr_t dma_handle)
112{ 111{
113 return dma_free_coherent(&sdev->ofdev.dev, size, vaddr, dma_handle); 112 return dma_free_coherent(dev, size, vaddr, dma_handle);
114} 113}
115 114
116#define SBUS_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL 115#define SBUS_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL
@@ -119,68 +118,51 @@ static inline void sbus_free_consistent(struct sbus_dev *sdev, size_t size,
119#define SBUS_DMA_NONE DMA_NONE 118#define SBUS_DMA_NONE DMA_NONE
120 119
121/* All the rest use streaming mode mappings. */ 120/* All the rest use streaming mode mappings. */
122static inline dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *ptr, 121static inline dma_addr_t sbus_map_single(struct device *dev, void *ptr,
123 size_t size, int direction) 122 size_t size, int direction)
124{ 123{
125 return dma_map_single(&sdev->ofdev.dev, ptr, size, 124 return dma_map_single(dev, ptr, size,
126 (enum dma_data_direction) direction); 125 (enum dma_data_direction) direction);
127} 126}
128 127
129static inline void sbus_unmap_single(struct sbus_dev *sdev, 128static inline void sbus_unmap_single(struct device *dev,
130 dma_addr_t dma_addr, size_t size, 129 dma_addr_t dma_addr, size_t size,
131 int direction) 130 int direction)
132{ 131{
133 dma_unmap_single(&sdev->ofdev.dev, dma_addr, size, 132 dma_unmap_single(dev, dma_addr, size,
134 (enum dma_data_direction) direction); 133 (enum dma_data_direction) direction);
135} 134}
136 135
137static inline int sbus_map_sg(struct sbus_dev *sdev, struct scatterlist *sg, 136static inline int sbus_map_sg(struct device *dev, struct scatterlist *sg,
138 int nents, int direction) 137 int nents, int direction)
139{ 138{
140 return dma_map_sg(&sdev->ofdev.dev, sg, nents, 139 return dma_map_sg(dev, sg, nents,
141 (enum dma_data_direction) direction); 140 (enum dma_data_direction) direction);
142} 141}
143 142
144static inline void sbus_unmap_sg(struct sbus_dev *sdev, struct scatterlist *sg, 143static inline void sbus_unmap_sg(struct device *dev, struct scatterlist *sg,
145 int nents, int direction) 144 int nents, int direction)
146{ 145{
147 dma_unmap_sg(&sdev->ofdev.dev, sg, nents, 146 dma_unmap_sg(dev, sg, nents,
148 (enum dma_data_direction) direction); 147 (enum dma_data_direction) direction);
149} 148}
150 149
151/* Finally, allow explicit synchronization of streamable mappings. */ 150/* Finally, allow explicit synchronization of streamable mappings. */
152static inline void sbus_dma_sync_single_for_cpu(struct sbus_dev *sdev, 151static inline void sbus_dma_sync_single_for_cpu(struct device *dev,
153 dma_addr_t dma_handle, 152 dma_addr_t dma_handle,
154 size_t size, int direction) 153 size_t size, int direction)
155{ 154{
156 dma_sync_single_for_cpu(&sdev->ofdev.dev, dma_handle, size, 155 dma_sync_single_for_cpu(dev, dma_handle, size,
157 (enum dma_data_direction) direction); 156 (enum dma_data_direction) direction);
158} 157}
159#define sbus_dma_sync_single sbus_dma_sync_single_for_cpu
160 158
161static inline void sbus_dma_sync_single_for_device(struct sbus_dev *sdev, 159static inline void sbus_dma_sync_single_for_device(struct device *dev,
162 dma_addr_t dma_handle, 160 dma_addr_t dma_handle,
163 size_t size, int direction) 161 size_t size, int direction)
164{ 162{
165 /* No flushing needed to sync cpu writes to the device. */ 163 /* No flushing needed to sync cpu writes to the device. */
166} 164}
167 165
168static inline void sbus_dma_sync_sg_for_cpu(struct sbus_dev *sdev,
169 struct scatterlist *sg,
170 int nents, int direction)
171{
172 dma_sync_sg_for_cpu(&sdev->ofdev.dev, sg, nents,
173 (enum dma_data_direction) direction);
174}
175#define sbus_dma_sync_sg sbus_dma_sync_sg_for_cpu
176
177static inline void sbus_dma_sync_sg_for_device(struct sbus_dev *sdev,
178 struct scatterlist *sg,
179 int nents, int direction)
180{
181 /* No flushing needed to sync cpu writes to the device. */
182}
183
184extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *); 166extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *);
185extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *); 167extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *);
186extern void sbus_setup_arch_props(struct sbus_bus *, struct device_node *); 168extern void sbus_setup_arch_props(struct sbus_bus *, struct device_node *);
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index f6158c4a3995..aa73b3b71e85 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -300,11 +300,10 @@ void __init sbus_fill_device_irq(struct sbus_dev *sdev)
300 * Allocate a chunk of memory suitable for DMA. 300 * Allocate a chunk of memory suitable for DMA.
301 * Typically devices use them for control blocks. 301 * Typically devices use them for control blocks.
302 * CPU may access them without any explicit flushing. 302 * CPU may access them without any explicit flushing.
303 *
304 * XXX Some clever people know that sdev is not used and supply NULL. Watch.
305 */ 303 */
306void *sbus_alloc_consistent(struct sbus_dev *sdev, long len, u32 *dma_addrp) 304void *sbus_alloc_consistent(struct device *dev, long len, u32 *dma_addrp)
307{ 305{
306 struct of_device *op = to_of_device(dev);
308 unsigned long len_total = (len + PAGE_SIZE-1) & PAGE_MASK; 307 unsigned long len_total = (len + PAGE_SIZE-1) & PAGE_MASK;
309 unsigned long va; 308 unsigned long va;
310 struct resource *res; 309 struct resource *res;
@@ -341,10 +340,7 @@ void *sbus_alloc_consistent(struct sbus_dev *sdev, long len, u32 *dma_addrp)
341 if (mmu_map_dma_area(dma_addrp, va, res->start, len_total) != 0) 340 if (mmu_map_dma_area(dma_addrp, va, res->start, len_total) != 0)
342 goto err_noiommu; 341 goto err_noiommu;
343 342
344 /* Set the resource name, if known. */ 343 res->name = op->node->name;
345 if (sdev) {
346 res->name = sdev->prom_name;
347 }
348 344
349 return (void *)(unsigned long)res->start; 345 return (void *)(unsigned long)res->start;
350 346
@@ -358,7 +354,7 @@ err_nopages:
358 return NULL; 354 return NULL;
359} 355}
360 356
361void sbus_free_consistent(struct sbus_dev *sdev, long n, void *p, u32 ba) 357void sbus_free_consistent(struct device *dev, long n, void *p, u32 ba)
362{ 358{
363 struct resource *res; 359 struct resource *res;
364 struct page *pgv; 360 struct page *pgv;
@@ -396,8 +392,10 @@ void sbus_free_consistent(struct sbus_dev *sdev, long n, void *p, u32 ba)
396 * CPU view of this memory may be inconsistent with 392 * CPU view of this memory may be inconsistent with
397 * a device view and explicit flushing is necessary. 393 * a device view and explicit flushing is necessary.
398 */ 394 */
399dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *va, size_t len, int direction) 395dma_addr_t sbus_map_single(struct device *dev, void *va, size_t len, int direction)
400{ 396{
397 struct sbus_dev *sdev = to_sbus_device(dev);
398
401 /* XXX why are some lengths signed, others unsigned? */ 399 /* XXX why are some lengths signed, others unsigned? */
402 if (len <= 0) { 400 if (len <= 0) {
403 return 0; 401 return 0;
@@ -409,13 +407,16 @@ dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *va, size_t len, int dire
409 return mmu_get_scsi_one(va, len, sdev->bus); 407 return mmu_get_scsi_one(va, len, sdev->bus);
410} 408}
411 409
412void sbus_unmap_single(struct sbus_dev *sdev, dma_addr_t ba, size_t n, int direction) 410void sbus_unmap_single(struct device *dev, dma_addr_t ba, size_t n, int direction)
413{ 411{
412 struct sbus_dev *sdev = to_sbus_device(dev);
414 mmu_release_scsi_one(ba, n, sdev->bus); 413 mmu_release_scsi_one(ba, n, sdev->bus);
415} 414}
416 415
417int sbus_map_sg(struct sbus_dev *sdev, struct scatterlist *sg, int n, int direction) 416int sbus_map_sg(struct device *dev, struct scatterlist *sg, int n, int direction)
418{ 417{
418 struct sbus_dev *sdev = to_sbus_device(dev);
419
419 mmu_get_scsi_sgl(sg, n, sdev->bus); 420 mmu_get_scsi_sgl(sg, n, sdev->bus);
420 421
421 /* 422 /*
@@ -425,16 +426,19 @@ int sbus_map_sg(struct sbus_dev *sdev, struct scatterlist *sg, int n, int direct
425 return n; 426 return n;
426} 427}
427 428
428void sbus_unmap_sg(struct sbus_dev *sdev, struct scatterlist *sg, int n, int direction) 429void sbus_unmap_sg(struct device *dev, struct scatterlist *sg, int n, int direction)
429{ 430{
431 struct sbus_dev *sdev = to_sbus_device(dev);
432
430 mmu_release_scsi_sgl(sg, n, sdev->bus); 433 mmu_release_scsi_sgl(sg, n, sdev->bus);
431} 434}
432 435
433/* 436/*
434 */ 437 */
435void sbus_dma_sync_single_for_cpu(struct sbus_dev *sdev, dma_addr_t ba, size_t size, int direction) 438void sbus_dma_sync_single_for_cpu(struct device *dev, dma_addr_t ba, size_t size, int direction)
436{ 439{
437#if 0 440#if 0
441 struct sbus_dev *sdev = to_sbus_device(dev);
438 unsigned long va; 442 unsigned long va;
439 struct resource *res; 443 struct resource *res;
440 444
@@ -452,9 +456,10 @@ void sbus_dma_sync_single_for_cpu(struct sbus_dev *sdev, dma_addr_t ba, size_t s
452#endif 456#endif
453} 457}
454 458
455void sbus_dma_sync_single_for_device(struct sbus_dev *sdev, dma_addr_t ba, size_t size, int direction) 459void sbus_dma_sync_single_for_device(struct device *dev, dma_addr_t ba, size_t size, int direction)
456{ 460{
457#if 0 461#if 0
462 struct sbus_dev *sdev = to_sbus_device(dev);
458 unsigned long va; 463 unsigned long va;
459 struct resource *res; 464 struct resource *res;
460 465
@@ -472,16 +477,6 @@ void sbus_dma_sync_single_for_device(struct sbus_dev *sdev, dma_addr_t ba, size_
472#endif 477#endif
473} 478}
474 479
475void sbus_dma_sync_sg_for_cpu(struct sbus_dev *sdev, struct scatterlist *sg, int n, int direction)
476{
477 printk("sbus_dma_sync_sg_for_cpu: not implemented yet\n");
478}
479
480void sbus_dma_sync_sg_for_device(struct sbus_dev *sdev, struct scatterlist *sg, int n, int direction)
481{
482 printk("sbus_dma_sync_sg_for_device: not implemented yet\n");
483}
484
485/* Support code for sbus_init(). */ 480/* Support code for sbus_init(). */
486/* 481/*
487 * XXX This functions appears to be a distorted version of 482 * XXX This functions appears to be a distorted version of
diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c
index 8a392d3d89e4..9d85a83586a1 100644
--- a/arch/sparc/kernel/sparc_ksyms.c
+++ b/arch/sparc/kernel/sparc_ksyms.c
@@ -163,8 +163,6 @@ EXPORT_SYMBOL(sbus_map_sg);
163EXPORT_SYMBOL(sbus_unmap_sg); 163EXPORT_SYMBOL(sbus_unmap_sg);
164EXPORT_SYMBOL(sbus_dma_sync_single_for_cpu); 164EXPORT_SYMBOL(sbus_dma_sync_single_for_cpu);
165EXPORT_SYMBOL(sbus_dma_sync_single_for_device); 165EXPORT_SYMBOL(sbus_dma_sync_single_for_device);
166EXPORT_SYMBOL(sbus_dma_sync_sg_for_cpu);
167EXPORT_SYMBOL(sbus_dma_sync_sg_for_device);
168EXPORT_SYMBOL(sbus_iounmap); 166EXPORT_SYMBOL(sbus_iounmap);
169EXPORT_SYMBOL(sbus_ioremap); 167EXPORT_SYMBOL(sbus_ioremap);
170#endif 168#endif
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c
index 8e6ac5c1b7bd..1c56c8b854d5 100644
--- a/arch/sparc64/kernel/sparc64_ksyms.c
+++ b/arch/sparc64/kernel/sparc64_ksyms.c
@@ -170,8 +170,6 @@ EXPORT_SYMBOL(sbus_map_sg);
170EXPORT_SYMBOL(sbus_unmap_sg); 170EXPORT_SYMBOL(sbus_unmap_sg);
171EXPORT_SYMBOL(sbus_dma_sync_single_for_cpu); 171EXPORT_SYMBOL(sbus_dma_sync_single_for_cpu);
172EXPORT_SYMBOL(sbus_dma_sync_single_for_device); 172EXPORT_SYMBOL(sbus_dma_sync_single_for_device);
173EXPORT_SYMBOL(sbus_dma_sync_sg_for_cpu);
174EXPORT_SYMBOL(sbus_dma_sync_sg_for_device);
175#endif 173#endif
176EXPORT_SYMBOL(outsb); 174EXPORT_SYMBOL(outsb);
177EXPORT_SYMBOL(outsw); 175EXPORT_SYMBOL(outsw);
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);
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
index f5d6d8d12979..cc803972c0fb 100644
--- a/sound/core/memalloc.c
+++ b/sound/core/memalloc.c
@@ -192,7 +192,8 @@ static void *snd_malloc_sbus_pages(struct device *dev, size_t size,
192 snd_assert(size > 0, return NULL); 192 snd_assert(size > 0, return NULL);
193 snd_assert(dma_addr != NULL, return NULL); 193 snd_assert(dma_addr != NULL, return NULL);
194 pg = get_order(size); 194 pg = get_order(size);
195 res = sbus_alloc_consistent(sdev, PAGE_SIZE * (1 << pg), dma_addr); 195 res = sbus_alloc_consistent(&sdev->ofdev.dev, PAGE_SIZE * (1 << pg),
196 dma_addr);
196 if (res != NULL) 197 if (res != NULL)
197 inc_snd_pages(pg); 198 inc_snd_pages(pg);
198 return res; 199 return res;
@@ -208,7 +209,8 @@ static void snd_free_sbus_pages(struct device *dev, size_t size,
208 return; 209 return;
209 pg = get_order(size); 210 pg = get_order(size);
210 dec_snd_pages(pg); 211 dec_snd_pages(pg);
211 sbus_free_consistent(sdev, PAGE_SIZE * (1 << pg), ptr, dma_addr); 212 sbus_free_consistent(&sdev->ofdev.dev, PAGE_SIZE * (1 << pg),
213 ptr, dma_addr);
212} 214}
213 215
214#endif /* CONFIG_SBUS */ 216#endif /* CONFIG_SBUS */
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c
index ee2e1b4f3551..a6b32ec34bde 100644
--- a/sound/sparc/dbri.c
+++ b/sound/sparc/dbri.c
@@ -2097,7 +2097,8 @@ static int snd_dbri_hw_params(struct snd_pcm_substream *substream,
2097 else 2097 else
2098 direction = SBUS_DMA_FROMDEVICE; 2098 direction = SBUS_DMA_FROMDEVICE;
2099 2099
2100 info->dvma_buffer = sbus_map_single(dbri->sdev, 2100 info->dvma_buffer =
2101 sbus_map_single(&dbri->sdev->ofdev.dev,
2101 runtime->dma_area, 2102 runtime->dma_area,
2102 params_buffer_bytes(hw_params), 2103 params_buffer_bytes(hw_params),
2103 direction); 2104 direction);
@@ -2125,7 +2126,7 @@ static int snd_dbri_hw_free(struct snd_pcm_substream *substream)
2125 else 2126 else
2126 direction = SBUS_DMA_FROMDEVICE; 2127 direction = SBUS_DMA_FROMDEVICE;
2127 2128
2128 sbus_unmap_single(dbri->sdev, info->dvma_buffer, 2129 sbus_unmap_single(&dbri->sdev->ofdev.dev, info->dvma_buffer,
2129 substream->runtime->buffer_size, direction); 2130 substream->runtime->buffer_size, direction);
2130 info->dvma_buffer = 0; 2131 info->dvma_buffer = 0;
2131 } 2132 }
@@ -2524,7 +2525,8 @@ static int __devinit snd_dbri_create(struct snd_card *card,
2524 dbri->sdev = sdev; 2525 dbri->sdev = sdev;
2525 dbri->irq = irq; 2526 dbri->irq = irq;
2526 2527
2527 dbri->dma = sbus_alloc_consistent(sdev, sizeof(struct dbri_dma), 2528 dbri->dma = sbus_alloc_consistent(&sdev->ofdev.dev,
2529 sizeof(struct dbri_dma),
2528 &dbri->dma_dvma); 2530 &dbri->dma_dvma);
2529 memset((void *)dbri->dma, 0, sizeof(struct dbri_dma)); 2531 memset((void *)dbri->dma, 0, sizeof(struct dbri_dma));
2530 2532
@@ -2537,7 +2539,7 @@ static int __devinit snd_dbri_create(struct snd_card *card,
2537 dbri->regs_size, "DBRI Registers"); 2539 dbri->regs_size, "DBRI Registers");
2538 if (!dbri->regs) { 2540 if (!dbri->regs) {
2539 printk(KERN_ERR "DBRI: could not allocate registers\n"); 2541 printk(KERN_ERR "DBRI: could not allocate registers\n");
2540 sbus_free_consistent(sdev, sizeof(struct dbri_dma), 2542 sbus_free_consistent(&sdev->ofdev.dev, sizeof(struct dbri_dma),
2541 (void *)dbri->dma, dbri->dma_dvma); 2543 (void *)dbri->dma, dbri->dma_dvma);
2542 return -EIO; 2544 return -EIO;
2543 } 2545 }
@@ -2547,7 +2549,7 @@ static int __devinit snd_dbri_create(struct snd_card *card,
2547 if (err) { 2549 if (err) {
2548 printk(KERN_ERR "DBRI: Can't get irq %d\n", dbri->irq); 2550 printk(KERN_ERR "DBRI: Can't get irq %d\n", dbri->irq);
2549 sbus_iounmap(dbri->regs, dbri->regs_size); 2551 sbus_iounmap(dbri->regs, dbri->regs_size);
2550 sbus_free_consistent(sdev, sizeof(struct dbri_dma), 2552 sbus_free_consistent(&sdev->ofdev.dev, sizeof(struct dbri_dma),
2551 (void *)dbri->dma, dbri->dma_dvma); 2553 (void *)dbri->dma, dbri->dma_dvma);
2552 return err; 2554 return err;
2553 } 2555 }
@@ -2575,7 +2577,8 @@ static void snd_dbri_free(struct snd_dbri *dbri)
2575 sbus_iounmap(dbri->regs, dbri->regs_size); 2577 sbus_iounmap(dbri->regs, dbri->regs_size);
2576 2578
2577 if (dbri->dma) 2579 if (dbri->dma)
2578 sbus_free_consistent(dbri->sdev, sizeof(struct dbri_dma), 2580 sbus_free_consistent(&dbri->sdev->ofdev.dev,
2581 sizeof(struct dbri_dma),
2579 (void *)dbri->dma, dbri->dma_dvma); 2582 (void *)dbri->dma, dbri->dma_dvma);
2580} 2583}
2581 2584