diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2009-08-09 22:53:12 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-10 03:34:58 -0400 |
commit | bc0a14f154069cc4e42ea903c2c2b9984a94e4b7 (patch) | |
tree | 85b1baa32fbb42d094c66b51ee3e576e77298d29 /arch/sparc/kernel | |
parent | be02ff9940c0106dea1470462401a07c5d52e086 (diff) |
sparc: Use dma_map_ops struct
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Tested-by: Robert Reif <reif@earthlink.net>
Acked-by: David S. Miller <davem@davemloft.net>
Cc: tony.luck@intel.com
Cc: fenghua.yu@intel.com
LKML-Reference: <1249872797-1314-4-git-send-email-fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/sparc/kernel')
-rw-r--r-- | arch/sparc/kernel/dma.c | 16 | ||||
-rw-r--r-- | arch/sparc/kernel/iommu.c | 16 | ||||
-rw-r--r-- | arch/sparc/kernel/pci_sun4v.c | 14 |
3 files changed, 29 insertions, 17 deletions
diff --git a/arch/sparc/kernel/dma.c b/arch/sparc/kernel/dma.c index 524c32f97c55..473a3fc7ab5b 100644 --- a/arch/sparc/kernel/dma.c +++ b/arch/sparc/kernel/dma.c | |||
@@ -60,7 +60,8 @@ static void dma32_free_coherent(struct device *dev, size_t size, | |||
60 | 60 | ||
61 | static dma_addr_t dma32_map_page(struct device *dev, struct page *page, | 61 | static dma_addr_t dma32_map_page(struct device *dev, struct page *page, |
62 | unsigned long offset, size_t size, | 62 | unsigned long offset, size_t size, |
63 | enum dma_data_direction direction) | 63 | enum dma_data_direction direction, |
64 | struct dma_attrs *attrs) | ||
64 | { | 65 | { |
65 | #ifdef CONFIG_PCI | 66 | #ifdef CONFIG_PCI |
66 | if (dev->bus == &pci_bus_type) | 67 | if (dev->bus == &pci_bus_type) |
@@ -72,7 +73,8 @@ static dma_addr_t dma32_map_page(struct device *dev, struct page *page, | |||
72 | } | 73 | } |
73 | 74 | ||
74 | static void dma32_unmap_page(struct device *dev, dma_addr_t dma_address, | 75 | static void dma32_unmap_page(struct device *dev, dma_addr_t dma_address, |
75 | size_t size, enum dma_data_direction direction) | 76 | size_t size, enum dma_data_direction direction, |
77 | struct dma_attrs *attrs) | ||
76 | { | 78 | { |
77 | #ifdef CONFIG_PCI | 79 | #ifdef CONFIG_PCI |
78 | if (dev->bus == &pci_bus_type) { | 80 | if (dev->bus == &pci_bus_type) { |
@@ -85,7 +87,8 @@ static void dma32_unmap_page(struct device *dev, dma_addr_t dma_address, | |||
85 | } | 87 | } |
86 | 88 | ||
87 | static int dma32_map_sg(struct device *dev, struct scatterlist *sg, | 89 | static int dma32_map_sg(struct device *dev, struct scatterlist *sg, |
88 | int nents, enum dma_data_direction direction) | 90 | int nents, enum dma_data_direction direction, |
91 | struct dma_attrs *attrs) | ||
89 | { | 92 | { |
90 | #ifdef CONFIG_PCI | 93 | #ifdef CONFIG_PCI |
91 | if (dev->bus == &pci_bus_type) | 94 | if (dev->bus == &pci_bus_type) |
@@ -95,7 +98,8 @@ static int dma32_map_sg(struct device *dev, struct scatterlist *sg, | |||
95 | } | 98 | } |
96 | 99 | ||
97 | void dma32_unmap_sg(struct device *dev, struct scatterlist *sg, | 100 | void dma32_unmap_sg(struct device *dev, struct scatterlist *sg, |
98 | int nents, enum dma_data_direction direction) | 101 | int nents, enum dma_data_direction direction, |
102 | struct dma_attrs *attrs) | ||
99 | { | 103 | { |
100 | #ifdef CONFIG_PCI | 104 | #ifdef CONFIG_PCI |
101 | if (dev->bus == &pci_bus_type) { | 105 | if (dev->bus == &pci_bus_type) { |
@@ -161,7 +165,7 @@ static void dma32_sync_sg_for_device(struct device *dev, | |||
161 | BUG(); | 165 | BUG(); |
162 | } | 166 | } |
163 | 167 | ||
164 | static const struct dma_ops dma32_dma_ops = { | 168 | static const struct dma_map_ops dma32_dma_ops = { |
165 | .alloc_coherent = dma32_alloc_coherent, | 169 | .alloc_coherent = dma32_alloc_coherent, |
166 | .free_coherent = dma32_free_coherent, | 170 | .free_coherent = dma32_free_coherent, |
167 | .map_page = dma32_map_page, | 171 | .map_page = dma32_map_page, |
@@ -174,5 +178,5 @@ static const struct dma_ops dma32_dma_ops = { | |||
174 | .sync_sg_for_device = dma32_sync_sg_for_device, | 178 | .sync_sg_for_device = dma32_sync_sg_for_device, |
175 | }; | 179 | }; |
176 | 180 | ||
177 | const struct dma_ops *dma_ops = &dma32_dma_ops; | 181 | const struct dma_map_ops *dma_ops = &dma32_dma_ops; |
178 | EXPORT_SYMBOL(dma_ops); | 182 | EXPORT_SYMBOL(dma_ops); |
diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c index 0aeaefe696b9..a9f0ad955186 100644 --- a/arch/sparc/kernel/iommu.c +++ b/arch/sparc/kernel/iommu.c | |||
@@ -353,7 +353,8 @@ static void dma_4u_free_coherent(struct device *dev, size_t size, | |||
353 | 353 | ||
354 | static dma_addr_t dma_4u_map_page(struct device *dev, struct page *page, | 354 | static dma_addr_t dma_4u_map_page(struct device *dev, struct page *page, |
355 | unsigned long offset, size_t sz, | 355 | unsigned long offset, size_t sz, |
356 | enum dma_data_direction direction) | 356 | enum dma_data_direction direction, |
357 | struct dma_attrs *attrs) | ||
357 | { | 358 | { |
358 | struct iommu *iommu; | 359 | struct iommu *iommu; |
359 | struct strbuf *strbuf; | 360 | struct strbuf *strbuf; |
@@ -474,7 +475,8 @@ do_flush_sync: | |||
474 | } | 475 | } |
475 | 476 | ||
476 | static void dma_4u_unmap_page(struct device *dev, dma_addr_t bus_addr, | 477 | static void dma_4u_unmap_page(struct device *dev, dma_addr_t bus_addr, |
477 | size_t sz, enum dma_data_direction direction) | 478 | size_t sz, enum dma_data_direction direction, |
479 | struct dma_attrs *attrs) | ||
478 | { | 480 | { |
479 | struct iommu *iommu; | 481 | struct iommu *iommu; |
480 | struct strbuf *strbuf; | 482 | struct strbuf *strbuf; |
@@ -520,7 +522,8 @@ static void dma_4u_unmap_page(struct device *dev, dma_addr_t bus_addr, | |||
520 | } | 522 | } |
521 | 523 | ||
522 | static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist, | 524 | static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist, |
523 | int nelems, enum dma_data_direction direction) | 525 | int nelems, enum dma_data_direction direction, |
526 | struct dma_attrs *attrs) | ||
524 | { | 527 | { |
525 | struct scatterlist *s, *outs, *segstart; | 528 | struct scatterlist *s, *outs, *segstart; |
526 | unsigned long flags, handle, prot, ctx; | 529 | unsigned long flags, handle, prot, ctx; |
@@ -691,7 +694,8 @@ static unsigned long fetch_sg_ctx(struct iommu *iommu, struct scatterlist *sg) | |||
691 | } | 694 | } |
692 | 695 | ||
693 | static void dma_4u_unmap_sg(struct device *dev, struct scatterlist *sglist, | 696 | static void dma_4u_unmap_sg(struct device *dev, struct scatterlist *sglist, |
694 | int nelems, enum dma_data_direction direction) | 697 | int nelems, enum dma_data_direction direction, |
698 | struct dma_attrs *attrs) | ||
695 | { | 699 | { |
696 | unsigned long flags, ctx; | 700 | unsigned long flags, ctx; |
697 | struct scatterlist *sg; | 701 | struct scatterlist *sg; |
@@ -822,7 +826,7 @@ static void dma_4u_sync_sg_for_cpu(struct device *dev, | |||
822 | spin_unlock_irqrestore(&iommu->lock, flags); | 826 | spin_unlock_irqrestore(&iommu->lock, flags); |
823 | } | 827 | } |
824 | 828 | ||
825 | static const struct dma_ops sun4u_dma_ops = { | 829 | static const struct dma_map_ops sun4u_dma_ops = { |
826 | .alloc_coherent = dma_4u_alloc_coherent, | 830 | .alloc_coherent = dma_4u_alloc_coherent, |
827 | .free_coherent = dma_4u_free_coherent, | 831 | .free_coherent = dma_4u_free_coherent, |
828 | .map_page = dma_4u_map_page, | 832 | .map_page = dma_4u_map_page, |
@@ -833,7 +837,7 @@ static const struct dma_ops sun4u_dma_ops = { | |||
833 | .sync_sg_for_cpu = dma_4u_sync_sg_for_cpu, | 837 | .sync_sg_for_cpu = dma_4u_sync_sg_for_cpu, |
834 | }; | 838 | }; |
835 | 839 | ||
836 | const struct dma_ops *dma_ops = &sun4u_dma_ops; | 840 | const struct dma_map_ops *dma_ops = &sun4u_dma_ops; |
837 | EXPORT_SYMBOL(dma_ops); | 841 | EXPORT_SYMBOL(dma_ops); |
838 | 842 | ||
839 | int dma_supported(struct device *dev, u64 device_mask) | 843 | int dma_supported(struct device *dev, u64 device_mask) |
diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c index 2485eaa23101..c4f7dce577dd 100644 --- a/arch/sparc/kernel/pci_sun4v.c +++ b/arch/sparc/kernel/pci_sun4v.c | |||
@@ -232,7 +232,8 @@ static void dma_4v_free_coherent(struct device *dev, size_t size, void *cpu, | |||
232 | 232 | ||
233 | static dma_addr_t dma_4v_map_page(struct device *dev, struct page *page, | 233 | static dma_addr_t dma_4v_map_page(struct device *dev, struct page *page, |
234 | unsigned long offset, size_t sz, | 234 | unsigned long offset, size_t sz, |
235 | enum dma_data_direction direction) | 235 | enum dma_data_direction direction, |
236 | struct dma_attrs *attrs) | ||
236 | { | 237 | { |
237 | struct iommu *iommu; | 238 | struct iommu *iommu; |
238 | unsigned long flags, npages, oaddr; | 239 | unsigned long flags, npages, oaddr; |
@@ -296,7 +297,8 @@ iommu_map_fail: | |||
296 | } | 297 | } |
297 | 298 | ||
298 | static void dma_4v_unmap_page(struct device *dev, dma_addr_t bus_addr, | 299 | static void dma_4v_unmap_page(struct device *dev, dma_addr_t bus_addr, |
299 | size_t sz, enum dma_data_direction direction) | 300 | size_t sz, enum dma_data_direction direction, |
301 | struct dma_attrs *attrs) | ||
300 | { | 302 | { |
301 | struct pci_pbm_info *pbm; | 303 | struct pci_pbm_info *pbm; |
302 | struct iommu *iommu; | 304 | struct iommu *iommu; |
@@ -336,7 +338,8 @@ static void dma_4v_unmap_page(struct device *dev, dma_addr_t bus_addr, | |||
336 | } | 338 | } |
337 | 339 | ||
338 | static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist, | 340 | static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist, |
339 | int nelems, enum dma_data_direction direction) | 341 | int nelems, enum dma_data_direction direction, |
342 | struct dma_attrs *attrs) | ||
340 | { | 343 | { |
341 | struct scatterlist *s, *outs, *segstart; | 344 | struct scatterlist *s, *outs, *segstart; |
342 | unsigned long flags, handle, prot; | 345 | unsigned long flags, handle, prot; |
@@ -478,7 +481,8 @@ iommu_map_failed: | |||
478 | } | 481 | } |
479 | 482 | ||
480 | static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist, | 483 | static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist, |
481 | int nelems, enum dma_data_direction direction) | 484 | int nelems, enum dma_data_direction direction, |
485 | struct dma_attrs *attrs) | ||
482 | { | 486 | { |
483 | struct pci_pbm_info *pbm; | 487 | struct pci_pbm_info *pbm; |
484 | struct scatterlist *sg; | 488 | struct scatterlist *sg; |
@@ -535,7 +539,7 @@ static void dma_4v_sync_sg_for_cpu(struct device *dev, | |||
535 | /* Nothing to do... */ | 539 | /* Nothing to do... */ |
536 | } | 540 | } |
537 | 541 | ||
538 | static const struct dma_ops sun4v_dma_ops = { | 542 | static const struct dma_map_ops sun4v_dma_ops = { |
539 | .alloc_coherent = dma_4v_alloc_coherent, | 543 | .alloc_coherent = dma_4v_alloc_coherent, |
540 | .free_coherent = dma_4v_free_coherent, | 544 | .free_coherent = dma_4v_free_coherent, |
541 | .map_page = dma_4v_map_page, | 545 | .map_page = dma_4v_map_page, |