diff options
author | Christoph Hellwig <hch@lst.de> | 2017-08-25 11:13:09 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2017-09-01 05:59:17 -0400 |
commit | 2436bdcda53ff4abb7897c87fa29ef3de8055344 (patch) | |
tree | aa9204da61d1e888fea12ac09c948f5d77e793c5 | |
parent | b32dbc1e0bf0eaa8bdd725491b361d5fc2f57a85 (diff) |
dma-coherent: remove the DMA_MEMORY_MAP and DMA_MEMORY_IO flags
DMA_MEMORY_IO was never used in the tree, so remove it. That means there is
no need for the DMA_MEMORY_MAP flag either now, so remove it as well and
change dma_declare_coherent_memory to return a normal errno value.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com>
-rw-r--r-- | Documentation/DMA-API.txt | 21 | ||||
-rw-r--r-- | arch/arm/mach-imx/mach-imx27_visstrim_m10.c | 44 | ||||
-rw-r--r-- | arch/arm/mach-imx/mach-mx31moboard.c | 12 | ||||
-rw-r--r-- | arch/sh/drivers/pci/fixups-dreamcast.c | 3 | ||||
-rw-r--r-- | drivers/base/dma-coherent.c | 46 | ||||
-rw-r--r-- | drivers/base/dma-mapping.c | 7 | ||||
-rw-r--r-- | drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c | 5 | ||||
-rw-r--r-- | drivers/scsi/NCR_Q720.c | 3 | ||||
-rw-r--r-- | drivers/usb/host/ohci-sm501.c | 7 | ||||
-rw-r--r-- | drivers/usb/host/ohci-tmio.c | 9 | ||||
-rw-r--r-- | include/linux/dma-mapping.h | 6 |
11 files changed, 52 insertions, 111 deletions
diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt index dddf52e768d6..ac66ae2509a9 100644 --- a/Documentation/DMA-API.txt +++ b/Documentation/DMA-API.txt | |||
@@ -592,30 +592,11 @@ size is the size of the area (must be multiples of PAGE_SIZE). | |||
592 | 592 | ||
593 | flags can be ORed together and are: | 593 | flags can be ORed together and are: |
594 | 594 | ||
595 | - DMA_MEMORY_MAP - request that the memory returned from | ||
596 | dma_alloc_coherent() be directly writable. | ||
597 | |||
598 | - DMA_MEMORY_IO - request that the memory returned from | ||
599 | dma_alloc_coherent() be addressable using read()/write()/memcpy_toio() etc. | ||
600 | |||
601 | One or both of these flags must be present. | ||
602 | |||
603 | - DMA_MEMORY_EXCLUSIVE - only allocate memory from the declared regions. | 595 | - DMA_MEMORY_EXCLUSIVE - only allocate memory from the declared regions. |
604 | Do not allow dma_alloc_coherent() to fall back to system memory when | 596 | Do not allow dma_alloc_coherent() to fall back to system memory when |
605 | it's out of memory in the declared region. | 597 | it's out of memory in the declared region. |
606 | 598 | ||
607 | The return value will be either DMA_MEMORY_MAP or DMA_MEMORY_IO and | 599 | As a simplification for the platforms, only *one* such region of |
608 | must correspond to a passed in flag (i.e. no returning DMA_MEMORY_IO | ||
609 | if only DMA_MEMORY_MAP were passed in) for success or zero for | ||
610 | failure. | ||
611 | |||
612 | Note, for DMA_MEMORY_IO returns, all subsequent memory returned by | ||
613 | dma_alloc_coherent() may no longer be accessed directly, but instead | ||
614 | must be accessed using the correct bus functions. If your driver | ||
615 | isn't prepared to handle this contingency, it should not specify | ||
616 | DMA_MEMORY_IO in the input flags. | ||
617 | |||
618 | As a simplification for the platforms, only **one** such region of | ||
619 | memory may be declared per device. | 600 | memory may be declared per device. |
620 | 601 | ||
621 | For reasons of efficiency, most platforms choose to track the declared | 602 | For reasons of efficiency, most platforms choose to track the declared |
diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c index dd75a4756761..5169dfba9718 100644 --- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c +++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c | |||
@@ -245,7 +245,6 @@ static phys_addr_t mx2_camera_base __initdata; | |||
245 | static void __init visstrim_analog_camera_init(void) | 245 | static void __init visstrim_analog_camera_init(void) |
246 | { | 246 | { |
247 | struct platform_device *pdev; | 247 | struct platform_device *pdev; |
248 | int dma; | ||
249 | 248 | ||
250 | gpio_set_value(TVP5150_PWDN, 1); | 249 | gpio_set_value(TVP5150_PWDN, 1); |
251 | ndelay(1); | 250 | ndelay(1); |
@@ -258,12 +257,9 @@ static void __init visstrim_analog_camera_init(void) | |||
258 | if (IS_ERR(pdev)) | 257 | if (IS_ERR(pdev)) |
259 | return; | 258 | return; |
260 | 259 | ||
261 | dma = dma_declare_coherent_memory(&pdev->dev, | 260 | dma_declare_coherent_memory(&pdev->dev, mx2_camera_base, |
262 | mx2_camera_base, mx2_camera_base, | 261 | mx2_camera_base, MX2_CAMERA_BUF_SIZE, |
263 | MX2_CAMERA_BUF_SIZE, | 262 | DMA_MEMORY_EXCLUSIVE); |
264 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); | ||
265 | if (!(dma & DMA_MEMORY_MAP)) | ||
266 | return; | ||
267 | } | 263 | } |
268 | 264 | ||
269 | static void __init visstrim_reserve(void) | 265 | static void __init visstrim_reserve(void) |
@@ -444,16 +440,13 @@ static const struct imx_ssi_platform_data visstrim_m10_ssi_pdata __initconst = { | |||
444 | static void __init visstrim_coda_init(void) | 440 | static void __init visstrim_coda_init(void) |
445 | { | 441 | { |
446 | struct platform_device *pdev; | 442 | struct platform_device *pdev; |
447 | int dma; | ||
448 | 443 | ||
449 | pdev = imx27_add_coda(); | 444 | pdev = imx27_add_coda(); |
450 | dma = dma_declare_coherent_memory(&pdev->dev, | 445 | dma_declare_coherent_memory(&pdev->dev, |
451 | mx2_camera_base + MX2_CAMERA_BUF_SIZE, | 446 | mx2_camera_base + MX2_CAMERA_BUF_SIZE, |
452 | mx2_camera_base + MX2_CAMERA_BUF_SIZE, | 447 | mx2_camera_base + MX2_CAMERA_BUF_SIZE, |
453 | MX2_CAMERA_BUF_SIZE, | 448 | MX2_CAMERA_BUF_SIZE, |
454 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); | 449 | DMA_MEMORY_EXCLUSIVE); |
455 | if (!(dma & DMA_MEMORY_MAP)) | ||
456 | return; | ||
457 | } | 450 | } |
458 | 451 | ||
459 | /* DMA deinterlace */ | 452 | /* DMA deinterlace */ |
@@ -466,24 +459,21 @@ static void __init visstrim_deinterlace_init(void) | |||
466 | { | 459 | { |
467 | int ret = -ENOMEM; | 460 | int ret = -ENOMEM; |
468 | struct platform_device *pdev = &visstrim_deinterlace; | 461 | struct platform_device *pdev = &visstrim_deinterlace; |
469 | int dma; | ||
470 | 462 | ||
471 | ret = platform_device_register(pdev); | 463 | ret = platform_device_register(pdev); |
472 | 464 | ||
473 | dma = dma_declare_coherent_memory(&pdev->dev, | 465 | dma_declare_coherent_memory(&pdev->dev, |
474 | mx2_camera_base + 2 * MX2_CAMERA_BUF_SIZE, | 466 | mx2_camera_base + 2 * MX2_CAMERA_BUF_SIZE, |
475 | mx2_camera_base + 2 * MX2_CAMERA_BUF_SIZE, | 467 | mx2_camera_base + 2 * MX2_CAMERA_BUF_SIZE, |
476 | MX2_CAMERA_BUF_SIZE, | 468 | MX2_CAMERA_BUF_SIZE, |
477 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); | 469 | DMA_MEMORY_EXCLUSIVE); |
478 | if (!(dma & DMA_MEMORY_MAP)) | ||
479 | return; | ||
480 | } | 470 | } |
481 | 471 | ||
482 | /* Emma-PrP for format conversion */ | 472 | /* Emma-PrP for format conversion */ |
483 | static void __init visstrim_emmaprp_init(void) | 473 | static void __init visstrim_emmaprp_init(void) |
484 | { | 474 | { |
485 | struct platform_device *pdev; | 475 | struct platform_device *pdev; |
486 | int dma; | 476 | int ret; |
487 | 477 | ||
488 | pdev = imx27_add_mx2_emmaprp(); | 478 | pdev = imx27_add_mx2_emmaprp(); |
489 | if (IS_ERR(pdev)) | 479 | if (IS_ERR(pdev)) |
@@ -493,11 +483,11 @@ static void __init visstrim_emmaprp_init(void) | |||
493 | * Use the same memory area as the analog camera since both | 483 | * Use the same memory area as the analog camera since both |
494 | * devices are, by nature, exclusive. | 484 | * devices are, by nature, exclusive. |
495 | */ | 485 | */ |
496 | dma = dma_declare_coherent_memory(&pdev->dev, | 486 | ret = dma_declare_coherent_memory(&pdev->dev, |
497 | mx2_camera_base, mx2_camera_base, | 487 | mx2_camera_base, mx2_camera_base, |
498 | MX2_CAMERA_BUF_SIZE, | 488 | MX2_CAMERA_BUF_SIZE, |
499 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); | 489 | DMA_MEMORY_EXCLUSIVE); |
500 | if (!(dma & DMA_MEMORY_MAP)) | 490 | if (ret) |
501 | pr_err("Failed to declare memory for emmaprp\n"); | 491 | pr_err("Failed to declare memory for emmaprp\n"); |
502 | } | 492 | } |
503 | 493 | ||
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c index bde9a9af6714..3cd030960c98 100644 --- a/arch/arm/mach-imx/mach-mx31moboard.c +++ b/arch/arm/mach-imx/mach-mx31moboard.c | |||
@@ -475,7 +475,7 @@ static phys_addr_t mx3_camera_base __initdata; | |||
475 | 475 | ||
476 | static int __init mx31moboard_init_cam(void) | 476 | static int __init mx31moboard_init_cam(void) |
477 | { | 477 | { |
478 | int dma, ret = -ENOMEM; | 478 | int dma, ret; |
479 | struct platform_device *pdev; | 479 | struct platform_device *pdev; |
480 | 480 | ||
481 | imx31_add_ipu_core(); | 481 | imx31_add_ipu_core(); |
@@ -484,11 +484,11 @@ static int __init mx31moboard_init_cam(void) | |||
484 | if (IS_ERR(pdev)) | 484 | if (IS_ERR(pdev)) |
485 | return PTR_ERR(pdev); | 485 | return PTR_ERR(pdev); |
486 | 486 | ||
487 | dma = dma_declare_coherent_memory(&pdev->dev, | 487 | ret = dma_declare_coherent_memory(&pdev->dev, |
488 | mx3_camera_base, mx3_camera_base, | 488 | mx3_camera_base, mx3_camera_base, |
489 | MX3_CAMERA_BUF_SIZE, | 489 | MX3_CAMERA_BUF_SIZE, |
490 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); | 490 | DMA_MEMORY_EXCLUSIVE); |
491 | if (!(dma & DMA_MEMORY_MAP)) | 491 | if (ret) |
492 | goto err; | 492 | goto err; |
493 | 493 | ||
494 | ret = platform_device_add(pdev); | 494 | ret = platform_device_add(pdev); |
diff --git a/arch/sh/drivers/pci/fixups-dreamcast.c b/arch/sh/drivers/pci/fixups-dreamcast.c index 1d1c5a227e50..c931d5872ffe 100644 --- a/arch/sh/drivers/pci/fixups-dreamcast.c +++ b/arch/sh/drivers/pci/fixups-dreamcast.c | |||
@@ -63,11 +63,10 @@ static void gapspci_fixup_resources(struct pci_dev *dev) | |||
63 | res.end = GAPSPCI_DMA_BASE + GAPSPCI_DMA_SIZE - 1; | 63 | res.end = GAPSPCI_DMA_BASE + GAPSPCI_DMA_SIZE - 1; |
64 | res.flags = IORESOURCE_MEM; | 64 | res.flags = IORESOURCE_MEM; |
65 | pcibios_resource_to_bus(dev->bus, ®ion, &res); | 65 | pcibios_resource_to_bus(dev->bus, ®ion, &res); |
66 | BUG_ON(!dma_declare_coherent_memory(&dev->dev, | 66 | BUG_ON(dma_declare_coherent_memory(&dev->dev, |
67 | res.start, | 67 | res.start, |
68 | region.start, | 68 | region.start, |
69 | resource_size(&res), | 69 | resource_size(&res), |
70 | DMA_MEMORY_MAP | | ||
71 | DMA_MEMORY_EXCLUSIVE)); | 70 | DMA_MEMORY_EXCLUSIVE)); |
72 | break; | 71 | break; |
73 | default: | 72 | default: |
diff --git a/drivers/base/dma-coherent.c b/drivers/base/dma-coherent.c index 6f6dc4d41788..b275eeb739f1 100644 --- a/drivers/base/dma-coherent.c +++ b/drivers/base/dma-coherent.c | |||
@@ -46,15 +46,10 @@ static bool dma_init_coherent_memory( | |||
46 | int pages = size >> PAGE_SHIFT; | 46 | int pages = size >> PAGE_SHIFT; |
47 | int bitmap_size = BITS_TO_LONGS(pages) * sizeof(long); | 47 | int bitmap_size = BITS_TO_LONGS(pages) * sizeof(long); |
48 | 48 | ||
49 | if ((flags & (DMA_MEMORY_MAP | DMA_MEMORY_IO)) == 0) | ||
50 | goto out; | ||
51 | if (!size) | 49 | if (!size) |
52 | goto out; | 50 | goto out; |
53 | 51 | ||
54 | if (flags & DMA_MEMORY_MAP) | 52 | mem_base = memremap(phys_addr, size, MEMREMAP_WC); |
55 | mem_base = memremap(phys_addr, size, MEMREMAP_WC); | ||
56 | else | ||
57 | mem_base = ioremap(phys_addr, size); | ||
58 | if (!mem_base) | 53 | if (!mem_base) |
59 | goto out; | 54 | goto out; |
60 | 55 | ||
@@ -77,12 +72,8 @@ static bool dma_init_coherent_memory( | |||
77 | 72 | ||
78 | out: | 73 | out: |
79 | kfree(dma_mem); | 74 | kfree(dma_mem); |
80 | if (mem_base) { | 75 | if (mem_base) |
81 | if (flags & DMA_MEMORY_MAP) | 76 | memunmap(mem_base); |
82 | memunmap(mem_base); | ||
83 | else | ||
84 | iounmap(mem_base); | ||
85 | } | ||
86 | return false; | 77 | return false; |
87 | } | 78 | } |
88 | 79 | ||
@@ -91,10 +82,7 @@ static void dma_release_coherent_memory(struct dma_coherent_mem *mem) | |||
91 | if (!mem) | 82 | if (!mem) |
92 | return; | 83 | return; |
93 | 84 | ||
94 | if (mem->flags & DMA_MEMORY_MAP) | 85 | memunmap(mem->virt_base); |
95 | memunmap(mem->virt_base); | ||
96 | else | ||
97 | iounmap(mem->virt_base); | ||
98 | kfree(mem->bitmap); | 86 | kfree(mem->bitmap); |
99 | kfree(mem); | 87 | kfree(mem); |
100 | } | 88 | } |
@@ -116,16 +104,16 @@ int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr, | |||
116 | dma_addr_t device_addr, size_t size, int flags) | 104 | dma_addr_t device_addr, size_t size, int flags) |
117 | { | 105 | { |
118 | struct dma_coherent_mem *mem; | 106 | struct dma_coherent_mem *mem; |
107 | int ret; | ||
119 | 108 | ||
120 | if (!dma_init_coherent_memory(phys_addr, device_addr, size, flags, | 109 | ret = dma_init_coherent_memory(phys_addr, device_addr, size, flags, &mem); |
121 | &mem)) | 110 | if (ret) |
122 | return 0; | 111 | return ret; |
123 | |||
124 | if (dma_assign_coherent_memory(dev, mem) == 0) | ||
125 | return flags & DMA_MEMORY_MAP ? DMA_MEMORY_MAP : DMA_MEMORY_IO; | ||
126 | 112 | ||
127 | dma_release_coherent_memory(mem); | 113 | ret = dma_assign_coherent_memory(dev, mem); |
128 | return 0; | 114 | if (ret) |
115 | dma_release_coherent_memory(mem); | ||
116 | return ret; | ||
129 | } | 117 | } |
130 | EXPORT_SYMBOL(dma_declare_coherent_memory); | 118 | EXPORT_SYMBOL(dma_declare_coherent_memory); |
131 | 119 | ||
@@ -186,15 +174,9 @@ static void *__dma_alloc_from_coherent(struct dma_coherent_mem *mem, | |||
186 | */ | 174 | */ |
187 | *dma_handle = mem->device_base + (pageno << PAGE_SHIFT); | 175 | *dma_handle = mem->device_base + (pageno << PAGE_SHIFT); |
188 | ret = mem->virt_base + (pageno << PAGE_SHIFT); | 176 | ret = mem->virt_base + (pageno << PAGE_SHIFT); |
189 | dma_memory_map = (mem->flags & DMA_MEMORY_MAP); | ||
190 | spin_unlock_irqrestore(&mem->spinlock, flags); | 177 | spin_unlock_irqrestore(&mem->spinlock, flags); |
191 | if (dma_memory_map) | 178 | memset(ret, 0, size); |
192 | memset(ret, 0, size); | ||
193 | else | ||
194 | memset_io(ret, 0, size); | ||
195 | |||
196 | return ret; | 179 | return ret; |
197 | |||
198 | err: | 180 | err: |
199 | spin_unlock_irqrestore(&mem->spinlock, flags); | 181 | spin_unlock_irqrestore(&mem->spinlock, flags); |
200 | return NULL; | 182 | return NULL; |
@@ -360,7 +342,7 @@ static int rmem_dma_device_init(struct reserved_mem *rmem, struct device *dev) | |||
360 | 342 | ||
361 | if (!mem && | 343 | if (!mem && |
362 | !dma_init_coherent_memory(rmem->base, rmem->base, rmem->size, | 344 | !dma_init_coherent_memory(rmem->base, rmem->base, rmem->size, |
363 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE, | 345 | DMA_MEMORY_EXCLUSIVE, |
364 | &mem)) { | 346 | &mem)) { |
365 | pr_err("Reserved memory: failed to init DMA memory pool at %pa, size %ld MiB\n", | 347 | pr_err("Reserved memory: failed to init DMA memory pool at %pa, size %ld MiB\n", |
366 | &rmem->base, (unsigned long)rmem->size / SZ_1M); | 348 | &rmem->base, (unsigned long)rmem->size / SZ_1M); |
diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c index b555ff9dd8fc..e584eddef0a7 100644 --- a/drivers/base/dma-mapping.c +++ b/drivers/base/dma-mapping.c | |||
@@ -176,13 +176,10 @@ int dmam_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr, | |||
176 | 176 | ||
177 | rc = dma_declare_coherent_memory(dev, phys_addr, device_addr, size, | 177 | rc = dma_declare_coherent_memory(dev, phys_addr, device_addr, size, |
178 | flags); | 178 | flags); |
179 | if (rc) { | 179 | if (!rc) |
180 | devres_add(dev, res); | 180 | devres_add(dev, res); |
181 | rc = 0; | 181 | else |
182 | } else { | ||
183 | devres_free(res); | 182 | devres_free(res); |
184 | rc = -ENOMEM; | ||
185 | } | ||
186 | 183 | ||
187 | return rc; | 184 | return rc; |
188 | } | 185 | } |
diff --git a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c index 96dc01750bc0..36762ec954e7 100644 --- a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c +++ b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c | |||
@@ -1708,11 +1708,10 @@ static int sh_mobile_ceu_probe(struct platform_device *pdev) | |||
1708 | err = dma_declare_coherent_memory(&pdev->dev, res->start, | 1708 | err = dma_declare_coherent_memory(&pdev->dev, res->start, |
1709 | res->start, | 1709 | res->start, |
1710 | resource_size(res), | 1710 | resource_size(res), |
1711 | DMA_MEMORY_MAP | | ||
1712 | DMA_MEMORY_EXCLUSIVE); | 1711 | DMA_MEMORY_EXCLUSIVE); |
1713 | if (!err) { | 1712 | if (err) { |
1714 | dev_err(&pdev->dev, "Unable to declare CEU memory.\n"); | 1713 | dev_err(&pdev->dev, "Unable to declare CEU memory.\n"); |
1715 | return -ENXIO; | 1714 | return err; |
1716 | } | 1715 | } |
1717 | 1716 | ||
1718 | pcdev->video_limit = resource_size(res); | 1717 | pcdev->video_limit = resource_size(res); |
diff --git a/drivers/scsi/NCR_Q720.c b/drivers/scsi/NCR_Q720.c index 05835bf1bf9c..54e7d26908ee 100644 --- a/drivers/scsi/NCR_Q720.c +++ b/drivers/scsi/NCR_Q720.c | |||
@@ -217,8 +217,7 @@ NCR_Q720_probe(struct device *dev) | |||
217 | } | 217 | } |
218 | 218 | ||
219 | if (dma_declare_coherent_memory(dev, base_addr, base_addr, | 219 | if (dma_declare_coherent_memory(dev, base_addr, base_addr, |
220 | mem_size, DMA_MEMORY_MAP) | 220 | mem_size, 0)) { |
221 | != DMA_MEMORY_MAP) { | ||
222 | printk(KERN_ERR "NCR_Q720: DMA declare memory failed\n"); | 221 | printk(KERN_ERR "NCR_Q720: DMA declare memory failed\n"); |
223 | goto out_release_region; | 222 | goto out_release_region; |
224 | } | 223 | } |
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c index a8b8d8b8d9f3..d4e0f7cd96fa 100644 --- a/drivers/usb/host/ohci-sm501.c +++ b/drivers/usb/host/ohci-sm501.c | |||
@@ -123,13 +123,12 @@ static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev) | |||
123 | * regular memory. The HCD_LOCAL_MEM flag does just that. | 123 | * regular memory. The HCD_LOCAL_MEM flag does just that. |
124 | */ | 124 | */ |
125 | 125 | ||
126 | if (!dma_declare_coherent_memory(dev, mem->start, | 126 | retval = dma_declare_coherent_memory(dev, mem->start, |
127 | mem->start - mem->parent->start, | 127 | mem->start - mem->parent->start, |
128 | resource_size(mem), | 128 | resource_size(mem), |
129 | DMA_MEMORY_MAP | | 129 | DMA_MEMORY_EXCLUSIVE); |
130 | DMA_MEMORY_EXCLUSIVE)) { | 130 | if (retval) { |
131 | dev_err(dev, "cannot declare coherent memory\n"); | 131 | dev_err(dev, "cannot declare coherent memory\n"); |
132 | retval = -ENXIO; | ||
133 | goto err1; | 132 | goto err1; |
134 | } | 133 | } |
135 | 134 | ||
diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c index cfcfadfc94fc..16d081a093bb 100644 --- a/drivers/usb/host/ohci-tmio.c +++ b/drivers/usb/host/ohci-tmio.c | |||
@@ -227,13 +227,10 @@ static int ohci_hcd_tmio_drv_probe(struct platform_device *dev) | |||
227 | goto err_ioremap_regs; | 227 | goto err_ioremap_regs; |
228 | } | 228 | } |
229 | 229 | ||
230 | if (!dma_declare_coherent_memory(&dev->dev, sram->start, | 230 | ret = dma_declare_coherent_memory(&dev->dev, sram->start, sram->start, |
231 | sram->start, | 231 | resource_size(sram), DMA_MEMORY_EXCLUSIVE); |
232 | resource_size(sram), | 232 | if (ret) |
233 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE)) { | ||
234 | ret = -EBUSY; | ||
235 | goto err_dma_declare; | 233 | goto err_dma_declare; |
236 | } | ||
237 | 234 | ||
238 | if (cell->enable) { | 235 | if (cell->enable) { |
239 | ret = cell->enable(dev); | 236 | ret = cell->enable(dev); |
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index abf369b11f54..b7dd11c02a45 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
@@ -694,9 +694,7 @@ static inline int dma_get_cache_alignment(void) | |||
694 | #endif | 694 | #endif |
695 | 695 | ||
696 | /* flags for the coherent memory api */ | 696 | /* flags for the coherent memory api */ |
697 | #define DMA_MEMORY_MAP 0x01 | 697 | #define DMA_MEMORY_EXCLUSIVE 0x01 |
698 | #define DMA_MEMORY_IO 0x02 | ||
699 | #define DMA_MEMORY_EXCLUSIVE 0x04 | ||
700 | 698 | ||
701 | #ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT | 699 | #ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT |
702 | int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr, | 700 | int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr, |
@@ -709,7 +707,7 @@ static inline int | |||
709 | dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr, | 707 | dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr, |
710 | dma_addr_t device_addr, size_t size, int flags) | 708 | dma_addr_t device_addr, size_t size, int flags) |
711 | { | 709 | { |
712 | return 0; | 710 | return -ENOSYS; |
713 | } | 711 | } |
714 | 712 | ||
715 | static inline void | 713 | static inline void |