Commit 87c4d1a7dce956b86e34329ed1b11a751ba9a8ea
Committed by
Greg Kroah-Hartman
1 parent
24fce61b0b
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
drivers: uio_dmem_genirq: Don't use DMA_ERROR_CODE to indicate unmapped regions
DMA_ERROR_CODE is not defined on all architectures and is architecture specific. Instead, use the constant, ~0 to indicate unmapped regions. Reported-by: Fengguang Wu <fengguang.wu@intel.com> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp> Cc: "Hans J. Koch" <hjk@hansjkoch.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 2 changed files with 5 additions and 3 deletions Side-by-side Diff
Documentation/DocBook/uio-howto.tmpl
... | ... | @@ -771,7 +771,7 @@ |
771 | 771 | <varname>/sys/class/uio/uioX/maps/mapY/*</varname>. |
772 | 772 | The dynmaic memory regions will be freed when the UIO device file is |
773 | 773 | closed. When no processes are holding the device file open, the address |
774 | - returned to userspace is DMA_ERROR_CODE. | |
774 | + returned to userspace is ~0. | |
775 | 775 | </para> |
776 | 776 | </sect1> |
777 | 777 |
drivers/uio/uio_dmem_genirq.c
... | ... | @@ -29,6 +29,7 @@ |
29 | 29 | #include <linux/of_address.h> |
30 | 30 | |
31 | 31 | #define DRIVER_NAME "uio_dmem_genirq" |
32 | +#define DMEM_MAP_ERROR (~0) | |
32 | 33 | |
33 | 34 | struct uio_dmem_genirq_platdata { |
34 | 35 | struct uio_info *uioinfo; |
... | ... | @@ -60,6 +61,7 @@ |
60 | 61 | addr = dma_alloc_coherent(&priv->pdev->dev, uiomem->size, |
61 | 62 | (dma_addr_t *)&uiomem->addr, GFP_KERNEL); |
62 | 63 | if (!addr) { |
64 | + uiomem->addr = DMEM_MAP_ERROR; | |
63 | 65 | ret = -ENOMEM; |
64 | 66 | break; |
65 | 67 | } |
... | ... | @@ -95,7 +97,7 @@ |
95 | 97 | dma_free_coherent(&priv->pdev->dev, uiomem->size, |
96 | 98 | priv->dmem_region_vaddr[dmem_region++], |
97 | 99 | uiomem->addr); |
98 | - uiomem->addr = DMA_ERROR_CODE; | |
100 | + uiomem->addr = DMEM_MAP_ERROR; | |
99 | 101 | ++uiomem; |
100 | 102 | } |
101 | 103 | |
... | ... | @@ -238,7 +240,7 @@ |
238 | 240 | break; |
239 | 241 | } |
240 | 242 | uiomem->memtype = UIO_MEM_PHYS; |
241 | - uiomem->addr = DMA_ERROR_CODE; | |
243 | + uiomem->addr = DMEM_MAP_ERROR; | |
242 | 244 | uiomem->size = pdata->dynamic_region_sizes[i]; |
243 | 245 | ++uiomem; |
244 | 246 | } |